Files
lucide/scripts/build/generateExportsFile.js
Eric Fennis f964dff64d Lucide Svelte Package! (#476)
* 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
2022-02-17 17:46:55 +01:00

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`);
}