mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-14 13:58:21 +00:00
* cleanup scripts * Move helpers to package * Fixes scripts * Fix scripts * Formatting * Fix helpers import paths * Remove lucide-figma * Rename helpers package * Fix build * formatting * Adjust main build-icons file * Add export casing * Adds `exportModuleNameCasing` fro lab project * format files * Bump package version @lucide/build-icons * Revert changes in icons * Revert changes in PR yml * Fix lint issues * Fix site build * fix lint errors * Attempt fix linting * Fix lint errors
37 lines
1014 B
JavaScript
37 lines
1014 B
JavaScript
import path from 'path';
|
|
|
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
import { toPascalCase, toCamelCase, resetFile, appendFile } from '@lucide/helpers';
|
|
|
|
export default (
|
|
inputEntry,
|
|
outputDirectory,
|
|
iconNodes,
|
|
exportModuleNameCasing,
|
|
iconFileExtension = '',
|
|
) => {
|
|
const fileName = path.basename(inputEntry);
|
|
|
|
// Reset file
|
|
resetFile(fileName, outputDirectory);
|
|
|
|
const icons = Object.keys(iconNodes);
|
|
|
|
// Generate Import for Icon VNodes
|
|
icons.forEach((iconName) => {
|
|
let componentName;
|
|
|
|
if (exportModuleNameCasing === 'camel') {
|
|
componentName = toCamelCase(iconName);
|
|
} else if (exportModuleNameCasing === 'pascal') {
|
|
componentName = toPascalCase(iconName);
|
|
}
|
|
const importString = `export { default as ${componentName} } from './${iconName}${iconFileExtension}';\n`;
|
|
appendFile(importString, fileName, outputDirectory);
|
|
});
|
|
|
|
appendFile('\n', fileName, outputDirectory);
|
|
|
|
console.log(`Successfully generated ${fileName} file`);
|
|
};
|