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
insert_final_newline=true
[LICENSE.md]
indent_size=unset
indent_style=space
[*.{json,yml}]
indent_size=2
indent_style=space
insert_final_newline=true
trim_trailing_whitespace=true
[*.md]
indent_size=unset
[*.svg]
insert_final_newline=false
@ -20,4 +18,6 @@ trim_trailing_whitespace=false # Templates with trailing whitespace are more usa
[_data/simple-icons.json]
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
.github export-ignore
.gitpod.yml export-ignore
.travis.yml export-ignore
CNAME export-ignore

8
.github/labeler.yml vendored
View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -15,7 +15,7 @@ const iconMaxFloatPrecision = 5;
const iconTolerance = 0.001;
// 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 iconIgnored = !updateIgnoreFile ? require(ignoreFile) : {};
@ -224,14 +224,14 @@ module.exports = {
}
}
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 (upperDirectionCommands.includes(xPrevCoord)) {
xPrevCoord = undefined;
yPrevCoord = undefined;
let idx = index;
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 (upperHorDirectionCommand === xPrevCoordDeep) {
xPrevCoordDeep = yPrevCoordDeep;
@ -315,7 +315,7 @@ module.exports = {
if (!updateIgnoreFile && isIgnored(reporter.name, iconPath)) {
return;
}
/**
* Extracts collinear coordinates from SVG path straight lines
* (does not extracts collinear coordinates from curves).
@ -336,7 +336,7 @@ module.exports = {
let seg = segments[s],
cmd = seg[0],
nextCmd = s + 1 < segments.length ? segments[s + 1][0] : null;
if ('LM'.includes(cmd)) {
currAbsCoord[0] = seg[1];
currAbsCoord[1] = seg[2];
@ -368,7 +368,7 @@ module.exports = {
currAbsCoord = [startPoint[0], startPoint[1]];
_resetStartPoint = true;
} else {
throw new Error(`"${cmd}" command not handled`)
throw new Error(`"${cmd}" command not handled`);
}
if (startPoint === undefined) {
@ -396,7 +396,7 @@ module.exports = {
currLine[p][0],
currLine[p][1],
currLine[p + 1][0],
currLine[p + 1][1])
currLine[p + 1][1]);
if (_collinearCoord) {
collinearSegments.push(segments[s - currLine.length + p + 1]);
}
@ -405,7 +405,7 @@ module.exports = {
currLine = [];
}
}
return collinearSegments;
}

View file

@ -65,4 +65,4 @@ DEPENDENCIES
jekyll (= 4.2)
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.
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;
2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a persons 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;
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
7. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
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);
3. publicity and privacy rights pertaining to a persons 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;
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
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 Affirmers 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 Affirmers 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 Affirmers express Statement of Purpose.

View file

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

View file

@ -185,15 +185,15 @@
<link rel="mask-icon" href="https://simpleicons.org/images/logo.svg" color="#111111">
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<script>
(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),
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');
(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),
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');
ga('create', 'UA-100751516-2', 'auto');
ga('send', 'pageview');
ga('create', 'UA-100751516-2', 'auto');
ga('send', 'pageview');
var icons = [{{ allIconNames }}];
var icons = [{{ allIconNames }}];
</script>
</head>
<body class="order-by-color">

View file

@ -31,7 +31,7 @@
},
"scripts": {
"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",
"our-lint": "node scripts/lint.js",
"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)
*/
const fs = require("fs");
const path = require("path");

View file

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