@eui/tools 6.3.32 → 6.3.33

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
- 6.3.32
1
+ 6.3.33
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 6.3.33 (2023-02-14)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * adapted post-build operation for remote v15 - cleanup unused assets - testing remotes imports for MWP playground devX - MWP-9204 [MWP-9204](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9204) ([f11ffff8](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/f11ffff88b66a3a78591d847151ce9edb946c70f))
7
+
8
+ * * *
9
+ * * *
1
10
  ## 6.3.32 (2023-02-14)
2
11
 
3
12
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.3.32",
3
+ "version": "6.3.33",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
package/sandbox.js CHANGED
@@ -1134,12 +1134,17 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
1134
1134
  // console.log(e);
1135
1135
  // })
1136
1136
 
1137
- Promise.resolve()
1138
- .then(() => {
1139
- // const remotes = configUtils.remotes.getRemotes();
1140
- // console.log(remotes);
1141
- return installUtils.remotes.installDeps();
1142
- })
1137
+ // const prj = configUtils.projects.getCsdrProject('my-workplace-host-playground');
1138
+
1139
+ // Promise.resolve()
1140
+ // .then(() => {
1141
+ // return installUtils.projects.getLocalProjectRemoteDeps(prj);
1142
+ // })
1143
+ // .then((deps) => {
1144
+ // return installUtils.projects.importLocalProjectRemotes(prj, deps);
1145
+ // })
1146
+ // .then(() => {
1147
+ // })
1143
1148
 
1144
1149
 
1145
1150
  // Promise.resolve()
@@ -1152,4 +1157,14 @@ Promise.resolve()
1152
1157
  // })
1153
1158
 
1154
1159
 
1160
+ Promise.resolve()
1161
+ .then(() => {
1162
+ const remote = configUtils.remotes.getRemote('cc-task-centre-eui15-remote-el-ui');
1163
+ return buildPackageUtils.element.postBuild(remote, '1.0.0');
1164
+ })
1165
+ .then(() => {
1166
+ console.log('ok');
1167
+ })
1168
+
1169
+
1155
1170
 
@@ -72,9 +72,11 @@ module.exports.getPackageByNpmPkg = (npmPkg, fromCsdrConfig) => {
72
72
  }
73
73
 
74
74
  module.exports.isLocalPackage = (npmPkg) => {
75
- return getPackages().filter((p) => {
76
- return p.npmPkg === npmPkg
77
- })[0] !== null;
75
+ tools.logInfo(`Checking if ${npmPkg} is localled installed`);
76
+
77
+ const packagesFound = getPackages().filter(p => p.npmPkg === npmPkg);
78
+
79
+ return packagesFound.length > 0;
78
80
  }
79
81
 
80
82
 
@@ -19,8 +19,6 @@ module.exports.getRemote = (remoteName) => {
19
19
  remoteName = tools.getArgs().root;
20
20
  }
21
21
 
22
- tools.logInfo(`Getting remote config for ${remoteName}`);
23
-
24
22
  const remotesConfig = require(path.join(process.cwd(), '.csdr', '.euirc-csdr-remotes.json'));
25
23
  const remoteConfig = remotesConfig[remoteName];
26
24
 
@@ -83,7 +81,14 @@ module.exports.getCsdrRemotes = (hostName, euiVersion) => {
83
81
  }
84
82
  }
85
83
 
86
- tools.logInfo(`Getting remotes for host: ${hostName} - euiVersion: ${euiVersion}`);
84
+ tools.logInfo(`Getting remotes`);
85
+
86
+ if (hostName) {
87
+ tools.logInfo(`--- for host: ${hostName}`);
88
+ }
89
+ if (euiVersion) {
90
+ tools.logInfo(`--- for euiVersion: ${euiVersion}`);
91
+ }
87
92
 
88
93
  const remotesConfig = require(path.join(process.cwd(), '.csdr', '.euirc-csdr-remotes.json'));
89
94
  const remotesArray = Object.keys(remotesConfig).map((r) => {
@@ -115,3 +120,22 @@ module.exports.getRemotes = () => {
115
120
  })
116
121
  return outputRemotes;
117
122
  }
