1 Commits

Author SHA1 Message Date
dependabot[bot]
d3b5c1acf6 Bump y18n from 4.0.0 to 4.0.1
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-30 09:07:30 +00:00
3 changed files with 9 additions and 7 deletions

10
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "@vkl/svg-iconset-builder",
"version": "1.0.2",
"version": "1.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -42,7 +42,7 @@
"dependencies": {
"chalk": {
"version": "1.1.3",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
@@ -944,9 +944,9 @@
"integrity": "sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg=="
},
"y18n": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w=="
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz",
"integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ=="
},
"yargs": {
"version": "12.0.2",

View File

@@ -1,6 +1,6 @@
{
"name": "@vkl/svg-iconset-builder",
"version": "1.0.2",
"version": "1.0.1",
"description": "create iconset from separated svg icons",
"main": "./dist/app.js",
"types": "./dist/app.d.ts",

View File

@@ -30,6 +30,7 @@ export class SvgIconset {
svgClean(this.config.source, this.svgoPlugin)
.then(optimizedResponse => {
let idx = 0;
const ids = optimizedResponse.map(el => el.id);
Promise.all(optimizedResponse.map(el => el.optimized))
.then(resFiles => {
@@ -37,8 +38,9 @@ export class SvgIconset {
createWriteStream(resultFile)
.once('open', function (this: WriteStream) {
try {
const data = resFiles.map((res, idx) => res.data.replace(/<svg /, `<svg id="${ids[idx]}" `));
const data = resFiles.map(res => res.data.replace(/<svg /, `<svg id="${ids[idx]}" `));
this.write(`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">${data.join('')}</svg>`);
idx++;
this.end();
} catch (err) {
console.log('ERROR', err);