2021-08-26 13:22:20 +02:00
|
|
|
import { promises as fs } from 'fs';
|
2023-09-13 21:05:22 +02:00
|
|
|
import SVGFixer from 'oslllo-svg-fixer';
|
2021-09-27 20:52:21 +02:00
|
|
|
import getArgumentOptions from 'minimist';
|
2022-11-08 08:07:32 +01:00
|
|
|
import path from 'path';
|
2021-08-26 13:22:20 +02:00
|
|
|
|
2022-11-08 08:07:32 +01:00
|
|
|
const inputDir = path.join(process.cwd(), '../../icons');
|
2021-09-27 20:52:21 +02:00
|
|
|
const cliArguments = getArgumentOptions(process.argv.slice(2));
|
2022-11-08 08:07:32 +01:00
|
|
|
const { outputDir = 'outlined' } = cliArguments;
|
|
|
|
|
const targetDir = path.join(process.cwd(), '../../', outputDir);
|
2020-10-19 06:26:39 -03:00
|
|
|
|
2021-08-26 13:22:20 +02:00
|
|
|
async function init() {
|
|
|
|
|
console.time('icon outliner');
|
|
|
|
|
try {
|
2022-11-08 08:07:32 +01:00
|
|
|
try {
|
|
|
|
|
await fs.mkdir(targetDir);
|
|
|
|
|
} catch (error) {} // eslint-disable-line no-empty
|
2021-08-26 13:22:20 +02:00
|
|
|
|
2023-09-13 21:05:22 +02:00
|
|
|
await SVGFixer(inputDir, targetDir, {
|
|
|
|
|
showProgressBar: true,
|
|
|
|
|
traceResolution: 800,
|
|
|
|
|
}).fix();
|
2021-08-26 13:22:20 +02:00
|
|
|
|
|
|
|
|
console.timeEnd('icon outliner');
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.log(err);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
init();
|