1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2025-01-05 01:20:39 +02:00

Optimize disclaimer formatting (#10439)

This commit is contained in:
LitoMore 2024-02-11 12:52:10 +08:00 committed by GitHub
parent a50698e705
commit 56993f5100
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 48 additions and 40 deletions

View File

@ -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
@ -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}"

View File

@ -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.
@ -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.

View File

@ -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)]);

View File

@ -1,33 +0,0 @@
/**
* @fileoverview
* Reformat README to regular markdown.
*/
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 readme = await readFile(readmeFile, 'utf8');
await writeFile(
readmeFile,
readme
.replace(
/https:\/\/cdn.simpleicons.org\/(.+)\/000\/fff/g,
`https://raw.githubusercontent.com/simple-icons/simple-icons/${LINKS_BRANCH}/icons/$1.svg`,
)
.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}**`;
},
),
);