-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update svg-to-js to aviod adblock issues, Remove excess dependencies (#…
…24)
- Loading branch information
1 parent
603036a
commit 212075a
Showing
8 changed files
with
23 additions
and
2,662 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,16 @@ | ||
/* eslint-disable no-console, no-process-exit */ | ||
const chalk = require('chalk'); | ||
const path = require('path'); | ||
|
||
const concatSvg = require('@nrk/svg-to-js'); | ||
const parseArgs = require('minimist'); | ||
|
||
const yearReplacePattern = '||YEAR_FOR_COPYRIGHT||'; | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
const defaultOptions = { | ||
const config = { | ||
svgFileName: 'core-icons.js', | ||
svgFileNameMin: 'core-icons.min.js', | ||
srcPath: path.join(__dirname, '../src'), | ||
distPath: path.join(__dirname, '../dist'), | ||
banner: `Copyright (c) 2015-${yearReplacePattern} NRK <opensource@nrk.no>` | ||
banner: `Copyright (c) 2015-${new Date().getFullYear()} NRK <opensource@nrk.no>` | ||
}; | ||
|
||
console.log(chalk.yellow('Building SVG')); | ||
const argv = parseArgs(process.argv.slice(2), { | ||
string: [ | ||
'svgFileName', | ||
'svgFileNameMin', | ||
'srcPath', | ||
'distPath', | ||
'banner' | ||
], | ||
default: defaultOptions, | ||
unknown: () => { | ||
console.log(`Passed in invalid options: ${chalk.styles.red.open}${process.argv.slice(2)}${chalk.styles.red.close}`); | ||
console.log('Usage: $ node build.js '); | ||
Object.keys(defaultOptions).map((key) => console.log(` --${key} ${defaultOptions[key]}`)); | ||
console.log(''); | ||
process.exit(1); | ||
} | ||
}); | ||
argv.banner = argv.banner.replace(yearReplacePattern, new Date().getFullYear()); | ||
concatSvg(argv) | ||
.then(() => console.log(chalk.green('Merged and minified SVG'))) | ||
console.log('Building SVG'); | ||
concatSvg(config) | ||
.then(() => console.log('Merged and minified SVG')) | ||
.catch((err) => console.log(err.stack)); |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.