Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable prefer-template */
const path = require('path');
const fs = require('fs');
const format = require('prettier-eslint');
const upperCamelCase = require('uppercamelcase');
const featherIcons = require('feather-icons/dist/icons.json');
const rootDir = path.join(__dirname, '..');
const icons = Object.keys(featherIcons);
const dir = path.join(rootDir, 'src/icons');
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
const initialTypeDefinitions = `///
import { ComponentType, SVGAttributes } from 'react';
interface Props extends SVGAttributes {
color?: string;
size?: string | number;
}
type Icon = ComponentType;
function exportIconNames() {
return Object.keys(ICONS).map(iconName => {
const constName = iconName.replace(/-/g, '_').toUpperCase();
return `export const ${constName} = '${iconName}';`
});
}
function exportIconContents() {
const contents = Object.keys(ICONS).map(iconName => `'${iconName}' : '${ICONS[iconName]}'\n`);
return `export default {
${contents}
}`;
}