@eui/tools 5.3.68 → 5.3.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 5.3.68
1
+ 5.3.70
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 5.3.70 (2022-10-05)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * adapt svg sprite generator script for eUI 15 - EUI-6448 [EUI-6448](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6448) ([e5f8465e](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/e5f8465ea9de6e2204983d45b97349e4439e07c7))
7
+
8
+ * * *
9
+ * * *
10
+ ## 5.3.69 (2022-10-03)
11
+
12
+ ##### Bug Fixes
13
+
14
+ * **other:**
15
+ * force svgstore to 2.x for node10 install - MWPv7 - EUI-4107 [EUI-4107](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-4107) ([29d9cc2e](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/29d9cc2e4757619a46a2bdc6aa3ef90ee302f0f3))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 5.3.68 (2022-10-02)
2
20
 
3
21
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "5.3.68",
3
+ "version": "5.3.70",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -6,5 +6,6 @@
6
6
  "lru-cache": "5.1.1",
7
7
  "update-notifier": "4.1.3",
8
8
  "glob": ">=7.0.0 <8.0.0",
9
- "nopt": ">=5.0.0 <6.0.0"
9
+ "nopt": ">=5.0.0 <6.0.0",
10
+ "svgstore": "2.0.3"
10
11
  }
@@ -195,10 +195,10 @@ module.exports.processSvgAssets = (project) => {
195
195
  return Promise.resolve()
196
196
  .then(() => {
197
197
  const svgsInPath = path.join(project.paths.rootPath, 'src', 'assets', 'svg');
198
- const svgsOutPath = path.join(project.paths.rootPath, 'src', 'assets', 'svg', 'optimized');
199
- const svgsSpritePath = path.join(svgsInPath, 'sprite.svg');
198
+ const svgsSpritePath = path.join(svgsInPath, sprites);
199
+ const svgsSpriteFile = 'sprite.svg';
200
200
 
201
- return svgUtils.generateSvgsSprite(svgsInPath, svgsOutPath, svgsSpritePath);
201
+ return svgUtils.generateSvgsSprite(svgsInPath, svgsSpritePath, svgsSpriteFile);
202
202
  })
203
203
 
204
204
  .catch((e) => {
@@ -5,11 +5,13 @@ const path = require('path');
5
5
 
6
6
  const tools = require('./tools');
7
7
 
8
- module.exports.generateSvgsSprite = (svgsInPath, svgsOutPath, svgsSpritePath) => {
8
+ module.exports.generateSvgsSprite = (svgsInPath, svgsSpritePath, svgsSpriteFile) => {
9
9
  const imagemin = require('imagemin');
10
10
  const imageminSvgo = require('imagemin-svgo');
11
11
  const svgstore = require('svgstore');
12
12
 
13
+ const svgsOutPath = path.join(svgsInPath, 'temp');
14
+
13
15
  let svgFiles;
14
16
 
15
17
  return Promise.resolve()
@@ -17,7 +19,7 @@ module.exports.generateSvgsSprite = (svgsInPath, svgsOutPath, svgsSpritePath) =>
17
19
  return tools.rimraf(svgsOutPath);
18
20
  })
19
21
  .then(() => {
20
- return tools.remove(svgsSpritePath);
22
+ return tools.remove(path.join(svgsSpritePath, svgsSpriteFile));
21
23
  })
22
24
  .then(() => {
23
25
  return tools.getFilesGlob(svgsInPath, '**/*.svg');
@@ -55,6 +57,7 @@ module.exports.generateSvgsSprite = (svgsInPath, svgsOutPath, svgsSpritePath) =>
55
57
 
56
58
  const sprites = svgstore();
57
59
 
60
+ // compiling sprite file
58
61
  svgFiles.forEach((f) => {
59
62
  sprites.add(
60
63
  f.substr(0, f.indexOf('.svg')),
@@ -62,7 +65,17 @@ module.exports.generateSvgsSprite = (svgsInPath, svgsOutPath, svgsSpritePath) =>
62
65
  );
63
66
  });
64
67
 
65
- tools.writeFileContent(svgsSpritePath, sprites);
68
+ // generating json output list
69
+ const outList = svgFiles.map((f) => {
70
+ return f.substr(0, f.indexOf('.svg'));
71
+ });
72
+
73
+ const svgsSpriteFileJson = svgsSpriteFile.substr(0, svgsSpriteFile.indexOf('.svg')) + '.json';
74
+ console.log(svgsSpriteFileJson);
75
+
76
+ tools.writeJsonFileSync(path.join(svgsSpritePath, svgsSpriteFileJson), outList);
77
+
78
+ tools.writeFileContent(path.join(svgsSpritePath, svgsSpriteFile), sprites);
66
79
 
67
80
  tools.logSuccess(`OK => ${svgsSpritePath} generated`);
68
81
  })
@@ -350,9 +350,13 @@ function move(from, to) {
350
350
 
351
351
  function mkdirFilePath(filename) {
352
352
  const metadataFilePath = path.dirname(filename);
353
-
354
- if (!this.isDirExists(metadataFilePath)) {
355
- fs.mkdirSync(metadataFilePath, { recursive: true })
353
+ try {
354
+ if (!this.isDirExists(metadataFilePath)) {
355
+ fs.mkdirSync(metadataFilePath, { recursive: true })
356
+ }
357
+ } catch(e) {
358
+ if (e.code === 'EEXIST') return;
359
+ throw e;
356
360
  }
357
361
  }
358
362