123
+
124
+ module.exports.getRemoteByNpmPkg = (npmPkg, fromCsdrConfig) => {
125
+ let remotes;
126
+
127
+ if (fromCsdrConfig) {
128
+ remotes = this.getCsdrRemotes();
129
+
130
+ } else {
131
+ remotes = this.getRemotes();
132
+ }
133
+
134
+ return remotes.filter((r) => {
135
+ return r.npmPkg === npmPkg;
136
+ })[0];
137
+ }
138
+
139
+ module.exports.isLocalRemote = (npmPkg) => {
140
+ return this.getRemoteByNpmPkg(npmPkg) !== undefined;
141
+ }
@@ -243,15 +243,15 @@ module.exports.importLocalProjectRemotes = (prj, remoteDeps) => {
243
243
  tools.logInfo(`Initializing ${remoteDeps.length} remotes`);
244
244
 
245
245
  remoteDeps.forEach((remoteNpmPkg) => {
246
- tools.logInfo(`Checking import for : ${remoteNpmPkg}`);
246
+ tools.logInfo(`\nChecking import for : ${remoteNpmPkg}`);
247
247
 
248
248
  // check if package has been installed locally
249
- if (configUtils.packages.isLocalPackage(remoteNpmPkg)) {
249
+ if (configUtils.remotes.isLocalRemote(remoteNpmPkg)) {
250
250
  tools.logInfo('remote is installed locally...skipping import');
251
251
 
252
252
  } else {
253
- const pkg = configUtils.packages.getPackageByNpmPkg(remoteNpmPkg, true);
254
- const projectElementsPath = path.join(process.cwd(), prj.folder, 'src', 'assets', 'elements', pkg.name, 'bundles');
253
+ const remote = configUtils.remotes.getRemoteByNpmPkg(remoteNpmPkg, true);
254
+ const projectElementsPath = path.join(process.cwd(), prj.folder, 'src', 'assets', 'elements', remote.name, 'bundles');
255
255
 
256
256
  const npmPkgScope = remoteNpmPkg.substr(0, remoteNpmPkg.indexOf('/'));
257
257
  const npmPkgName = remoteNpmPkg.substr(remoteNpmPkg.indexOf('/') + 1);
@@ -92,11 +92,13 @@ module.exports.build = (pkg, isMaster) => {
92
92
 
93
93
 
94
94
  module.exports.postBuild = (pkg, version) => {
95
- tools.logInfo('Executing element post-build...');
95
+ tools.logTitle('Executing element post-build...');
96
96
 
97
97
  const remoteEuiVersion = configUtils.packages.getPackageEuiVersion(pkg);
98
98
  const euiVersionNumber = remoteEuiVersion.split('.')[0];
99
99
 
100
+ tools.logInfo(`remote: ${pkg.name} - eUI version : ${remoteEuiVersion}`);
101
+
100
102
  if (dryRun) {
101
103
  tools.logInfo('DRY-RUN...skipping');
102
104
  return;
@@ -127,6 +129,10 @@ module.exports.postBuild = (pkg, version) => {
127
129
  return remotesUtils.emptyIndexHtml(path.join(pkg.paths.dist, 'bundles'));
128
130
  })
129
131
 
132
+ .then(() => {
133
+ return remotesUtils.cleanupUnusedAssets(path.join(pkg.paths.dist, 'bundles', 'assets'), euiVersionNumber);
134
+ })
135
+
130
136
  .catch((e) => {
131
137
  throw e;
132
138
  })
@@ -78,3 +78,38 @@ module.exports.emptyIndexHtml = (destPath) => {
78
78
  throw e;
79
79
  })
80
80
  }
81
+
82
+
83
+ module.exports.cleanupUnusedAssets = (assetsPath, euiVersionNumber = 10) => {
84
+ tools.logInfo(`Cleanup unused assets for version : ${euiVersionNumber} in ${assetsPath}`);
85
+
86
+ if (euiVersionNumber > 10) {
87
+
88
+ return Promise.resolve()
89
+ .then(() => {
90
+ return tools.rimraf(path.join(assetsPath, 'ecl'));
91
+ })
92
+ .then(() => {
93
+ return tools.rimraf(path.join(assetsPath, 'icons', 'ionicons'));
94
+ })
95
+ .then(() => {
96
+ return tools.rimraf(path.join(assetsPath, 'icons', 'svg'));
97
+ })
98
+ .then(() => {
99
+ return tools.rimraf(path.join(assetsPath, 'icons', 'svg-src'));
100
+ })
101
+ .then(() => {
102
+ return tools.rimraf(path.join(assetsPath, 'icons', 'flags'));
103
+ })
104
+ .then(() => {
105
+ return tools.rimraf(path.join(assetsPath, 'fonts'));
106
+ })
107
+ .then(() => {
108
+ return tools.rimraf(path.join(assetsPath, 'i18n-eui'));
109
+ })
110
+
111
+ .catch((e) => {
112
+ throw e;
113
+ })
114
+ }
115
+ }
@@ -181,6 +181,7 @@ function rmdir(path) {
181
181
  }
182
182
 
183
183
  function rimraf(inputPath) {
184
+ this.logInfo(`Removing ${inputPath}...`);
184
185
  let exec = path.resolve(process.cwd(), 'node_modules', 'rimraf', 'bin.js');
185
186
  if (!isFileExists(exec)) {
186
187
  // special location when used within eUI CLI