Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function generateComponents() {
// loop through the icons meta array
for (const icon of icons) {
const className = icon.moduleName;
const selectorName = param(icon.moduleName);
const rawSvg = toString(icon.descriptor);
const outputPath = icon.outputOptions.file
.replace('es', 'ts')
.replace('.js', '.ts');
// try to write out the component
try {
await fs.ensureDir(dirname(outputPath));
await fs.writeFile(
outputPath,
componentTemplate(
selectorName,
className,
rawSvg,
icon.descriptor.attrs
)
);
} catch (err) {