318c024589
* add pnpm * make it work * fix comamnds in package.jsons * move some scripts to modules * workflow fixes * test workflow * test #2 * minor fix * update lockflite * create workflows * update workflow * Add copy license command * Fix build * update workflows * update contributions.md * migrate site directory to pnpm * Fix peer dependencies when install * fix types in lucide-angular * fix testing
27 lines
842 B
JavaScript
27 lines
842 B
JavaScript
import path from 'path';
|
|
|
|
import { toPascalCase, resetFile, appendFile } from '../helpers.mjs';
|
|
|
|
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`);
|
|
}
|