mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-16 07:37:42 +01:00
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)
This commit is contained in:
@@ -3,3 +3,4 @@ build
|
||||
coverage
|
||||
lib
|
||||
tests
|
||||
node_modules
|
||||
|
||||
22
.eslintrc.js
22
.eslintrc.js
@@ -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,
|
||||
},
|
||||
};
|
||||
|
||||
61
package.json
61
package.json
@@ -18,43 +18,44 @@
|
||||
"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",
|
||||
"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",
|
||||
"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-svelte": "^7.1.0",
|
||||
"rollup-plugin-terser": "^5.3.1",
|
||||
"rollup-plugin-visualizer": "^4.2.2",
|
||||
"@rollup/plugin-typescript": "^8.3.4",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"rollup-plugin-visualizer": "^5.8.3",
|
||||
"@rollup/plugin-typescript": "^9.0.2",
|
||||
"svg-outline-stroke": "^1.3.1",
|
||||
"svgo": "^2.8.0",
|
||||
"svgson": "^4.1.0"
|
||||
"svgo": "^3.0.0",
|
||||
"svgson": "^5.2.1"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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';
|
||||
@@ -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",
|
||||
|
||||
@@ -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';
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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';
|
||||
@@ -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"
|
||||
|
||||
@@ -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';
|
||||
@@ -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}
|
||||
|
||||
@@ -12,6 +12,7 @@ export default defineConfig({
|
||||
setupFiles: './tests/setupVitest.js',
|
||||
threads: false,
|
||||
isolate: false,
|
||||
watch: false,
|
||||
},
|
||||
resolve: {
|
||||
conditions: ['development', 'browser'],
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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';
|
||||
@@ -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"
|
||||
|
||||
@@ -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';
|
||||
@@ -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"
|
||||
|
||||
@@ -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';
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 }),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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());
|
||||
|
||||
/**
|
||||
|
||||
6529
pnpm-lock.yaml
generated
6529
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -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';
|
||||
@@ -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] || [],
|
||||
}))
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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}`);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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));
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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';
|
||||
|
||||
const inputDir = `./icons/`;
|
||||
@@ -47,7 +47,7 @@ async function init() {
|
||||
|
||||
const icons = await fs.readdir(inputDir);
|
||||
const parsedIconNodes = await Promise.all(
|
||||
icons.map(async file => {
|
||||
icons.map(async (file) => {
|
||||
const iconContent = await fs.readFile(`${inputDir}${file}`);
|
||||
const iconNode = await parse(iconContent.toString(), {
|
||||
transformNode: transformForward,
|
||||
@@ -57,7 +57,7 @@ async function init() {
|
||||
);
|
||||
|
||||
if (widthMap?.[outputDir] === undefined) {
|
||||
throw new Error(`Could not find the directory: ${outputDir}.`)
|
||||
throw new Error(`Could not find the directory: ${outputDir}.`);
|
||||
}
|
||||
|
||||
await Promise.all(
|
||||
|
||||
@@ -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, ''))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
29892
scripts/super-sprite.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 807 KiB |
51
tags.json
51
tags.json
@@ -2083,11 +2083,6 @@
|
||||
"automation",
|
||||
"maths"
|
||||
],
|
||||
"joystick": [
|
||||
"game",
|
||||
"console",
|
||||
"control stick"
|
||||
],
|
||||
"gamepad": [
|
||||
"console"
|
||||
],
|
||||
@@ -2145,16 +2140,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 +2244,13 @@
|
||||
"mist",
|
||||
"fog"
|
||||
],
|
||||
"heading": [],
|
||||
"heading-1": [],
|
||||
"heading-2": [],
|
||||
"heading-3": [],
|
||||
"heading-4": [],
|
||||
"heading-5": [],
|
||||
"heading-6": [],
|
||||
"headphones": [
|
||||
"music",
|
||||
"audio",
|
||||
@@ -2828,12 +2830,6 @@
|
||||
"podcast",
|
||||
"microphone"
|
||||
],
|
||||
"mic-off": [
|
||||
"record",
|
||||
"sound",
|
||||
"mute",
|
||||
"microphone"
|
||||
],
|
||||
"mic-2": [
|
||||
"lyrics",
|
||||
"voice",
|
||||
@@ -2846,6 +2842,12 @@
|
||||
"singing",
|
||||
"microphone"
|
||||
],
|
||||
"mic-off": [
|
||||
"record",
|
||||
"sound",
|
||||
"mute",
|
||||
"microphone"
|
||||
],
|
||||
"microscope": [
|
||||
"medical",
|
||||
"education",
|
||||
@@ -3237,6 +3239,8 @@
|
||||
"music",
|
||||
"start"
|
||||
],
|
||||
"plug": [],
|
||||
"plug-2": [],
|
||||
"plug-zap": [
|
||||
"charge",
|
||||
"charging",
|
||||
@@ -3785,6 +3789,7 @@
|
||||
"audio",
|
||||
"music"
|
||||
],
|
||||
"spline": [],
|
||||
"sprout": [
|
||||
"leaf",
|
||||
"nature",
|
||||
@@ -3816,6 +3821,13 @@
|
||||
"remove",
|
||||
"unrate"
|
||||
],
|
||||
"stethoscope": [
|
||||
"phonendoscope",
|
||||
"medical",
|
||||
"heart",
|
||||
"lungs",
|
||||
"sound"
|
||||
],
|
||||
"sticker": [
|
||||
"reaction",
|
||||
"emotion",
|
||||
@@ -3829,13 +3841,6 @@
|
||||
"reaction",
|
||||
"memo"
|
||||
],
|
||||
"stethoscope": [
|
||||
"phonendoscope",
|
||||
"medical",
|
||||
"heart",
|
||||
"lungs",
|
||||
"sound"
|
||||
],
|
||||
"stop-circle": [
|
||||
"media",
|
||||
"music"
|
||||
|
||||
Reference in New Issue
Block a user