Skip to content

Commit

Permalink
Optimize disclaimer formatting (simple-icons#10439)
Browse files Browse the repository at this point in the history
  • Loading branch information
LitoMore authored Feb 11, 2024
1 parent a50698e commit 56993f5
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 40 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ jobs:
uses: ./.github/actions/get-version
- name: Install dependencies
run: npm i
- name: Reformat README to regular markdown
run: node ./scripts/release/reformat-readme.js "${{ steps.get-version.outputs.version }}"
- name: Reformat to regular markdown
run: node ./scripts/release/reformat-markdown.js "${{ steps.get-version.outputs.version }}"
- name: Update SDK Typescript definitions
run: node ./scripts/release/update-sdk-ts-defs.js
- name: Build NodeJS package
Expand All @@ -74,8 +74,8 @@ jobs:
uses: kceb/git-message-action@v2
- id: get-version
uses: ./.github/actions/get-version
- name: Replace CDN theme image links from README
run: node ./scripts/release/reformat-readme.js "${{ steps.get-version.outputs.version }}"
- name: Reformat to regular markdown
run: node ./scripts/release/reformat-markdown.js "${{ steps.get-version.outputs.version }}"
- name: Configure GIT credentials
run: |
git config user.name "${GITHUB_ACTOR}"
Expand Down
6 changes: 3 additions & 3 deletions DISCLAIMER.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Simple Icons asks that its users read this disclaimer fully before including an

## Licenses, Copyrights & Trademarks

> **Note**\
> [!IMPORTANT]\
> The addition of licenses to Simple Icons is an ongoing project. Hence, the absence of licence data for a particular icon does not imply that the icon is not released under a license.
> **Note**\
> [!NOTE]\
> Simple Icons is released under CC0 - though that doesn't mean to imply that all icons within the project are also CC0. Please see individual licenses where available.
Simple Icons provides data on the license under which icons are available. We ask users to carefully consider this when using an icon. As licenses are subject to change we also ask our users to regularly check if the license of the icons they use have been changed.
Expand All @@ -29,7 +29,7 @@ Simple Icons cannot be held responsible for any legal activity raised by a brand

## Brand Guidelines

> **Note**\
> [!NOTE]\
> The addition of guidelines to Simple Icons is an ongoing project. In the meantime, users of Simple Icons are instead encouraged to check the `source` URL as, in some cases, the icon will have been sourced from official guidelines. The lack of a `guidelines` entry for a particular brand does not imply that the brand has no guidelines.
Simple Icons provides a link to a brand's _branding guidelines_ (or similar) if the brand provides one. We ask our users read these guidelines and ensure their usage of the brand's icon is in accordance with them. As guidelines are subject to change we also ask our users to regularly check if the brand guidelines of the icons they use have been updated.
Expand Down
41 changes: 41 additions & 0 deletions scripts/release/reformat-markdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* @fileoverview
* Rewrite some Markdown files.
*/

import path from 'node:path';
import { writeFile, readFile } from 'node:fs/promises';
import { getDirnameFromImportMeta } from '../../sdk.mjs';

const LINKS_BRANCH = process.argv[2] || 'develop';

const __dirname = getDirnameFromImportMeta(import.meta.url);

const rootDir = path.resolve(__dirname, '..', '..');
const readmeFile = path.resolve(rootDir, 'README.md');
const disclaimerFile = path.resolve(rootDir, 'DISCLAIMER.md');

const reformat = async (filePath) => {
const fileContent = await readFile(filePath, 'utf8');
await writeFile(
filePath,
fileContent
// Replace all CDN links with raw links
.replace(
/https:\/\/cdn.simpleicons.org\/(.+)\/000\/fff/g,
`https://raw.githubusercontent.com/simple-icons/simple-icons/${LINKS_BRANCH}/icons/$1.svg`,
)
// Replace all GitHub blockquotes with regular markdown
// Reference: https://github.com/orgs/community/discussions/16925
.replace(
/\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\](?!\()/g,
function (str, $0) {
const capital = $0.substr(0, 1);
const body = $0.substr(1).toLowerCase();
return `**${capital + body}**`;
},
),
);
};

await Promise.all([reformat(readmeFile), reformat(disclaimerFile)]);
33 changes: 0 additions & 33 deletions scripts/release/reformat-readme.js

This file was deleted.

0 comments on commit 56993f5

Please sign in to comment.