Compare commits

...

11 Commits

Author SHA1 Message Date
Eric Fennis
b75aee4df3 Add Pilcrow Icon (paragraph) (#884)
* add pilcrow icon
* add tags
2022-11-15 10:34:25 +01:00
Ekow Baah-Nyarkoh
0c93e7bcb4 update documentation with correct import for all icons (#875) 2022-11-13 21:59:29 +01:00
Lucide Bot
538dad2d30 📦 Bump lucide package versions to 0.100.0 2022-11-10 21:58:48 +00:00
Karsa
797fa5c431 Update baby.svg (#881) 2022-11-10 22:52:27 +01:00
Wojciech Maj
8ccbb8f2e3 Update lucide-react on marketing site (#848) 2022-11-08 15:43:41 +01:00
Badraxas
b77ce99363 Adds devices icon (#871)
* Adding devices icon

* Update icons/devices.svg

* rename devices into monitor-smartphone

Co-authored-by: Karsa <contact@karsa.org>
2022-11-08 15:33:45 +01:00
Sean van Zuidam
c7f73611ca Add Magento 2 Hyva package to docs (#857)
* ADD: Hyva to 3de party section

* ADD: Hyva to readme

* IMP: description
2022-11-08 08:08:26 +01:00
Eric Fennis
2a1178b8a3 Introduce Docker Image for font building (#870)
* Add dockerfile

* Make the dockerfile work

* try docker container for font building

* remove workflow dep

* add docker compose file

* test docker image

* update build font flow

* update to v3

* cleanup

* add filter options for installs

* test

* revert filter on install

* optimize font building

* Rename workflow

* test and compare workflows

* test workflow

* test

* try with filter

* test old script github actions

* Fix old script

* this works?

* test script

* finialize font script

* remove workspace packages

* add pnpm-lock.yaml in workflows
2022-11-08 08:07:32 +01:00
Louis Bailleau
55ae908018 Update all packages dependencies in project root (#863)
* Update `svgo` and `svgson` version and fix some tests

* Update eslint-related packages and fix all linter errors

* Update all rollup-related packages version

* Update all rollup-related packages (part 2)

* Update the rest of package which need to be updated

* Fix unwanted comment

* Fix unwanted comment (again)
2022-11-07 22:29:19 +01:00
Ekow Baah-Nyarkoh
1cdcfd6403 Publish angular dist folder instead of project folder (#872)
* publish angular dist folder instead of project folder

* publish angular dist folder instead of project folder
2022-11-03 09:17:54 +01:00
Lucide Bot
810cd84876 📦 Bump lucide package versions to 0.98.0 2022-11-02 20:09:33 +00:00
69 changed files with 33715 additions and 1493 deletions

View File

@@ -3,3 +3,4 @@ build
coverage
lib
tests
node_modules

View File

@@ -1,7 +1,7 @@
module.exports = {
env: {
browser: true,
node: true
node: true,
},
extends: ['airbnb-base', 'prettier'],
plugins: ['import', 'prettier'],
@@ -14,12 +14,26 @@ module.exports = {
'error',
{
singleQuote: true,
trailingComma: 'all'
}
]
trailingComma: 'all',
},
],
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: ['**/*.test.js', '**/*.spec.js', './scripts/**'] },
],
'import/extensions': [
'error',
{
pattern: {
mjs: 'always',
json: 'always',
},
},
],
},
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./site/tsconfig.json', './packages/*/tsconfig.json'],
ecmaVersion: 2020,
},
};

View File

@@ -4,9 +4,11 @@ on:
pull_request:
paths:
- packages/lucide-angular/**
- pnpm-lock.yaml
push:
paths:
- packages/lucide-angular/**
- pnpm-lock.yaml
jobs:
lucide-angular:

59
.github/workflows/lucide-font.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
name: Lucide font checks
on:
pull_request:
paths:
- icons/**
- pnpm-lock.yaml
push:
paths:
- icons/**
- pnpm-lock.yaml
jobs:
lucide-font:
runs-on: ubuntu-latest
container: ericfennis/lucide-font:latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3.4.1
with:
node-version: 16
- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-lucide-font-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-lucide-font-pnpm-store-
- name: Install dependencies
run: pnpm install --filter outline-svg
- name: Outline svg Icons
run: pnpm build:outline-icons
- name: Create directory
run: mkdir lucide-font
- name: Build font
run: fontcustom compile "./outlined" -h -n "lucide" -o ./lucide-font -F
- name: "Upload to Artifacts"
uses: actions/upload-artifact@v1
with:
name: lucide-font
path: lucide-font

View File

@@ -4,9 +4,11 @@ on:
pull_request:
paths:
- packages/lucide-preact/**
- pnpm-lock.yaml
push:
paths:
- packages/lucide-preact/**
- pnpm-lock.yaml
jobs:
lucide-preact:

View File

@@ -4,9 +4,11 @@ on:
pull_request:
paths:
- packages/lucide-react-native/**
- pnpm-lock.yaml
push:
paths:
- packages/lucide-react-native/**
- pnpm-lock.yaml
jobs:
lucide-react-native:

View File

@@ -4,9 +4,11 @@ on:
pull_request:
paths:
- packages/lucide-react/**
- pnpm-lock.yaml
push:
paths:
- packages/lucide-react/**
- pnpm-lock.yaml
jobs:
lucide-react:

View File

@@ -4,9 +4,11 @@ on:
pull_request:
paths:
- packages/lucide-solid/**
- pnpm-lock.yaml
push:
paths:
- packages/lucide-solid/**
- pnpm-lock.yaml
jobs:
lucide-solid:

View File

@@ -4,9 +4,11 @@ on:
pull_request:
paths:
- packages/lucide-static/**
- pnpm-lock.yaml
push:
paths:
- packages/lucide-static/**
- pnpm-lock.yaml
jobs:
lucide-static:

View File

@@ -4,9 +4,11 @@ on:
pull_request:
paths:
- packages/lucide-svelte/**
- pnpm-lock.yaml
push:
paths:
- packages/lucide-svelte/**
- pnpm-lock.yaml
jobs:
lucide-svelte:

View File

@@ -4,9 +4,11 @@ on:
pull_request:
paths:
- packages/lucide-vue-next/**
- pnpm-lock.yaml
push:
paths:
- packages/lucide-vue-next/**
- pnpm-lock.yaml
jobs:
lucide-vue-next:

View File

@@ -4,9 +4,11 @@ on:
pull_request:
paths:
- packages/lucide-vue/**
- pnpm-lock.yaml
push:
paths:
- packages/lucide-vue/**
- pnpm-lock.yaml
jobs:
lucide-vue:

View File

@@ -4,9 +4,11 @@ on:
pull_request:
paths:
- packages/lucide/**
- pnpm-lock.yaml
push:
paths:
- packages/lucide/**
- pnpm-lock.yaml
jobs:
lucide:

View File

@@ -348,7 +348,7 @@ jobs:
run: pnpm --filter lucide-angular test
- name: Publish
run: pnpm --filter lucide-angular publish dist --no-git-checks --ignore-scripts
run: pnpm --filter lucide-angular publish --no-git-checks --ignore-scripts
- name: Upload package.json
uses: actions/upload-artifact@v2
@@ -581,9 +581,10 @@ jobs:
if: github.repository == 'lucide-icons/lucide'
runs-on: ubuntu-latest
needs: pre-build
container: ericfennis/lucide-font:latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/setup-node@v3.4.1
with:
node-version: 16
@@ -607,39 +608,19 @@ jobs:
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install FontForge
run: sudo apt-get install zlib1g-dev fontforge
- name: Clone sfnt2woff-zopfli repo
run: git clone https://github.com/bramstein/sfnt2woff-zopfli.git sfnt2woff-zopfli
- name: Install and move sfnt2woff-zopfli
run: |
cd sfnt2woff-zopfli
make
sudo mv sfnt2woff-zopfli /usr/local/bin/sfnt2woff
- name: Clone woff2
run: git clone --recursive https://github.com/google/woff2.git
- name: Install woff2
run: |
cd woff2
sudo make clean all
sudo mv woff2_compress /usr/local/bin/ && sudo mv woff2_decompress /usr/local/bin/
- name: Install Font Custom dependency
run: sudo gem install fontcustom
- name: Install dependencies
run: pnpm install
run: pnpm install --filter outline-svg
- name: Build Icon Font
run: |
mkdir lucide-font
pnpm build:outline-icons --outputDir=converted_icons && fontcustom compile "./converted_icons" -h -n "lucide" -o ./lucide-font -F
- name: Outline svg Icons
run: pnpm build:outline-icons
- name: 'Upload to Artifacts'
- name: Create directory
run: mkdir lucide-font
- name: Build font
run: fontcustom compile "./outlined" -h -n "lucide" -o ./lucide-font -F
- name: "Upload to Artifacts"
uses: actions/upload-artifact@v1
with:
name: lucide-font

1
.gitignore vendored
View File

@@ -12,6 +12,7 @@ stash
coverage
stats
*.log
outlined
packages/**/src/icons/*.js
packages/**/src/icons/*.ts
packages/**/LICENSE

View File

@@ -38,6 +38,7 @@ Lucide is trying to expand the icon set as much as possible while staying faithf
- [Flutter](#flutter)
- [Svelte](#svelte)
- [Solid](#solid)
- [Hyva](#hyva)
- [Contributing](#contributing)
- [Community](#community)
- [License](#license)
@@ -240,6 +241,16 @@ npm install lucide-solid
For more details, see the [documentation](https://github.com/lucide-icons/lucide/tree/main/packages/lucide-solid#lucide-solid).
### Hyva
Implementation of Lucide icon's using Hyvä's svg php viewmodal to render icons for Magento 2 Hyva theme based projects.
```sh
composer require siteation/magento2-hyva-icons-lucide
```
For more details, see the [documentation](https://github.com/Siteation/magento2-hyva-icons-lucide/blob/main/README.md).
## Contributing
For more info on how to contribute please see the [contribution guidelines](https://github.com/lucide-icons/lucide/blob/main/CONTRIBUTING.md).

View File

@@ -136,7 +136,7 @@ In `Method 2`: import all icons in `app.module.ts` by:
```js
import { icons } from 'lucide-angular/icons';
import { icons } from 'lucide-angular';
LucideAngularModule.pick(icons)

View File

@@ -9,8 +9,8 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M9 12h0" />
<path d="M15 12h0" />
<path d="M9 12h0.01" />
<path d="M15 12h0.01" />
<path d="M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5" />
<path d="M19 6.3a9 9 0 0 1 1.8 3.9 2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1" />
</svg>

Before

Width:  |  Height:  |  Size: 463 B

After

Width:  |  Height:  |  Size: 469 B

View File

@@ -0,0 +1,16 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" />
<path d="M10 19v-3.96 3.15" />
<path d="M7 19h5" />
<rect x="16" y="12" width="6" height="10" rx="2" />
</svg>

After

Width:  |  Height:  |  Size: 389 B

15
icons/pilcrow.svg Normal file
View File

@@ -0,0 +1,15 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M13 4v16" />
<path d="M17 4v16" />
<path d="M19 4H9.5a4.5 4.5 0 0 0 0 9H13" />
</svg>

After

Width:  |  Height:  |  Size: 302 B

View File

@@ -13,48 +13,48 @@
"lucide-svelte": "pnpm --filter lucide-svelte",
"lucide-static": "pnpm --filter lucide-static",
"build:icons": "node ./scripts/buildIcons.mjs --templateSrc ./packages/lucide/scripts/exportTemplate.mjs",
"build:outline-icons": "node ./scripts/outlineSvg.mjs",
"build:outline-icons": "pnpm --filter outline-svg start",
"generate:supersprite": "node ./scripts/generateSuperSVG.mjs",
"optimize": "node ./scripts/optimizeSvgs.mjs",
"addtags": "node ./scripts/addMissingKeysToTags.mjs",
"generate:changelog": "node ./scripts/generateChangelog.mjs",
"postinstall": "husky install"
"postinstall": "husky install",
"lint": "eslint --ext .ts,.js,.mjs ./{packages/lucide,scripts}"
},
"devDependencies": {
"@atomico/rollup-plugin-sizes": "^1.1.4",
"@babel/cli": "^7.18.9",
"@babel/core": "^7.18.9",
"@babel/node": "^7.18.9",
"@babel/plugin-transform-runtime": "^7.18.9",
"@babel/preset-env": "^7.18.9",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@rollup/plugin-replace": "^2.4.2",
"babel-jest": "^26.6.3",
"@babel/cli": "^7.19.3",
"@babel/core": "^7.19.6",
"@babel/node": "^7.20.0",
"@babel/plugin-transform-runtime": "^7.19.6",
"@babel/preset-env": "^7.19.4",
"@rollup/plugin-babel": "^6.0.2",
"@rollup/plugin-commonjs": "^23.0.2",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.1",
"@rollup/plugin-typescript": "^9.0.2",
"babel-jest": "^29.2.2",
"babel-plugin-add-import-extension": "^1.6.0",
"core-js": "^3.24.0",
"esbuild": "^0.14.51",
"eslint": "^4.19.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-config-prettier": "^2.10.0",
"core-js": "^3.26.0",
"esbuild": "^0.15.12",
"eslint": "^8.26.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^2.7.0",
"husky": "^8.0.0",
"jest": "^28.1.3",
"lint-staged": "^10.5.4",
"minimist": "^1.2.6",
"node-fetch": "^2.6.7",
"prettier": "1.17.1",
"rollup": "^2.77.2",
"rollup-plugin-license": "^2.8.1",
"rollup-plugin-svelte": "^7.1.0",
"rollup-plugin-terser": "^5.3.1",
"rollup-plugin-visualizer": "^4.2.2",
"@rollup/plugin-typescript": "^8.3.4",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.1",
"jest": "^29.2.2",
"lint-staged": "^13.0.3",
"minimist": "^1.2.7",
"node-fetch": "^3.2.10",
"prettier": "2.7.1",
"rollup": "^3.2.4",
"rollup-plugin-license": "^3.0.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-visualizer": "^5.8.3",
"svg-outline-stroke": "^1.3.1",
"svgo": "^2.8.0",
"svgson": "^4.1.0"
"svgo": "^3.0.0",
"svgson": "^5.2.1"
},
"husky": {
"hooks": {

View File

@@ -138,7 +138,7 @@ In `Method 2`: import all icons in `app.module.ts` by:
```js
...
import { icons } from 'lucide-angular/icons';
import { icons } from 'lucide-angular';
....
LucideAngularModule.pick(icons)
....

View File

@@ -1,7 +1,7 @@
{
"name": "lucide-angular",
"description": "A Lucide icon library package for Angular applications",
"version": "0.93.0",
"version": "0.100.0",
"author": "SMAH1",
"license": "ISC",
"homepage": "https://lucide.dev",
@@ -11,6 +11,9 @@
"url": "https://github.com/lucide-icons/lucide.git",
"directory": "packages/lucide-angular"
},
"publishConfig": {
"directory": "dist"
},
"keywords": [
"Lucide",
"Angular",

View File

@@ -1,6 +1,6 @@
name: lucide_icons
description: A Lucide icon library package for Flutter applications. Fork of Feather Icons, open for anyone to contribute icons.
version: 0.93.0
version: 0.100.0
homepage: https://lucide.dev
repository: https://github.com/lucide-icons/lucide

View File

@@ -1,7 +1,7 @@
{
"name": "lucide-preact",
"description": "A Lucide icon library package for Preact applications",
"version": "0.93.0",
"version": "0.100.0",
"license": "ISC",
"homepage": "https://lucide.dev",
"bugs": "https://github.com/lucide-icons/lucide/issues",
@@ -28,7 +28,7 @@
"build:icons": "node ../../scripts/buildIcons.mjs --output=./src --templateSrc=./scripts/exportTemplate.mjs --renderUniqueKey",
"build:es": "babel src -d dist/esm",
"build:types": "node ./scripts/buildTypes.mjs",
"build:bundles": "rollup -c ./rollup.config.js",
"build:bundles": "rollup -c ./rollup.config.mjs",
"test": "jest",
"version": "pnpm version --git-tag-version=false"
},

View File

@@ -1,5 +1,5 @@
import plugins from '../../rollup.plugins';
import pkg from './package.json';
import plugins from '../../rollup.plugins.mjs';
import pkg from './package.json' assert { type: "json" };
const packageName = 'LucidePreact';
const outputFileName = 'lucide-preact';

View File

@@ -1,7 +1,7 @@
{
"name": "lucide-react-native",
"description": "A Lucide icon library package for React Native applications",
"version": "0.48.0-alpha.5",
"version": "0.100.0",
"license": "ISC",
"homepage": "https://lucide.dev",
"bugs": "https://github.com/lucide-icons/lucide/issues",
@@ -28,12 +28,12 @@
"clean": "rm -rf dist && rm -rf stats && rm -rf ./src/icons/*.js",
"build:icons": "node ../../scripts/buildIcons.mjs --output=./src --templateSrc=./scripts/exportTemplate.mjs --renderUniqueKey",
"build:types": "node ./scripts/buildTypes.mjs",
"build:bundles": "rollup -c ./rollup.config.js",
"build:bundles": "rollup -c ./rollup.config.mjs",
"test": "jest",
"version": "pnpm version --git-tag-version=false"
},
"devDependencies": {
"@testing-library/react": "^11.2.6",
"@testing-library/react": "^13.4.0",
"babel-preset-react-app": "^10.0.0",
"jest": "^26.6.3",
"prop-types": "^15.7.2",

View File

@@ -1,5 +1,5 @@
import plugins from '../../rollup.plugins';
import pkg from './package.json';
import plugins from '../../rollup.plugins.mjs';
import pkg from './package.json' assert { type: 'json' };
const packageName = 'LucideReact';
const outputFileName = 'lucide-react-native';

View File

@@ -1,7 +1,7 @@
{
"name": "lucide-react",
"description": "A Lucide icon library package for React applications",
"version": "0.93.0",
"version": "0.100.0",
"license": "ISC",
"homepage": "https://lucide.dev",
"bugs": "https://github.com/lucide-icons/lucide/issues",
@@ -28,7 +28,7 @@
"build:icons": "node ../../scripts/buildIcons.mjs --output=./src --templateSrc=./scripts/exportTemplate.mjs --renderUniqueKey",
"build:es": "babel src -d dist/esm",
"build:types": "node ./scripts/buildTypes.mjs",
"build:bundles": "rollup -c ./rollup.config.js",
"build:bundles": "rollup -c ./rollup.config.mjs",
"test": "jest",
"version": "pnpm version --git-tag-version=false"
},

View File

@@ -1,5 +1,5 @@
import plugins from '../../rollup.plugins';
import pkg from './package.json';
import plugins from '../../rollup.plugins.mjs';
import pkg from './package.json' assert { type: 'json' };
const packageName = 'LucideReact';
const outputFileName = 'lucide-react';

View File

@@ -28,7 +28,7 @@
"build:icons": "node ../../scripts/buildIcons.mjs --output=./src --templateSrc=./scripts/exportTemplate.mjs --renderUniqueKey",
"build:es": "babel src -d dist/esm",
"build:types": "node ./scripts/buildTypes.mjs",
"build:bundles": "rollup -c ./rollup.config.js",
"build:bundles": "rollup -c ./rollup.config.mjs",
"test:jest": "jest",
"test": "vitest",
"version": "pnpm version --git-tag-version=false"

View File

@@ -1,5 +1,5 @@
import plugins from '../../rollup.plugins';
import pkg from './package.json';
import plugins from '../../rollup.plugins.mjs';
import pkg from './package.json' assert { type: 'json' };
const packageName = 'LucideSolid';
const outputFileName = 'lucide-solid';

View File

@@ -11,7 +11,7 @@ describe('Using lucide icon components', () => {
it('should adjust the size, stroke color and stroke width', async () => {
const testId = 'grid-icon';
const { container, getByTestId } = render( () =>
const { container, getByTestId } = render(() =>
<Grid
data-testid={testId}
size={48}

View File

@@ -12,6 +12,7 @@ export default defineConfig({
setupFiles: './tests/setupVitest.js',
threads: false,
isolate: false,
watch: false,
},
resolve: {
conditions: ['development', 'browser'],

View File

@@ -1,7 +1,7 @@
{
"name": "lucide-svelte",
"description": "A Lucide icon library package for Svelte applications",
"version": "0.93.0",
"version": "0.100.0",
"license": "ISC",
"homepage": "https://lucide.dev",
"bugs": "https://github.com/lucide-icons/lucide/issues",
@@ -29,7 +29,7 @@
"build:icons": "node ../../scripts/buildIcons.mjs --output=./src --templateSrc=./scripts/exportTemplate.mjs --exportFileName=index.js --iconFileExtention=.svelte --pretty=false",
"build:es": "babel src -d dist/esm --copy-files",
"build:types": "node ./scripts/buildTypes.mjs",
"build:bundles": "rollup -c ./rollup.config.js",
"build:bundles": "rollup -c ./rollup.config.mjs",
"test": "jest",
"test:watch": "jest --watch",
"version": "pnpm version --git-tag-version=false"

View File

@@ -6,7 +6,7 @@ import { terser } from 'rollup-plugin-terser';
import license from 'rollup-plugin-license';
import resolve from '@rollup/plugin-node-resolve';
import commonJS from '@rollup/plugin-commonjs';
import pkg from './package.json';
import pkg from './package.json' assert { type: 'json' };
const packageName = 'LucideSvelte';
const outputFileName = 'lucide-svelte';

View File

@@ -1,6 +1,6 @@
{
"name": "lucide-vue-next",
"version": "0.93.0",
"version": "0.100.0",
"author": "Eric Fennis",
"description": "A Lucide icon library package for Vue 3 applications",
"license": "ISC",
@@ -30,7 +30,7 @@
"build:icons": "node ../../scripts/buildIcons.mjs --output=./src --templateSrc=./scripts/exportTemplate.mjs --renderUniqueKey",
"build:es": "babel src -d dist/esm",
"build:types": "node ./scripts/buildTypes.mjs",
"build:bundles": "rollup -c ./rollup.config.js",
"build:bundles": "rollup -c ./rollup.config.mjs",
"test": "jest",
"test:watch": "jest --watchAll",
"version": "pnpm version --git-tag-version=false"

View File

@@ -1,5 +1,5 @@
import plugins from '../../rollup.plugins';
import pkg from './package.json';
import plugins from '../../rollup.plugins.mjs';
import pkg from './package.json' assert { type: 'json' };
const packageName = 'LucideVueNext';
const outputFileName = 'lucide-vue-next';

View File

@@ -1,6 +1,6 @@
{
"name": "lucide-vue",
"version": "0.93.0",
"version": "0.100.0",
"author": "Eric Fennis",
"description": "A Lucide icon library package for Vue 2 applications",
"license": "ISC",
@@ -27,7 +27,7 @@
"clean": "rm -rf dist && rm -rf stats && rm -rf ./src/icons/*.js",
"build:icons": "node ../../scripts/buildIcons.mjs --output=./src --templateSrc=./scripts/exportTemplate.mjs",
"build:es": "babel src -d dist/esm",
"build:bundles": "rollup -c ./rollup.config.js",
"build:bundles": "rollup -c ./rollup.config.mjs",
"test": "jest",
"test:watch": "jest --watchAll",
"version": "pnpm version --git-tag-version=false"

View File

@@ -1,5 +1,5 @@
import plugins from '../../rollup.plugins';
import pkg from './package.json';
import plugins from '../../rollup.plugins.mjs';
import pkg from './package.json' assert { type: 'json' };
const packageName = 'LucideVue';
const outputFileName = 'lucide-vue';

View File

@@ -1,7 +1,7 @@
{
"name": "lucide",
"description": "A Lucide icon library package for web and javascript applications.",
"version": "0.93.0",
"version": "0.100.0",
"license": "ISC",
"homepage": "https://lucide.dev",
"bugs": "https://github.com/lucide-icons/lucide/issues",
@@ -28,7 +28,7 @@
"build:icons": "node ../../scripts/buildIcons.mjs --output=./src --templateSrc=./scripts/exportTemplate.mjs",
"build:es": "babel src -d dist/esm",
"build:types": "node ./scripts/buildTypes.mjs",
"build:bundles": "rollup -c rollup.config.js",
"build:bundles": "rollup -c rollup.config.mjs",
"test": "jest",
"version": "pnpm version --git-tag-version=false"
}

View File

@@ -1,5 +1,5 @@
import plugins from '../../rollup.plugins';
import pkg from './package.json';
import plugins from '../../rollup.plugins.mjs';
import pkg from './package.json' assert { type: 'json' };
const outputFileName = pkg.name;
const outputDir = 'dist';

View File

@@ -2,14 +2,13 @@ import path from 'path';
import {
readSvgDirectory,
resetFile,
appendFile,
writeFile,
toPascalCase,
getCurrentDirPath,
} from '../../../scripts/helpers.mjs';
const currentDir = getCurrentDirPath(import.meta.url)
const currentDir = getCurrentDirPath(import.meta.url);
const defaultAttributes = {
xmlns: 'http://www.w3.org/2000/svg',
@@ -77,7 +76,7 @@ writeFile(typeDefinitions, TYPES_FILE_NAME, TARGET_DIR);
const svgFiles = readSvgDirectory(ICONS_DIR);
svgFiles.forEach(svgFile => {
svgFiles.forEach((svgFile) => {
const nameSvg = path.basename(svgFile, '.svg');
const namePascal = toPascalCase(nameSvg);

View File

@@ -8,12 +8,12 @@
const createElement = (tag, attrs, children = []) => {
const element = document.createElementNS('http://www.w3.org/2000/svg', tag);
Object.keys(attrs).forEach(name => {
Object.keys(attrs).forEach((name) => {
element.setAttribute(name, attrs[name]);
});
if (children.length) {
children = children.forEach(child => {
children = children.forEach((child) => {
const childElement = createElement(...child);
element.appendChild(childElement);

View File

@@ -18,7 +18,7 @@ const createIcons = ({ icons = {}, nameAttr = 'icon-name', attrs = {} } = {}) =>
const elementsToReplace = document.querySelectorAll(`[${nameAttr}]`);
Array.from(elementsToReplace).forEach(element =>
Array.from(elementsToReplace).forEach((element) =>
replaceElement(element, { nameAttr, icons, attrs }),
);
};

View File

@@ -5,7 +5,7 @@ import createElement from './createElement';
* @param {HTMLElement} element
* @returns {Object}
*/
export const getAttrs = element =>
export const getAttrs = (element) =>
Array.from(element.attributes).reduce((attrs, attr) => {
attrs[attr.name] = attr.value;
return attrs;
@@ -16,7 +16,7 @@ export const getAttrs = element =>
* @param {Object} attrs
* @returns {Array}
*/
export const getClassNames = attrs => {
export const getClassNames = (attrs) => {
if (typeof attrs === 'string') return attrs;
if (!attrs || !attrs.class) return '';
if (attrs.class && typeof attrs.class === 'string') {
@@ -33,17 +33,17 @@ export const getClassNames = attrs => {
* @param {array} arrayOfClassnames
* @returns {string}
*/
export const combineClassNames = arrayOfClassnames => {
export const combineClassNames = (arrayOfClassnames) => {
const classNameArray = arrayOfClassnames.flatMap(getClassNames);
return classNameArray
.map(classItem => classItem.trim())
.map((classItem) => classItem.trim())
.filter(Boolean)
.filter((value, index, self) => self.indexOf(value) === index)
.join(' ');
};
const toPascalCase = string =>
const toPascalCase = (string) =>
string.replace(/(\w)(\w*)(_|-|\s*)/g, (g0, g1, g2) => g1.toUpperCase() + g2.toLowerCase());
/**

4679
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,4 @@
packages:
- 'packages/*'
- 'tools/*'
- 'site'

View File

@@ -1,8 +1,8 @@
/* eslint-disable import/no-extraneous-dependencies */
import babel from '@rollup/plugin-babel';
import { babel } from '@rollup/plugin-babel';
import bundleSize from '@atomico/rollup-plugin-sizes';
import { terser } from 'rollup-plugin-terser';
import visualizer from 'rollup-plugin-visualizer';
import { visualizer } from 'rollup-plugin-visualizer';
import license from 'rollup-plugin-license';
import replace from '@rollup/plugin-replace';
import resolve from '@rollup/plugin-node-resolve';

21
scripts/Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
## This Dockerfile is for building image for github actions
FROM debian:stable-slim
RUN apt-get update
RUN apt-get install zlib1g-dev fontforge git build-essential ruby-full -y
# sfnt2woff
RUN git clone https://github.com/bramstein/sfnt2woff-zopfli.git sfnt2woff-zopfli
WORKDIR /sfnt2woff-zopfli
RUN make
RUN cp sfnt2woff-zopfli /usr/local/bin/sfnt2woff
# WOFF2
WORKDIR /
RUN git clone --recursive https://github.com/google/woff2.git
WORKDIR /woff2
RUN make clean all
RUN mv woff2_compress /usr/local/bin/
RUN mv woff2_decompress /usr/local/bin/
RUN gem install fontcustom

View File

@@ -2,17 +2,17 @@ import path from 'path';
import tags from '../tags.json' assert { type: 'json' };
import { readSvgDirectory, writeFile, getCurrentDirPath } from './helpers.mjs';
const currentDir = getCurrentDirPath(import.meta.url)
const currentDir = getCurrentDirPath(import.meta.url);
const ICONS_DIR = path.resolve(currentDir, '../icons');
console.log(`Read all tags`);
const svgFiles = readSvgDirectory(ICONS_DIR);
const iconNames = svgFiles.map(icon => icon.split('.')[0]);
const iconNames = svgFiles.map((icon) => icon.split('.')[0]);
const iconTags = iconNames
.map(iconName => ({
.map((iconName) => ({
name: iconName,
tags: tags[iconName] || [],
}))

View File

@@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import getArgumentOptions from 'minimist'; // eslint-disable-line import/no-extraneous-dependencies
import getArgumentOptions from 'minimist';
import renderIconsObject from './render/renderIconsObject.mjs';
import generateIconFiles from './building/generateIconFiles.mjs';
@@ -10,7 +10,7 @@ import { readSvgDirectory, getCurrentDirPath } from './helpers.mjs';
const cliArguments = getArgumentOptions(process.argv.slice(2));
const currentDir = getCurrentDirPath(import.meta.url)
const currentDir = getCurrentDirPath(import.meta.url);
const ICONS_DIR = path.resolve(currentDir, '../icons');
const OUTPUT_DIR = path.resolve(process.cwd(), cliArguments.output || '../build');
@@ -29,17 +29,15 @@ const {
} = cliArguments;
async function buildIcons() {
if (templateSrc == null) {
throw new Error('No `templateSrc` argument given.')
throw new Error('No `templateSrc` argument given.');
}
const svgFiles = readSvgDirectory(ICONS_DIR);
const icons = renderIconsObject(svgFiles, ICONS_DIR, renderUniqueKey);
const {default: iconFileTemplate} = await import(path.resolve(process.cwd(), templateSrc));
const { default: iconFileTemplate } = await import(path.resolve(process.cwd(), templateSrc));
// Generates iconsNodes files for each icon
generateIconFiles({
@@ -61,7 +59,7 @@ async function buildIcons() {
}
try {
buildIcons()
buildIcons();
} catch (error) {
console.error(error)
console.error(error);
}

View File

@@ -2,7 +2,7 @@ import path from 'path';
import { toPascalCase, resetFile, appendFile } from '../helpers.mjs';
export default function(inputEntry, outputDirectory, iconNodes, iconFileExtention = '') {
export default (inputEntry, outputDirectory, iconNodes, iconFileExtention = '') => {
const fileName = path.basename(inputEntry);
// Reset file
@@ -14,7 +14,7 @@ export default function(inputEntry, outputDirectory, iconNodes, iconFileExtentio
iconFileExtention === '.ts' || iconFileExtention === '.js' ? '' : iconFileExtention;
// Generate Import for Icon VNodes
icons.forEach(iconName => {
icons.forEach((iconName) => {
const componentName = toPascalCase(iconName);
const importString = `export { default as ${componentName} } from './${iconName}${fileExtention}';\n`;
appendFile(importString, fileName, outputDirectory);
@@ -23,4 +23,4 @@ export default function(inputEntry, outputDirectory, iconNodes, iconFileExtentio
appendFile('\n', fileName, outputDirectory);
console.log(`Successfully generated ${fileName} file`);
}
};

View File

@@ -1,17 +1,16 @@
/* eslint-disable import/no-extraneous-dependencies */
import fs from 'fs';
import path from 'path';
import prettier from 'prettier';
import { toPascalCase } from '../helpers.mjs';
export default function({
export default ({
iconNodes,
outputDirectory,
template,
showLog = true,
iconFileExtention = '.js',
pretty = true,
}) {
}) => {
const icons = Object.keys(iconNodes);
const iconsDistDirectory = path.join(outputDirectory, `icons`);
@@ -19,7 +18,7 @@ export default function({
fs.mkdirSync(iconsDistDirectory);
}
const writeIconFiles = icons.map(async iconName => {
const writeIconFiles = icons.map(async (iconName) => {
const location = path.join(iconsDistDirectory, `${iconName}${iconFileExtention}`);
const componentName = toPascalCase(iconName);
@@ -44,7 +43,7 @@ export default function({
console.log('Successfully built', icons.length, 'icons.');
}
})
.catch(error => {
.catch((error) => {
throw new Error(`Something went wrong generating icon files,\n ${error}`);
});
}
};

View File

@@ -1,7 +1,7 @@
import getArgumentOptions from 'minimist'; // eslint-disable-line import/no-extraneous-dependencies
import getArgumentOptions from 'minimist';
import githubApi from './githubApi.mjs';
const fetchCompareTags = oldTag =>
const fetchCompareTags = (oldTag) =>
githubApi(`https://api.github.com/repos/lucide-icons/lucide/compare/${oldTag}...main`);
const iconRegex = /icons\/(.*)\.svg/g;
@@ -27,7 +27,7 @@ const topics = [
},
];
const fetchCommits = async file => {
const fetchCommits = async (file) => {
const commits = await githubApi(
`https://api.github.com/repos/lucide-icons/lucide/commits?path=${file.filename}`,
);
@@ -38,12 +38,12 @@ const fetchCommits = async file => {
const cliArguments = getArgumentOptions(process.argv.slice(2));
// eslint-disable-next-line func-names
(async function() {
(async function () {
try {
const output = await fetchCompareTags(cliArguments['old-tag']);
if (output?.files == null) {
throw new Error('Tag not found!')
throw new Error('Tag not found!');
}
const changedFiles = output.files.filter(
@@ -95,7 +95,7 @@ const cliArguments = getArgumentOptions(process.argv.slice(2));
} catch (error) {
throw new Error(error);
}
})().catch(error => {
})().catch((error) => {
console.error(error);
process.exit(1);
});

View File

@@ -1,19 +1,17 @@
/* eslint-disable import/no-extraneous-dependencies */
import path from 'path';
import { stringify, parseSync } from 'svgson';
import prettier from 'prettier';
import { appendFile, readSvgDirectory, getCurrentDirPath } from './helpers.mjs';
/* eslint-disable import/no-extraneous-dependencies */
import readSvgs from '../packages/lucide-static/scripts/readSvgs.mjs';
const currentDir = getCurrentDirPath(import.meta.url)
const currentDir = getCurrentDirPath(import.meta.url);
const ICONS_DIR = path.resolve('icons');
const PACKAGE_DIR = path.resolve(currentDir);
export default function generateSprite(svgs, packageDir) {
const symbols = svgs.map(({ name, parsedSvg }, index) => {
const symbols = svgs.map(({ parsedSvg }, index) => {
const itemsPerRow = 10;
const numInRow = index % itemsPerRow;
const column = numInRow + 1;

View File

@@ -1,7 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import fetch, { Headers } from 'node-fetch';
const githubApi = async endpoint => {
const githubApi = async (endpoint) => {
const headers = new Headers();
const username = 'ericfennis';
const password = process.env.GITHUB_API_KEY;

View File

@@ -8,7 +8,7 @@ import { fileURLToPath } from 'url';
* @param {string} string
* @returns {string} A camelized string
*/
export const toCamelCase = string =>
export const toCamelCase = (string) =>
string.replace(/^([A-Z])|[\s-_]+(\w)/g, (match, p1, p2) =>
p2 ? p2.toUpperCase() : p1.toLowerCase(),
);
@@ -19,7 +19,7 @@ export const toCamelCase = string =>
* @param {string} string
* @returns {string} A pascalized string
*/
export const toPascalCase = string => {
export const toPascalCase = (string) => {
const camelCase = toCamelCase(string);
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
@@ -31,7 +31,7 @@ export const toPascalCase = string => {
* @param {string} string
* @returns {string} A kebabized string
*/
export const toKebabCase = string => string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
export const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
/**
* Resets the file contents.
@@ -48,7 +48,7 @@ export const resetFile = (fileName, outputDirectory) =>
* @param {string} path
* @returns {string} The contents of a file
*/
export const readFile = entry => fs.readFileSync(path.resolve(__dirname, '../', entry), 'utf-8');
export const readFile = (entry) => fs.readFileSync(path.resolve(__dirname, '../', entry), 'utf-8');
/**
* append content to a file
@@ -76,8 +76,8 @@ export const writeFile = (content, fileName, outputDirectory) =>
* @param {string} directory
* @returns {array} An array of file paths containig svgs
*/
export const readSvgDirectory = directory =>
fs.readdirSync(directory).filter(file => path.extname(file) === '.svg');
export const readSvgDirectory = (directory) =>
fs.readdirSync(directory).filter((file) => path.extname(file) === '.svg');
/**
* Read svg from directory
@@ -133,12 +133,12 @@ export const generateHashedKey = ({ name, attributes }) => hash(JSON.stringify([
* @param {array} children an array of items
* @returns {Boolean} if items contains duplicated items.
*/
export const hasDuplicatedChildren = children => {
export const hasDuplicatedChildren = (children) => {
const hashedKeys = children.map(generateHashedKey);
return !hashedKeys.every(
(key, index) => index === hashedKeys.findIndex(childKey => childKey === key),
(key, index) => index === hashedKeys.findIndex((childKey) => childKey === key),
);
};
export const getCurrentDirPath = currentPath => path.dirname(fileURLToPath(currentPath));
export const getCurrentDirPath = (currentPath) => path.dirname(fileURLToPath(currentPath));

View File

@@ -3,7 +3,7 @@ import processSvg from './render/processSvg.mjs';
const svgFiles = process.argv.slice(4);
svgFiles.forEach(async svgFile => {
svgFiles.forEach(async (svgFile) => {
const content = fs.readFileSync(svgFile);
const svg = await processSvg(content);
fs.writeFileSync(svgFile, svg, 'utf-8');

View File

@@ -9,7 +9,7 @@ console.log(`Optimizing SVGs...`);
const svgFiles = readSvgDirectory(ICONS_DIR);
svgFiles.forEach(svgFile => {
svgFiles.forEach((svgFile) => {
const content = fs.readFileSync(path.join(ICONS_DIR, svgFile));
processSvg(content).then(svg => writeSvgFile(svgFile, ICONS_DIR, svg));
processSvg(content).then((svg) => writeSvgFile(svgFile, ICONS_DIR, svg));
});

View File

@@ -1,4 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */
import { optimize } from 'svgo';
import prettier from 'prettier';
import { parseSync, stringify } from 'svgson';
@@ -52,10 +51,12 @@ function processSvg(svg) {
return (
optimizeSvg(svg)
.then(setAttrs)
.then(optimizedSvg => prettier.format(optimizedSvg, { parser: 'babel' }))
.then((optimizedSvg) =>
prettier.format(optimizedSvg, { parser: 'babel' }),
)
// remove semicolon inserted by prettier
// because prettier thinks it's formatting JSX not HTML
.then(svg => svg.replace(/;/g, ''))
.then((svg) => svg.replace(/;/g, ''))
);
}

View File

@@ -1,4 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */
import { basename } from 'path';
import { parseSync } from 'svgson';
import { generateHashedKey, readSvg, hasDuplicatedChildren } from '../helpers.mjs';
@@ -11,7 +10,7 @@ import { generateHashedKey, readSvg, hasDuplicatedChildren } from '../helpers.mj
*/
export default (svgFiles, iconsDirectory, renderUniqueKey = false) =>
svgFiles
.map(svgFile => {
.map((svgFile) => {
const name = basename(svgFile, '.svg');
const svg = readSvg(svgFile, iconsDirectory);
const contents = parseSync(svg);
@@ -25,7 +24,7 @@ export default (svgFiles, iconsDirectory, renderUniqueKey = false) =>
}
if (renderUniqueKey) {
contents.children = contents.children.map(child => {
contents.children = contents.children.map((child) => {
child.attributes.key = generateHashedKey(child);
return child;

29892
scripts/super-sprite.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 807 KiB

View File

@@ -27,7 +27,7 @@
"js-yaml": "^4.1.0",
"jszip": "^3.7.0",
"lodash": "^4.17.20",
"lucide-react": "0.14.0",
"lucide-react": "^0.94.0",
"next": "12",
"next-mdx-remote": "^3.0.2",
"prism-react-renderer": "^1.2.1",

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<svg width="30" height="30" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="400" height="400" fill="#F6F7FF"/>
<path d="M222.131 112.458L237.41 66.8783H290.403L275.043 112.458H222.131Z" fill="#14FFAF"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M158.026 174.716C172.966 162.84 191.165 155.37 211.659 155.37C253.609 155.37 294.409 182.196 294.409 250.953V336H240.776V250.953C240.776 215.516 223.929 202.107 200.933 202.107C181.969 202.107 168.181 213.026 160.516 224.517V336H106.692V115.336H74L91.2077 64H158.026V174.716ZM272.988 109.567L286.407 69.7565H239.485L226.132 109.567H272.988ZM235.338 64H294.409L277.112 115.336H218.13L235.338 64Z" fill="#0A23B9"/>
</svg>

After

Width:  |  Height:  |  Size: 752 B

View File

@@ -4,10 +4,37 @@
"description": "Implementation of Lucide icon's using blade-icons for Laravel based projects.",
"icon": "/framework-logos/laravel.svg",
"shields": [
{ "alt": "Latest Stable Version", "src": "https://img.shields.io/packagist/v/mallardduck/blade-lucide-icons", "href": "https://packagist.org/packages/mallardduck/blade-lucide-icons" },
{ "alt": "Total Downloads", "src": "https://img.shields.io/packagist/dt/mallardduck/blade-lucide-icons", "href": "https://packagist.org/packages/mallardduck/blade-lucide-icons" }
{
"alt": "Latest Stable Version",
"src": "https://img.shields.io/packagist/v/mallardduck/blade-lucide-icons",
"href": "https://packagist.org/packages/mallardduck/blade-lucide-icons"
},
{
"alt": "Total Downloads",
"src": "https://img.shields.io/packagist/dt/mallardduck/blade-lucide-icons",
"href": "https://packagist.org/packages/mallardduck/blade-lucide-icons"
}
],
"source": "https://github.com/mallardduck/blade-lucide-icons",
"documentation": "https://github.com/mallardduck/blade-lucide-icons/blob/main/README.md"
},
{
"name": "hyva-lucide-icons",
"description": "Implementation of Lucide icon's using Hyvä's svg php viewmodal to render icons for Magento 2 Hyva theme based projects.",
"icon": "/framework-logos/hyva.svg",
"shields": [
{
"alt": "Latest Stable Version",
"src": "https://img.shields.io/packagist/v/siteation/magento2-hyva-icons-lucide",
"href": "https://packagist.org/packages/siteation/magento2-hyva-icons-lucide"
},
{
"alt": "Total Downloads",
"src": "https://img.shields.io/packagist/dt/siteation/magento2-hyva-icons-lucide",
"href": "https://packagist.org/packages/siteation/magento2-hyva-icons-lucide"
}
],
"source": "https://github.com/siteation/magento2-hyva-icons-lucide",
"documentation": "https://github.com/siteation/magento2-hyva-icons-lucide/blob/main/README.md"
}
]

View File

@@ -1455,6 +1455,7 @@
"food",
"breakfast"
],
"egg-off": [],
"equal": [
"calculate",
"maths"
@@ -1758,14 +1759,12 @@
"file-type": [
"font",
"text",
"font",
"typography",
"type"
],
"file-type-2": [
"font",
"text",
"font",
"typography",
"type"
],
@@ -2083,11 +2082,6 @@
"automation",
"maths"
],
"joystick": [
"game",
"console",
"control stick"
],
"gamepad": [
"console"
],
@@ -2145,16 +2139,16 @@
"code",
"version control"
],
"git-pull-request-draft": [
"code",
"version control",
"draft"
],
"git-pull-request-closed": [
"code",
"version control",
"rejected"
],
"git-pull-request-draft": [
"code",
"version control",
"draft"
],
"github": [
"logo",
"version control"
@@ -2249,6 +2243,13 @@
"mist",
"fog"
],
"heading": [],
"heading-1": [],
"heading-2": [],
"heading-3": [],
"heading-4": [],
"heading-5": [],
"heading-6": [],
"headphones": [
"music",
"audio",
@@ -2828,12 +2829,6 @@
"podcast",
"microphone"
],
"mic-off": [
"record",
"sound",
"mute",
"microphone"
],
"mic-2": [
"lyrics",
"voice",
@@ -2846,6 +2841,12 @@
"singing",
"microphone"
],
"mic-off": [
"record",
"sound",
"mute",
"microphone"
],
"microscope": [
"medical",
"education",
@@ -2916,6 +2917,16 @@
"monitor-off": [
"share"
],
"monitor-smartphone": [
"smartphone",
"phone",
"cellphone",
"device",
"mobile",
"desktop",
"monitor",
"responsive"
],
"monitor-speaker": [
"devices",
"connect",
@@ -3203,6 +3214,15 @@
"money",
"savings"
],
"pilcrow": [
"paragraph",
"mark",
"paraph",
"blind",
"typography",
"type",
"text"
],
"pin": [
"save",
"map",
@@ -3237,6 +3257,8 @@
"music",
"start"
],
"plug": [],
"plug-2": [],
"plug-zap": [
"charge",
"charging",
@@ -3785,6 +3807,7 @@
"audio",
"music"
],
"spline": [],
"sprout": [
"leaf",
"nature",
@@ -3816,6 +3839,13 @@
"remove",
"unrate"
],
"stethoscope": [
"phonendoscope",
"medical",
"heart",
"lungs",
"sound"
],
"sticker": [
"reaction",
"emotion",
@@ -3829,13 +3859,6 @@
"reaction",
"memo"
],
"stethoscope": [
"phonendoscope",
"medical",
"heart",
"lungs",
"sound"
],
"stop-circle": [
"media",
"music"

View File

@@ -1,19 +1,13 @@
import { promises as fs } from 'fs';
import outlineStroke from 'svg-outline-stroke';
import { parse, stringify } from 'svgson'; // eslint-disable-line import/no-extraneous-dependencies
import { parse, stringify } from 'svgson';
import getArgumentOptions from 'minimist';
import path from 'path';
const inputDir = `./icons/`;
const inputDir = path.join(process.cwd(), '../../icons');
const cliArguments = getArgumentOptions(process.argv.slice(2));
const { outputDir } = cliArguments;
const widthMap = {
'converted_icons-200': '1',
'converted_icons-300': '1.5',
converted_icons: '2',
'converted_icons-500': '2.5',
'converted_icons-600': '3',
};
const { outputDir = 'outlined' } = cliArguments;
const targetDir = path.join(process.cwd(), '../../', outputDir);
function transformForward(node) {
if (node.name === 'svg') {
@@ -43,12 +37,15 @@ function transformBackwards(node) {
async function init() {
console.time('icon outliner');
try {
await fs.mkdir(`./${outputDir}`);
try {
await fs.mkdir(targetDir);
} catch (error) {} // eslint-disable-line no-empty
const icons = await fs.readdir(inputDir);
const parsedIconNodes = await Promise.all(
icons.map(async file => {
const iconContent = await fs.readFile(`${inputDir}${file}`);
icons.map(async (file) => {
const inputFilePath = path.resolve(process.cwd(), inputDir, file);
const iconContent = await fs.readFile(inputFilePath);
const iconNode = await parse(iconContent.toString(), {
transformNode: transformForward,
});
@@ -56,19 +53,15 @@ async function init() {
}),
);
if (widthMap?.[outputDir] === undefined) {
throw new Error(`Could not find the directory: ${outputDir}.`)
}
await Promise.all(
parsedIconNodes.map(async ([file, iconNode]) => {
iconNode.attributes['stroke-width'] = widthMap[outputDir];
const outlined = await outlineStroke(stringify(iconNode));
const outlinedWithoutAttrs = await parse(outlined, {
transformNode: transformBackwards,
});
await fs.writeFile(`./${outputDir}/${file}`, stringify(outlinedWithoutAttrs));
const filePath = path.join(targetDir, file);
await fs.writeFile(filePath, stringify(outlinedWithoutAttrs));
}),
);

View File

@@ -0,0 +1,17 @@
{
"name": "outline-svg",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node ./main.mjs"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"minimist": "^1.2.6",
"svg-outline-stroke": "^1.3.1",
"svgson": "^5.2.1"
}
}