mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-08-29 09:28:23 +02:00
* Add directory * Add lab check script * Delete duplicated icons * Fix the lab page * Adjust paths * update lockfile * update lockfile * fix(lab/planet): replace with guideline-compliant design * Add install step * Add second install step * Adjust lab in site * try this * Fix workflow * Add cspell * Format code * Temporary delete icons for copilot review * Place back lab icons * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Update lock file * Revert svg changes * Fix list * Rename filenames * Format tsconfig --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
/* eslint-disable import/no-extraneous-dependencies */
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import getArgumentOptions from 'minimist';
|
|
import { parseSync } from 'svgson';
|
|
|
|
import { readSvgDirectory, getCurrentDirPath } from '@lucide/helpers';
|
|
import readSvgs from './readSvgs.mjs';
|
|
import generateIconNodes from './generateIconNodes.mjs';
|
|
import copyIcons from './copyIcons.mjs';
|
|
|
|
import pkg from '../package.json' assert { type: 'json' };
|
|
|
|
const cliArguments = getArgumentOptions(process.argv.slice(2));
|
|
const createDirectory = (dir) => {
|
|
if (!fs.existsSync(dir)) {
|
|
fs.mkdirSync(dir);
|
|
}
|
|
};
|
|
|
|
const currentDir = getCurrentDirPath(import.meta.url);
|
|
|
|
const PACKAGE_DIR = path.resolve(currentDir, '../');
|
|
const ICONS_DIR = path.join(PACKAGE_DIR, '../../icons');
|
|
|
|
const license = `@license ${pkg.name} v${pkg.version} - ${pkg.license}`;
|
|
|
|
const svgFiles = await readSvgDirectory(ICONS_DIR);
|
|
const svgs = await readSvgs(svgFiles, ICONS_DIR);
|
|
|
|
const parsedSvgs = svgs.map(({ name, contents }) => ({
|
|
name,
|
|
contents,
|
|
parsedSvg: parseSync(contents),
|
|
}));
|
|
|
|
await Promise.all([
|
|
generateIconNodes(parsedSvgs, PACKAGE_DIR),
|
|
copyIcons(parsedSvgs, PACKAGE_DIR, license),
|
|
]);
|