mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-17 06:07:42 +01:00
* init svelte project * Add export script for lucide-svelte * make lucide-svelte wokring * make ready for first release * update lock file * bump version * some fixes in the build * Add tests * Finish tests * Update Readme * update lock file * Add svelte to gh actions * Add svetle to website docs * Add test ci script * adjust action * add on PR trigger * remove dep * fix tests * Add svelte entry in package.json * update snapshots
26 lines
833 B
JavaScript
26 lines
833 B
JavaScript
import path from 'path';
|
|
|
|
import { toPascalCase, resetFile, appendFile } from '../helpers';
|
|
|
|
export default function(inputEntry, outputDirectory, iconNodes, iconFileExtention = '') {
|
|
const fileName = path.basename(inputEntry);
|
|
|
|
// Reset file
|
|
resetFile(fileName, outputDirectory);
|
|
|
|
const icons = Object.keys(iconNodes);
|
|
|
|
const fileExtention = iconFileExtention === '.ts' || iconFileExtention === '.js' ? '' : iconFileExtention
|
|
|
|
// Generate Import for Icon VNodes
|
|
icons.forEach(iconName => {
|
|
const componentName = toPascalCase(iconName);
|
|
const importString = `export { default as ${componentName} } from './${iconName}${fileExtention}';\n`;
|
|
appendFile(importString, fileName, outputDirectory);
|
|
});
|
|
|
|
appendFile('\n', fileName, outputDirectory);
|
|
|
|
console.log(`Successfully generated ${fileName} file`);
|
|
}
|