ads-icons-react
Version:
ADS icons for React usage
44 lines (38 loc) • 1.71 kB
JavaScript
/**
* Compiles icons by cleaning directories, fetching icons,
* and generating React components for each icon. Logs progress and success messages
* to the console. This function encapsulates the entire process of preparing
* and compiling icons for use in React applications.
*
* @async
* @function compileIcons
* @returns {Promise<void>} A promise that resolves when the icons have been compiled
* successfully or rejects with an error if any step in the process fails.
*/
const cleanDirectories = require("./utils/directory-cleaner");
const fetchIcons = require("./utils/fetch-icons");
const generateReactComponent = require("./component-generator");
console.log(`
•••••••••••••••••••••••••••••••••••••••
+ +
+ COMPILING ADS ICON FOR React +
+ +
•••••••••••••••••••••••••••••••••••••••
`);
async function compileIcons() {
try {
await cleanDirectories();
console.log("✓ SUCCESS : Icons Directories cleaned and recreated");
const icons = await fetchIcons();
console.log("✓ SUCCESS : Icons cleaned and saved as SVGs in the package");
await generateReactComponent(icons);
console.log(
"✓ SUCCESS : Monochrom icons compiled into react components"
);
// Assuming there's a step to compile or gather color icons as well, not shown in the original code.
// const colorIcons = ...; // This line is just a placeholder for actual logic.
} catch (err) {
console.error(`✗ ERROR : ${err}`);
}
}
compileIcons();