mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-08-29 09:28:23 +02:00
* chore: upgrade eslint to v9 latest with compatible lint deps Agent-Logs-Url: https://github.com/lucide-icons/lucide/sessions/f7c1f1b5-d213-4afa-91a8-b799a16397ec * Fix eslint config * Fix a lot of eslint errors * Fix eslint * Fix eslint errors * Fix eslint errors * Fix types * Fix eslint warning * Format code * Add eslint 10 * Remove unused vars * Update pnpm * Update deps --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import { promises as fs } from 'fs';
|
|
import SVGFixer from 'oslllo-svg-fixer';
|
|
import { type IconAliases } from '@lucide/helpers';
|
|
import path from 'path';
|
|
|
|
interface OutlineSVGOptions {
|
|
iconsDir: string;
|
|
outlinedDir: string;
|
|
iconsWithAliases: IconAliases;
|
|
}
|
|
|
|
export async function outlineSVG({ iconsDir, outlinedDir, iconsWithAliases }: OutlineSVGOptions) {
|
|
console.time('icon outliner');
|
|
try {
|
|
try {
|
|
await fs.mkdir(outlinedDir);
|
|
} catch (err) {
|
|
console.warn(`Directory ${outlinedDir} already exists. Skipping creation.`, err);
|
|
}
|
|
|
|
await SVGFixer(iconsDir, outlinedDir, {
|
|
showProgressBar: true,
|
|
traceResolution: 800,
|
|
}).fix();
|
|
|
|
console.log('Duplicate icons with aliases..');
|
|
|
|
await Promise.all(
|
|
iconsWithAliases.map(async ([iconName, aliases]) => {
|
|
const sourcePath = path.join(outlinedDir, `${iconName}.svg`);
|
|
|
|
await Promise.all(
|
|
aliases.map(async (aliasName) => {
|
|
const destinationPath = path.join(outlinedDir, `${aliasName}.svg`);
|
|
|
|
try {
|
|
await fs.copyFile(sourcePath, destinationPath);
|
|
console.log(`Copied ${iconName}.svg to ${aliasName}.svg`);
|
|
} catch (err) {
|
|
console.log(`Failed to copy ${sourcePath} to ${destinationPath}:`, err);
|
|
}
|
|
}),
|
|
);
|
|
}),
|
|
);
|
|
|
|
console.timeEnd('icon outliner');
|
|
} catch (err) {
|
|
console.log(err);
|
|
}
|
|
}
|