-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c831a5e
Showing
42 changed files
with
10,798 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build/** | ||
*.spec.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"extends": ["plugin:prettier/recommended"], | ||
"env": { | ||
"browser": true, | ||
"es6": true, | ||
"node": true | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "tsconfig.json", | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"rules": { | ||
"@typescript-eslint/naming-convention": [ | ||
"error", | ||
{ | ||
"selector": "variable", | ||
"format": ["camelCase"] | ||
} | ||
], | ||
"@typescript-eslint/prefer-namespace-keyword": "error", | ||
"no-trailing-spaces": "error", | ||
"camelcase": "error", | ||
"prefer-const": "error", | ||
"eqeqeq": ["error", "smart"], | ||
"id-blacklist": [ | ||
"error", | ||
"any", | ||
"Number", | ||
"number", | ||
"String", | ||
"string", | ||
"Boolean", | ||
"boolean", | ||
"Undefined" | ||
], | ||
"id-match": "error", | ||
"no-eval": "error", | ||
"no-underscore-dangle": "error", | ||
"no-unsafe-finally": "error", | ||
"no-var": "error", | ||
"spaced-comment": "error", | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
"endOfLine": "auto" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# These are supported funding model platforms | ||
github: [pkief] | ||
custom: ['https://paypal.me/philippkief', 'https://buymeacoffee.com/pkief'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Build + Test | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v2 | ||
- name: Setup Node.js ⚙️ | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 'lts/*' | ||
- name: Install node_modules 📦 | ||
run: npm ci | ||
- name: Cache node_modules 💾 | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Test + Build ⚒️ | ||
run: | | ||
npm test | ||
npm run lint | ||
npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Release + Publish | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
versionChange: | ||
type: choice | ||
description: Select the version change | ||
requried: true | ||
options: | ||
- major | ||
- minor | ||
- patch | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
env: | ||
VERSION_CHANGE: ${{ github.event.inputs.versionChange }} | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js ⚙️ | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 'lts/*' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Install node_modules 📦 | ||
run: | | ||
npm ci | ||
- name: Update version ↗ | ||
run: | | ||
git config --global user.name 'Philipp Kief' | ||
git config --global user.email '[email protected]' | ||
git config --global push.followTags true | ||
npm version ${{ env.VERSION_CHANGE }} -m "Release %s" | ||
- name: Get meta data 🔍 | ||
run: | | ||
NODE_VERSION=$(node -p -e "require('./package.json').version") | ||
echo VERSION=$NODE_VERSION >> $GITHUB_ENV | ||
NODE_NAME=$(node -p -e "require('./package.json').name") | ||
echo NAME=$NODE_NAME >> $GITHUB_ENV | ||
NODE_DISPLAY_NAME=$(node -p -e "require('./package.json').displayName") | ||
echo DISPLAY_NAME=$NODE_DISPLAY_NAME >> $GITHUB_ENV | ||
- name: Build ⚒️ | ||
run: npm run build | ||
- name: Push tags 📌 | ||
run: git push | ||
- name: Release ${{ env.VERSION }} 🔆 | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: v${{ env.VERSION }} | ||
name: ${{ env.DISPLAY_NAME }} v${{ env.VERSION }} | ||
generate_release_notes: true | ||
- name: Publish to NPM Registry 🚀 | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Dependencies | ||
node_modules | ||
|
||
# Build | ||
lib | ||
out | ||
dist | ||
|
||
# Tests | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Ignore everything | ||
* | ||
*/** | ||
|
||
# Whitelist what you need | ||
!lib/* | ||
!bin/* | ||
!LICENSE.md | ||
!logo.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": true, | ||
"endOfLine": "auto" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
}, | ||
"eslint.validate": ["typescript"], | ||
"editor.formatOnSave": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Changelog | ||
|
||
All notable changes to this project will be documented in this file. Dates are displayed in UTC. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
The MIT License (MIT) | ||
Copyright (c) 2022 Philipp Kief | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<h1 align="center"> | ||
<br> | ||
<img src="https://github.com/PKief/vscode-icon-theme-reviewer/raw/main/logo.png" alt="logo" width="200"> | ||
<br><br> | ||
SVG Color Linter | ||
<br> | ||
<br> | ||
</h1> | ||
|
||
<h4 align="center">Linting tool to check if SVG files only use colors of a given color palette.</h4> | ||
|
||
## CLI Command | ||
|
||
The tool can be executed with this command: | ||
|
||
``` | ||
npx vscode-icon-theme-reviewer file1.svg file2.svg | ||
``` | ||
|
||
It will fetch all the colors of a YAML file which must have the following structure: | ||
|
||
```yaml | ||
colors: | ||
- '#FFEBEE' | ||
- '#FFCDD2' | ||
- '#EF9A9A' | ||
- '#E57373' | ||
- '#EF5350' | ||
- '#F44336' | ||
``` | ||
It also supports glob file patterns to check multiple files matching the pattern like this: | ||
``` | ||
npx vscode-icon-theme-reviewer --colors colors.yml ./images/**/*.svg ./another-dir/*.svg test.svg | ||
``` | ||
|
||
## Programmatic use | ||
|
||
The tool can be imported as module into existing JavaScript or TypeScript code. Therefor it is necessary to install it via npm or yarn: | ||
|
||
NPM: | ||
|
||
``` | ||
npm install --save-dev vscode-icon-theme-reviewer | ||
``` | ||
|
||
Yarn: | ||
|
||
``` | ||
yarn add --dev vscode-icon-theme-reviewer | ||
``` | ||
|
||
The module can be imported like this: | ||
|
||
```ts | ||
import { isColorInPalette, getSuggestions } from 'vscode-icon-theme-reviewer'; | ||
|
||
isColorInPalette('#FFFFFF', ['#EEEEEE', '#121212']); | ||
// false | ||
|
||
getSuggestions('#C0CA35', ['#EEEEEE', '#121212']); | ||
// [ | ||
// { hex: '#C0CA33', distance: 0.160467661071053 }, | ||
// { hex: '#CDDC39', distance: 4.307076277707079 }, | ||
// { hex: '#D4E157', distance: 5.606714639567858 }, | ||
// { hex: '#AFB42B', distance: 5.713845679863578 }, | ||
// { hex: '#DCE775', distance: 8.065940911169271 } | ||
// ] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env node | ||
require('../lib/cli/index.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"repositoryUrl": "https://github.com/PKief/vscode-icon-theme-reviewer", | ||
"blacklistPattern": "^Release \\d+\\.\\d+\\.\\d+|^\\d+\\.\\d+\\.\\d+$" | ||
} |
Oops, something went wrong.