1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-12-16 01:10:30 +02:00

Minor improvements (#4708)

* Remove .travis.yml reference from .gitattributes

* Minor refactoring of .svglintrc.js

- Remove unused variables
- Fix missing semi-colons
- Remove unneeded indentation

* Prevent error in clean command due to missing files

* Fix indentations

* Further improvements to Editorconfig and indentation

* Format YAML files

- Update indentation for array notation
- Normalize use of newlines
This commit is contained in:
Eric Cornelissen 2021-01-15 21:47:00 +01:00 committed by GitHub
parent 8fc59f0507
commit a4ca74602f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 185 additions and 188 deletions

View File

@ -2,15 +2,13 @@ root=true
[*] [*]
charset=utf-8 charset=utf-8
insert_final_newline=true
[LICENSE.md]
indent_size=unset
indent_style=space
[*.{json,yml}]
indent_size=2 indent_size=2
indent_style=space indent_style=space
insert_final_newline=true
trim_trailing_whitespace=true
[*.md]
indent_size=unset
[*.svg] [*.svg]
insert_final_newline=false insert_final_newline=false
@ -20,4 +18,6 @@ trim_trailing_whitespace=false # Templates with trailing whitespace are more usa
[_data/simple-icons.json] [_data/simple-icons.json]
indent_size=4 indent_size=4
trim_trailing_whitespace=true
[index.html]
indent_size=4

1
.gitattributes vendored
View File

@ -14,5 +14,4 @@ Gemfile.lock -diff
# Don't export/archive these files # Don't export/archive these files
.github export-ignore .github export-ignore
.gitpod.yml export-ignore .gitpod.yml export-ignore
.travis.yml export-ignore
CNAME export-ignore CNAME export-ignore

8
.github/labeler.yml vendored
View File

@ -1,6 +1,6 @@
new icon: new icon:
- any: [icons/*.svg] - any: [icons/*.svg]
status: 'added' status: added
icon outdated: icon outdated:
- any: [icons/*.svg] - any: [icons/*.svg]
status: 'modified' status: modified

View File

@ -7,6 +7,6 @@ jobs:
triage: triage:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: ericcornelissen/labeler@label-based-on-status - uses: ericcornelissen/labeler@label-based-on-status
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -8,6 +8,6 @@ jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: simple-icons/release-action@master - uses: simple-icons/release-action@master
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -8,6 +8,6 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'release') if: contains(github.event.pull_request.labels.*.name, 'release')
steps: steps:
- uses: simple-icons/release-action@master - uses: simple-icons/release-action@master
with: with:
repo-token: ${{ secrets.RELEASE_TOKEN }} repo-token: ${{ secrets.RELEASE_TOKEN }}

View File

@ -2,82 +2,82 @@ name: Publish
on: on:
push: push:
branches: branches:
- master - master
jobs: jobs:
npm: npm:
name: NPM Package name: NPM Package
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Use Node.js 12.x - name: Use Node.js 12.x
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: 12.x node-version: 12.x
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Sanity check - name: Sanity check
run: | run: |
npm run lint npm run lint
npm run test npm run test
- name: Deploy to NPM - name: Deploy to NPM
uses: JS-DevTools/npm-publish@v1 uses: JS-DevTools/npm-publish@v1
with: with:
token: ${{ secrets.NPM_TOKEN }} token: ${{ secrets.NPM_TOKEN }}
github: github:
name: GitHub release name: GitHub release
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Use Node.js 12.x - name: Use Node.js 12.x
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: 12.x node-version: 12.x
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Sanity check - name: Sanity check
run: | run: |
npm run lint npm run lint
npm run test npm run test
- name: Get commit message (for release title and body) - name: Get commit message (for release title and body)
id: commit id: commit
uses: kceb/git-message-action@v1 uses: kceb/git-message-action@v1
- name: Get release title and body - name: Get release title and body
id: release id: release
run: | run: |
COMMIT_MSG="$(echo "${{ steps.commit.outputs.git-message }}")" COMMIT_MSG="$(echo "${{ steps.commit.outputs.git-message }}")"
RELEASE_TITLE="$(echo "$COMMIT_MSG" | head -n 1)" RELEASE_TITLE="$(echo "$COMMIT_MSG" | head -n 1)"
echo "::set-output name=title::$RELEASE_TITLE" echo "::set-output name=title::$RELEASE_TITLE"
RELEASE_BODY="$(echo "$COMMIT_MSG" | tail -n +3)" RELEASE_BODY="$(echo "$COMMIT_MSG" | tail -n +3)"
echo "::set-output name=body::$RELEASE_BODY" echo "::set-output name=body::$RELEASE_BODY"
- name: Get release version - name: Get release version
id: get-version id: get-version
run: | run: |
export PACKAGE_VERSION=$(cat package.json | grep 'version' | sed 's/[ \",:]//g' | sed 's/version//') export PACKAGE_VERSION=$(cat package.json | grep 'version' | sed 's/[ \",:]//g' | sed 's/version//')
echo "::set-output name=version::$PACKAGE_VERSION" echo "::set-output name=version::$PACKAGE_VERSION"
- name: Create and push git tag - name: Create and push git tag
uses: actions-ecosystem/action-push-tag@v1 uses: actions-ecosystem/action-push-tag@v1
with: with:
tag: ${{ steps.get-version.outputs.version }} tag: ${{ steps.get-version.outputs.version }}
message: ${{ steps.commit.outputs.git-message }} message: ${{ steps.commit.outputs.git-message }}
- name: Create release - name: Create release
uses: actions/create-release@v1 uses: actions/create-release@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: ${{ steps.get-version.outputs.version }} tag_name: ${{ steps.get-version.outputs.version }}
release_name: ${{ steps.release.outputs.title }} release_name: ${{ steps.release.outputs.title }}
body: ${{ steps.release.outputs.body }} body: ${{ steps.release.outputs.body }}
font: font:
name: Trigger simple-icons-font release name: Trigger simple-icons-font release
needs: npm needs: npm
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Trigger simple-icons-font release - name: Trigger simple-icons-font release
run: | run: |
curl -X POST \ curl -X POST \
-H "Authorization: Bearer ${{ secrets.SIMPLE_ICONS_FONT_TOKEN }}" \ -H "Authorization: Bearer ${{ secrets.SIMPLE_ICONS_FONT_TOKEN }}" \
-d '{"ref":"develop"}' \ -d '{"ref":"develop"}' \
https://api.github.com/repos/simple-icons/simple-icons-font/actions/workflows/auto-release.yml/dispatches https://api.github.com/repos/simple-icons/simple-icons-font/actions/workflows/auto-release.yml/dispatches

View File

@ -25,7 +25,6 @@ jobs:
out of scope out of scope
pending pending
won't add won't add
remove-closed-pr-labels: remove-closed-pr-labels:
name: Remove closed pull request labels name: Remove closed pull request labels
if: github.event_name == 'pull_request_target' && (! github.event.pull_request.merged) if: github.event_name == 'pull_request_target' && (! github.event.pull_request.merged)
@ -37,7 +36,6 @@ jobs:
labels: | labels: |
in discussion in discussion
pending pending
remove-closed-issue-labels: remove-closed-issue-labels:
name: Remove closed issue labels name: Remove closed issue labels
if: github.event.issue.state == 'closed' if: github.event.issue.state == 'closed'

View File

@ -6,45 +6,45 @@ jobs:
name: Lint name: Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Use Node.js 12.x - name: Use Node.js 12.x
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: 12.x node-version: 12.x
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Run linter - name: Run linter
run: | run: |
npm run jsonlint npm run jsonlint
npm run svglint npm run svglint
npm run wslint npm run wslint
npm run our-lint npm run our-lint
build: build:
name: Build website name: Build website
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Use Ruby 2.7 - name: Use Ruby 2.7
uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
ruby-version: 2.7 ruby-version: 2.7
# https://github.com/ruby/setup-ruby/blob/master/README.md#caching-bundle-install-automatically # https://github.com/ruby/setup-ruby/blob/master/README.md#caching-bundle-install-automatically
bundler-cache: true bundler-cache: true
- name: Build website - name: Build website
run: bundle exec jekyll build run: bundle exec jekyll build
test: test:
name: Test package name: Test package
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Use Node.js 12.x - name: Use Node.js 12.x
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: 12.x node-version: 12.x
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Run tests - name: Run tests
run: npm run test run: npm run test

View File

@ -1,34 +1,34 @@
{ {
"title": "Simple Icons", "title": "Simple Icons",
"type": "object", "type": "object",
"properties": { "properties": {
"icons": { "icons": {
"description": "The list of icons", "description": "The list of icons",
"type": "array", "type": "array",
"items": { "items": {
"description": "A single icon", "description": "A single icon",
"type": "object", "type": "object",
"properties": { "properties": {
"title": { "title": {
"description": "The icons name", "description": "The icons name",
"type": "string", "type": "string",
"required": true "required": true
}, },
"hex": { "hex": {
"description": "The icons color, as HEX (without #)", "description": "The icons color, as HEX (without #)",
"type": "string", "type": "string",
"pattern": "^[0-9A-F]{6}$", "pattern": "^[0-9A-F]{6}$",
"required": true "required": true
}, },
"source": { "source": {
"description": "The website from which the icon originated", "description": "The website from which the icon originated",
"type": "string", "type": "string",
"pattern": "^https?://[^\\s]+$", "pattern": "^https?://[^\\s]+$",
"required": true "required": true
} }
}, },
"required": true "required": true
} }
}
} }
}
} }

View File

@ -15,7 +15,7 @@ const iconMaxFloatPrecision = 5;
const iconTolerance = 0.001; const iconTolerance = 0.001;
// set env SI_UPDATE_IGNORE to recreate the ignore file // set env SI_UPDATE_IGNORE to recreate the ignore file
const updateIgnoreFile = process.env.SI_UPDATE_IGNORE === 'true' const updateIgnoreFile = process.env.SI_UPDATE_IGNORE === 'true';
const ignoreFile = "./.svglint-ignored.json"; const ignoreFile = "./.svglint-ignored.json";
const iconIgnored = !updateIgnoreFile ? require(ignoreFile) : {}; const iconIgnored = !updateIgnoreFile ? require(ignoreFile) : {};
@ -224,14 +224,14 @@ module.exports = {
} }
} }
if (index > 0) { if (index > 0) {
let [yPrevCoord, xPrevCoord, ...prevRest] = [...absSegments[index - 1]].reverse(); let [yPrevCoord, xPrevCoord] = [...absSegments[index - 1]].reverse();
// If the previous command was a direction one, we need to iterate back until we find the missing coordinates // If the previous command was a direction one, we need to iterate back until we find the missing coordinates
if (upperDirectionCommands.includes(xPrevCoord)) { if (upperDirectionCommands.includes(xPrevCoord)) {
xPrevCoord = undefined; xPrevCoord = undefined;
yPrevCoord = undefined; yPrevCoord = undefined;
let idx = index; let idx = index;
while (--idx > 0 && (xPrevCoord === undefined || yPrevCoord === undefined)) { while (--idx > 0 && (xPrevCoord === undefined || yPrevCoord === undefined)) {
let [yPrevCoordDeep, xPrevCoordDeep, ...rest] = [...absSegments[idx]].reverse(); let [yPrevCoordDeep, xPrevCoordDeep] = [...absSegments[idx]].reverse();
// If the previous command was a horizontal movement, we need to consider the single coordinate as x // If the previous command was a horizontal movement, we need to consider the single coordinate as x
if (upperHorDirectionCommand === xPrevCoordDeep) { if (upperHorDirectionCommand === xPrevCoordDeep) {
xPrevCoordDeep = yPrevCoordDeep; xPrevCoordDeep = yPrevCoordDeep;
@ -315,7 +315,7 @@ module.exports = {
if (!updateIgnoreFile && isIgnored(reporter.name, iconPath)) { if (!updateIgnoreFile && isIgnored(reporter.name, iconPath)) {
return; return;
} }
/** /**
* Extracts collinear coordinates from SVG path straight lines * Extracts collinear coordinates from SVG path straight lines
* (does not extracts collinear coordinates from curves). * (does not extracts collinear coordinates from curves).
@ -336,7 +336,7 @@ module.exports = {
let seg = segments[s], let seg = segments[s],
cmd = seg[0], cmd = seg[0],
nextCmd = s + 1 < segments.length ? segments[s + 1][0] : null; nextCmd = s + 1 < segments.length ? segments[s + 1][0] : null;
if ('LM'.includes(cmd)) { if ('LM'.includes(cmd)) {
currAbsCoord[0] = seg[1]; currAbsCoord[0] = seg[1];
currAbsCoord[1] = seg[2]; currAbsCoord[1] = seg[2];
@ -368,7 +368,7 @@ module.exports = {
currAbsCoord = [startPoint[0], startPoint[1]]; currAbsCoord = [startPoint[0], startPoint[1]];
_resetStartPoint = true; _resetStartPoint = true;
} else { } else {
throw new Error(`"${cmd}" command not handled`) throw new Error(`"${cmd}" command not handled`);
} }
if (startPoint === undefined) { if (startPoint === undefined) {
@ -396,7 +396,7 @@ module.exports = {
currLine[p][0], currLine[p][0],
currLine[p][1], currLine[p][1],
currLine[p + 1][0], currLine[p + 1][0],
currLine[p + 1][1]) currLine[p + 1][1]);
if (_collinearCoord) { if (_collinearCoord) {
collinearSegments.push(segments[s - currLine.length + p + 1]); collinearSegments.push(segments[s - currLine.length + p + 1]);
} }
@ -405,7 +405,7 @@ module.exports = {
currLine = []; currLine = [];
} }
} }
return collinearSegments; return collinearSegments;
} }

View File

@ -65,4 +65,4 @@ DEPENDENCIES
jekyll (= 4.2) jekyll (= 4.2)
BUNDLED WITH BUNDLED WITH
2.2.0 2.2.0

View File

@ -9,13 +9,13 @@ Certain owners wish to permanently relinquish those rights to a Work for the pur
For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the “Affirmer”), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the “Affirmer”), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights (“Copyright and Related Rights”). Copyright and Related Rights include, but are not limited to, the following: 1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights (“Copyright and Related Rights”). Copyright and Related Rights include, but are not limited to, the following:
1. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; 1. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
2. moral rights retained by the original author(s) and/or performer(s); 2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a person’s image or likeness depicted in a Work; 3. publicity and privacy rights pertaining to a person’s image or likeness depicted in a Work;
4. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(i), below; 4. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(i), below;
5. rights protecting the extraction, dissemination, use and reuse of data in a Work; 5. rights protecting the extraction, dissemination, use and reuse of data in a Work;
6. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and 6. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
7. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. 7. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the “Waiver”). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer’s heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer’s express Statement of Purpose. 2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the “Waiver”). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer’s heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer’s express Statement of Purpose.

View File

@ -1,10 +1,10 @@
exclude: exclude:
- tests - tests
- scripts - scripts
- composer.json - composer.json
- CONTRIBUTING.md - CONTRIBUTING.md
- Dockerfile - Dockerfile
- index.js - index.js
- package-lock.json - package-lock.json
- package.json - package.json
- README.md - README.md

View File

@ -185,15 +185,15 @@
<link rel="mask-icon" href="https://simpleicons.org/images/logo.svg" color="#111111"> <link rel="mask-icon" href="https://simpleicons.org/images/logo.svg" color="#111111">
<link rel="stylesheet" href="stylesheet.css" type="text/css"> <link rel="stylesheet" href="stylesheet.css" type="text/css">
<script> <script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-100751516-2', 'auto'); ga('create', 'UA-100751516-2', 'auto');
ga('send', 'pageview'); ga('send', 'pageview');
var icons = [{{ allIconNames }}]; var icons = [{{ allIconNames }}];
</script> </script>
</head> </head>
<body class="order-by-color"> <body class="order-by-color">

View File

@ -31,7 +31,7 @@
}, },
"scripts": { "scripts": {
"build": "node scripts/build-package.js", "build": "node scripts/build-package.js",
"clean": "rm icons/*.js index.js", "clean": "rm -f icons/*.js index.js",
"lint": "run-s our-lint jsonlint svglint wslint", "lint": "run-s our-lint jsonlint svglint wslint",
"our-lint": "node scripts/lint.js", "our-lint": "node scripts/lint.js",
"jsonlint": "jsonlint _data/simple-icons.json -q -V .jsonlintschema", "jsonlint": "jsonlint _data/simple-icons.json -q -V .jsonlintschema",

View File

@ -2,7 +2,7 @@
/** /**
* @fileoverview Lints for the package that can't be implemented in the existing linters (e.g. jsonlint/svglint) * @fileoverview Lints for the package that can't be implemented in the existing linters (e.g. jsonlint/svglint)
*/ */
const fs = require("fs"); const fs = require("fs");
const path = require("path"); const path = require("path");

View File

@ -10,7 +10,7 @@ Object.defineProperty(icons, "get", {
for (var iconName in icons) { for (var iconName in icons) {
var icon = icons[iconName]; var icon = icons[iconName];
if (icon.title.toLowerCase() === normalizedName || icon.slug === normalizedName) { if (icon.title.toLowerCase() === normalizedName || icon.slug === normalizedName) {
return icon; return icon;
} }
} }
} }