Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #!/usr/bin/env node
import FS from 'fs-extra';
import { Arguments } from 'yargs';
import yargs from 'yargs'
import { hideBin } from 'yargs/helpers'
import path from 'path';
import svgtofont from './index.js';
import { log } from './log.js';
type ArgvResult = Arguments<{
sources: string;
output: string;
fontName: string;
}>
const argv = yargs(hideBin(process.argv))
.alias('s', 'sources')
.describe('s', 'The root from which all sources are relative.')
.alias('o', 'output')
.describe('o', 'Output directory.')
.alias('f', 'fontName')
.describe('f', 'Font Name.')
.demandOption(['output', 'sources'])
.help('h')
.alias('h', 'help')
.epilog('copyright 2019')
.argv as ArgvResult;
const sourcesPath = path.resolve(process.cwd(), argv.sources);
const outputPath = path.resolve(process.cwd(), argv.output);
if (!FS.pathExistsSync(sourcesPath)) {
log.error('The directory does not exist!', sourcesPath);
process.exit();
}
if (!FS.pathExistsSync(outputPath)) {
FS.mkdirpSync(outputPath);
}
svgtofont({
src: sourcesPath, // svg path
dist: outputPath, // output path
// emptyDist: true, // Clear output directory contents
fontName: (argv.fontName) || "svgfont", // font name
css: true, // Create CSS files.
outSVGReact: true,
outSVGReactNative: false,
outSVGVue: true,
outSVGPath: true,
svgicons2svgfont: {
fontHeight: 1000,
normalize: true,
},
})
.then(() => {
log.log('done!');
}).catch((err) => {
log.log('SvgToFont:ERR:', err);
});
|