1 Commits

Author SHA1 Message Date
dependabot[bot]
cbbf41a255 Bump path-parse from 1.0.6 to 1.0.7
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-10 19:46:52 +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", "name": "@vkl/svg-iconset-builder",
"version": "1.0.2", "version": "1.0.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@@ -42,7 +42,7 @@
"dependencies": { "dependencies": {
"chalk": { "chalk": {
"version": "1.1.3", "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=", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true, "dev": true,
"requires": { "requires": {
@@ -694,9 +694,9 @@
"integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A="
}, },
"path-parse": { "path-parse": {
"version": "1.0.6", "version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true "dev": true
}, },
"q": { "q": {

View File

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

View File

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