mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-16 10:57:42 +01:00
* New setup for new NPM package * Add build scripts for dist * Add introduction readme * Refactor names * update package.json * remove log * rename variable * Factoring * Improve optimize script * Add eslint config * Eslint fixes * rename import * Move packeges * Setup rollup and build progress * Refactor scripts * fix lint error * remove lint disabler * Bring back old libraries * add indentation * reset packages directory * remove vscode setting files * 0.1.0-alpha.0 * new version * 0.1.0-alpha.1 * Fix build process * Add create element to the entry file * update version number * publish new alhpa version * fixing bugs * Add jest and tests * replace with XML createElement * set new version * Fix svg generation * Add tests for main library * Update docs * Adjust tests and selectors * update the spec * Update README.md * Update README.md * Update README.md * update version * Update README.md * Move function to helpers file * rename license, package and readme * Fix build files * rename packages Co-authored-by: Eric Fennis <eric.fennis@endurance.com>
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
import fs from 'fs';
|
|
import path from 'path';
|
|
|
|
import renderIconsObject from './render/renderIconsObject';
|
|
import renderIconNodes from './render/renderIconNodes';
|
|
import generateIconFiles from './build/generateIconFiles';
|
|
import generateExportsFile from './build/generateExportsFile';
|
|
|
|
import { readSvgDirectory } from './helpers';
|
|
|
|
const ICONS_DIR = path.resolve(__dirname, '../icons');
|
|
const OUTPUT_DIR = path.resolve(__dirname, '../build');
|
|
const SRC_DIR = path.resolve(__dirname, '../src');
|
|
|
|
if (!fs.existsSync(OUTPUT_DIR)) {
|
|
fs.mkdirSync(OUTPUT_DIR);
|
|
}
|
|
|
|
const svgFiles = readSvgDirectory(ICONS_DIR);
|
|
|
|
const icons = renderIconsObject(svgFiles, ICONS_DIR);
|
|
|
|
const iconVNodes = renderIconNodes(icons);
|
|
|
|
// Generates iconsNodes files for each icon
|
|
generateIconFiles(
|
|
iconVNodes,
|
|
OUTPUT_DIR,
|
|
({ componentName, node }) => `
|
|
const ${componentName} = ${node};
|
|
|
|
export default ${componentName};
|
|
`,
|
|
);
|
|
|
|
// Generates entry files for the compiler filled with icons exports
|
|
generateExportsFile(
|
|
path.join(SRC_DIR, 'icons/index.js'),
|
|
path.join(OUTPUT_DIR, 'icons'),
|
|
'getElement',
|
|
iconVNodes,
|
|
);
|