V16: Moves icon dependencies to 'core' package.json (#20041)
* build(deps-dev): moves icon dependencies to 'core' package + upgrades them to latest * chore: regenerates icons * chore(eslint): fixes eslint warnings
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable local-rules/enforce-umbraco-external-imports */
|
||||
import { readFileSync, writeFile, mkdir, rmSync } from 'fs';
|
||||
import * as globModule from 'tiny-glob';
|
||||
import * as pathModule from 'path';
|
||||
import * as globModule from 'tiny-glob';
|
||||
import { optimize } from 'svgo';
|
||||
|
||||
const path = pathModule.default;
|
||||
@@ -23,7 +24,7 @@ const run = async () => {
|
||||
// Empty output directory:
|
||||
rmSync(iconsOutputDirectory, { recursive: true });
|
||||
|
||||
var icons = await collectDictionaryIcons();
|
||||
let icons = await collectDictionaryIcons();
|
||||
icons = await collectDiskIcons(icons);
|
||||
writeIconsToDisk(icons);
|
||||
generateJS(icons);
|
||||
@@ -59,7 +60,7 @@ const collectDictionaryIcons = async () => {
|
||||
};
|
||||
|
||||
icons.push(icon);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
errors.push(`[Lucide] Could not load file: '${path}'`);
|
||||
console.log(`[Lucide] Could not load file: '${path}'`);
|
||||
}
|
||||
@@ -91,7 +92,7 @@ const collectDictionaryIcons = async () => {
|
||||
};
|
||||
|
||||
icons.push(icon);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
errors.push(`[SimpleIcons] Could not load file: '${path}'`);
|
||||
console.log(`[SimpleIcons] Could not load file: '${path}'`);
|
||||
}
|
||||
@@ -117,7 +118,7 @@ const collectDictionaryIcons = async () => {
|
||||
};
|
||||
|
||||
icons.push(icon);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
errors.push(`[Umbraco] Could not load file: '${path}'`);
|
||||
console.log(`[Umbraco] Could not load file: '${path}'`);
|
||||
}
|
||||
@@ -171,11 +172,9 @@ const writeIconsToDisk = (icons) => {
|
||||
|
||||
writeFileWithDir(icon.output, content, (err) => {
|
||||
if (err) {
|
||||
// eslint-disable-next-line no-undef
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
//console.log(`icon: ${icon.name} generated`);
|
||||
});
|
||||
});
|
||||
@@ -192,18 +191,18 @@ const generateJS = (icons) => {
|
||||
${icon.legacy ? 'legacy: true,' : ''}
|
||||
${icon.hidden || icon.legacy ? 'hidden: true,' : ''}
|
||||
path: () => import("./icons/${icon.fileName}.js"),
|
||||
}`.replace(/\t/g, '').replace(/^\s*[\r\n]/gm, ''); // Regex removes white space [NL] // + regex that removes empty lines. [NL]
|
||||
}`
|
||||
.replace(/\t/g, '') // Regex removes white space [NL]
|
||||
.replace(/^\s*[\r\n]/gm, ''); // Regex that removes empty lines. [NL]
|
||||
});
|
||||
|
||||
const content = `export default [${iconDescriptors.join(',')}];`;
|
||||
|
||||
writeFileWithDir(JSPath, content, (err) => {
|
||||
if (err) {
|
||||
// eslint-disable-next-line no-undef
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
console.log('Icons outputted and Icon Manifests generated!');
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user