Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const indentString = require('indent-string');
const writeFileAsync = promisify(fs.writeFile);
const iconCachePath = path.join(__dirname, '../config/cachedIconData.json');
const pathToIconComponents = path.join(__dirname, '../src/components/Icon');
const pathToIconExamples = path.join(__dirname, '../src/documentation/examples/Icon');
const figmaIconFileId = 'D9T6BuWxbTVKhlDU8faZSQ9G';
const figmaIconFileUrl = `https://www.figma.com/file/${figmaIconFileId}/`;
const iconsToIgnore = [
'icon-grid', // ignore this since it's just the grid background for the icons file
];
const figma = new Figma.Api({
personalAccessToken: process.env.FIGMA_ACCESS_TOKEN,
});
function saveIconCache(lastModified, icons) {
const data = {
lastModified,
icons,
};
fs.writeFileSync(iconCachePath, JSON.stringify(data, null, 2));
}
function getIconCache() {
try {
const cacheFile = fs.readFileSync(iconCachePath).toString();
return JSON.parse(cacheFile);
} catch (error) {