mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-16 15:17:41 +01:00
* 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)
27 lines
840 B
JavaScript
27 lines
840 B
JavaScript
import path from 'path';
|
|
|
|
import { toPascalCase, resetFile, appendFile } from '../helpers.mjs';
|
|
|
|
export default (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`);
|
|
};
|