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>
29 lines
771 B
TypeScript
29 lines
771 B
TypeScript
import { writeFile } from 'fs/promises';
|
|
import { existsSync, unlinkSync, mkdirSync } from 'fs';
|
|
import { type SVGFile } from './readSvgs.mts';
|
|
|
|
export default async function copyIcons(
|
|
parsedSvgs: SVGFile[],
|
|
packageDir: string,
|
|
license: string,
|
|
) {
|
|
const iconsDirectory = `${packageDir}/icons`;
|
|
|
|
if (existsSync(iconsDirectory)) {
|
|
unlinkSync(iconsDirectory);
|
|
}
|
|
|
|
if (!existsSync(iconsDirectory)) {
|
|
mkdirSync(iconsDirectory);
|
|
}
|
|
|
|
const writeIconPromises = parsedSvgs.map(({ name, contents }) => {
|
|
let content = `<!-- ${license} -->\n${contents}`;
|
|
content = content.replace('<svg', `<svg\n class="lucide lucide-${name}"`);
|
|
|
|
return writeFile(`${iconsDirectory}/${name}.svg`, content);
|
|
});
|
|
|
|
await Promise.all(writeIconPromises);
|
|
}
|