@eui/tools 6.9.6 → 6.10.0
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.
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.
|
|
1
|
+
6.10.0
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 6.10.0 (2023-03-24)
|
|
2
|
+
|
|
3
|
+
##### New Features
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* route replacement for route config v2 activated - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([bf43901b](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/bf43901b7fceac0dd0610677d32f4eeab88e95df))
|
|
7
|
+
|
|
8
|
+
* * *
|
|
9
|
+
* * *
|
|
10
|
+
## 6.9.7 (2023-03-22)
|
|
11
|
+
|
|
12
|
+
##### Chores
|
|
13
|
+
|
|
14
|
+
* **other:**
|
|
15
|
+
* handle all translation languages for remote compiled translation pre-build step - MWP-9204 [MWP-9204](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9204) ([b8e19ea5](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/b8e19ea54e7053113a0ad8e0f9c0938eab73bd3b))
|
|
16
|
+
|
|
17
|
+
* * *
|
|
18
|
+
* * *
|
|
1
19
|
## 6.9.6 (2023-03-21)
|
|
2
20
|
|
|
3
21
|
##### Chores
|
package/package.json
CHANGED
|
@@ -56,62 +56,41 @@ const getRoutesFile = (project, euiVersion) => {
|
|
|
56
56
|
let routesFilePath;
|
|
57
57
|
let srcRoutesFilePath;
|
|
58
58
|
|
|
59
|
-
if (!project.externalRoutesSources.
|
|
60
|
-
tools.logError('project requires externalRoutesSources.
|
|
59
|
+
if (!project.externalRoutesSources.routesConfigNpmPkg || !project.externalRoutesSources.routesFileSource || !project.externalRoutesSources.routesFilePath) {
|
|
60
|
+
tools.logError('project requires externalRoutesSources.routesConfigNpmPkg, routesFileSources and routesFilePath definitions');
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// check if package is locally cloned
|
|
65
65
|
const localPackage = configUtils.packages.getPackages().filter((p) => {
|
|
66
|
-
return p.npmPkg === project.externalRoutesSources.
|
|
66
|
+
return p.npmPkg === project.externalRoutesSources.routesConfigNpmPkg
|
|
67
67
|
})[0];
|
|
68
68
|
|
|
69
69
|
// if local package is found
|
|
70
70
|
if (localPackage) {
|
|
71
71
|
tools.logInfo('local package found, copying from local');
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
tools.logInfo('include eUI version in routes path...skipped');
|
|
75
|
-
|
|
76
|
-
srcRoutesFilePath = path.join(
|
|
77
|
-
process.cwd(), 'packages', localPackage.name,
|
|
78
|
-
project.externalRoutesSources.routesFileSource,
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
} else {
|
|
82
|
-
tools.logInfo(`constructing route path with eUI version provided: ${euiVersion}`);
|
|
83
|
-
|
|
84
|
-
srcRoutesFilePath = path.join(
|
|
85
|
-
process.cwd(), 'packages', localPackage.name,
|
|
86
|
-
'assets', euiVersion,
|
|
87
|
-
project.externalRoutesSources.routesFileSource,
|
|
88
|
-
);
|
|
89
|
-
}
|
|
73
|
+
tools.logInfo(`constructing route path with eUI version provided: ${euiVersion}`);
|
|
90
74
|
|
|
75
|
+
srcRoutesFilePath = path.join(
|
|
76
|
+
process.cwd(), 'packages', localPackage.name,
|
|
77
|
+
'assets', euiVersion,
|
|
78
|
+
project.externalRoutesSources.routesFileSource,
|
|
79
|
+
);
|
|
91
80
|
|
|
92
81
|
// if not sources are taken from the npm package def in node_modules
|
|
93
82
|
} else {
|
|
94
83
|
tools.logInfo('remote package found, copying from remote');
|
|
95
|
-
const npmPkgScope = project.externalRoutesSources.
|
|
96
|
-
const npmPkgName = project.externalRoutesSources.
|
|
84
|
+
const npmPkgScope = project.externalRoutesSources.routesConfigNpmPkg.substr(0, project.externalRoutesSources.routesConfigNpmPkg.indexOf('/'));
|
|
85
|
+
const npmPkgName = project.externalRoutesSources.routesConfigNpmPkg.substr(project.externalRoutesSources.routesConfigNpmPkg.indexOf('/') + 1);
|
|
97
86
|
|
|
98
|
-
|
|
99
|
-
tools.logInfo('include eUI version in routes path...skipped');
|
|
87
|
+
tools.logInfo(`constructing route path with eUI version provided: ${euiVersion}`);
|
|
100
88
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
} else {
|
|
107
|
-
tools.logInfo(`constructing route path with eUI version provided: ${euiVersion}`);
|
|
108
|
-
|
|
109
|
-
srcRoutesFilePath = path.join(
|
|
110
|
-
process.cwd(), 'node_modules', npmPkgScope, npmPkgName,
|
|
111
|
-
'assets', euiVersion,
|
|
112
|
-
project.externalRoutesSources.routesFileSource,
|
|
113
|
-
);
|
|
114
|
-
}
|
|
89
|
+
srcRoutesFilePath = path.join(
|
|
90
|
+
process.cwd(), 'node_modules', npmPkgScope, npmPkgName,
|
|
91
|
+
'assets', euiVersion,
|
|
92
|
+
project.externalRoutesSources.routesFileSource,
|
|
93
|
+
);
|
|
115
94
|
}
|
|
116
95
|
|
|
117
96
|
routesFilePath = path.join(project.paths.rootPath, project.externalRoutesSources.routesFilePath);
|
|
@@ -133,93 +112,9 @@ const getRoutesFile = (project, euiVersion) => {
|
|
|
133
112
|
})
|
|
134
113
|
}
|
|
135
114
|
|
|
136
|
-
/* @deprecated - TO REMOVE */
|
|
137
|
-
const replaceRouteLegacy = (route) => {
|
|
138
|
-
let routeContent = '{\n';
|
|
139
|
-
|
|
140
|
-
routeContent += ` path: '${route.path}',\n`;
|
|
141
|
-
if (route.data) {
|
|
142
|
-
routeContent += ' data: {\n';
|
|
143
|
-
|
|
144
|
-
if (route.data.id) {
|
|
145
|
-
routeContent += ` id: '${route.data.id}',\n`;
|
|
146
|
-
}
|
|
147
|
-
if (route.data.ids) {
|
|
148
|
-
routeContent += ` ids: ${route.data.ids},\n`;
|
|
149
|
-
}
|
|
150
|
-
if (route.data.featureName) {
|
|
151
|
-
routeContent += ` featureName: '${route.data.featureName}',\n`;
|
|
152
|
-
}
|
|
153
|
-
if (route.data.moduleId) {
|
|
154
|
-
routeContent += ` moduleId: '${route.data.moduleId}',\n`;
|
|
155
|
-
}
|
|
156
|
-
if (route.data.elementTag) {
|
|
157
|
-
routeContent += ` elementTag: '${route.data.elementTag}',\n`;
|
|
158
|
-
}
|
|
159
|
-
if (route.data.iframe) {
|
|
160
|
-
routeContent += ` iframe: ${route.data.iframe},\n`;
|
|
161
|
-
}
|
|
162
|
-
routeContent += ' },\n';
|
|
163
|
-
}
|
|
164
|
-
if (route.canActivate) {
|
|
165
|
-
routeContent += ` canActivate: ${route.canActivate},\n`;
|
|
166
|
-
}
|
|
167
|
-
if (route.loadChildren) {
|
|
168
|
-
routeContent += ` loadChildren: '${route.loadChildren}',\n`
|
|
169
|
-
}
|
|
170
|
-
routeContent += '},\n\n';
|
|
171
|
-
|
|
172
|
-
return routeContent;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
/* @deprecated - TO REMOVE */
|
|
177
115
|
const replaceRoute = (route) => {
|
|
178
116
|
let routeContent = '{\n';
|
|
179
117
|
|
|
180
|
-
routeContent += ` path: '${route.path}',\n`;
|
|
181
|
-
if (route.data) {
|
|
182
|
-
routeContent += ' data: {\n';
|
|
183
|
-
|
|
184
|
-
if (route.data.id) {
|
|
185
|
-
routeContent += ` id: '${route.data.id}',\n`;
|
|
186
|
-
}
|
|
187
|
-
if (route.data.ids) {
|
|
188
|
-
routeContent += ` ids: ${route.data.ids},\n`;
|
|
189
|
-
}
|
|
190
|
-
if (route.data.featureName) {
|
|
191
|
-
routeContent += ` featureName: '${route.data.featureName}',\n`;
|
|
192
|
-
}
|
|
193
|
-
if (route.data.moduleId) {
|
|
194
|
-
routeContent += ` moduleId: '${route.data.moduleId}',\n`;
|
|
195
|
-
}
|
|
196
|
-
if (route.data.elementTag) {
|
|
197
|
-
routeContent += ` elementTag: '${route.data.elementTag}',\n`;
|
|
198
|
-
}
|
|
199
|
-
if (route.data.iframe) {
|
|
200
|
-
routeContent += ` iframe: ${route.data.iframe},\n`;
|
|
201
|
-
}
|
|
202
|
-
routeContent += ' },\n';
|
|
203
|
-
}
|
|
204
|
-
if (route.canActivate) {
|
|
205
|
-
routeContent += ` canActivate: ${route.canActivate},\n`;
|
|
206
|
-
}
|
|
207
|
-
if (route.loadChildren) {
|
|
208
|
-
const lcArray = route.loadChildren.split('#');
|
|
209
|
-
const lcImport = lcArray[0];
|
|
210
|
-
const lcModule = lcArray[1];
|
|
211
|
-
routeContent += ` loadChildren: () => import('${lcImport}').then(m => m.${lcModule}),\n`
|
|
212
|
-
}
|
|
213
|
-
routeContent += '},\n\n';
|
|
214
|
-
|
|
215
|
-
return routeContent;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const replaceRouteV2 = (route) => {
|
|
221
|
-
let routeContent = '{\n';
|
|
222
|
-
|
|
223
118
|
routeContent += ` path: '${route.path}',\n`;
|
|
224
119
|
if (Object.keys(route.data).length > 0) {
|
|
225
120
|
routeContent += ' data: {\n';
|
|
@@ -256,129 +151,7 @@ const replaceRouteV2 = (route) => {
|
|
|
256
151
|
}
|
|
257
152
|
|
|
258
153
|
|
|
259
|
-
|
|
260
|
-
const replaceRoutes = (project, envTarget, build, routesFileContent, euiVersion) => {
|
|
261
|
-
return Promise.resolve()
|
|
262
|
-
.then(() => {
|
|
263
|
-
|
|
264
|
-
tools.logInfo('Replace routes legacy started...');
|
|
265
|
-
|
|
266
|
-
// getting base route defs content
|
|
267
|
-
// default route
|
|
268
|
-
let routeDefsBaseFilename = 'route-defs-base.json';
|
|
269
|
-
|
|
270
|
-
// if full route base name is setup
|
|
271
|
-
if (project.externalRoutesSources.routesBaseFilename) {
|
|
272
|
-
routeDefsBaseFilename = project.externalRoutesSources.routesBaseFilename;
|
|
273
|
-
|
|
274
|
-
// if prefix and type, we construct the route base name (dynamic following eUI version of host installed)
|
|
275
|
-
// format is : route-defs-base-vVERSION_NUMBER[-TYPE].json
|
|
276
|
-
} else if (project.externalRoutesSources.routesBaseFilenamePrefix) {
|
|
277
|
-
let routesBaseType = '';
|
|
278
|
-
if (project.externalRoutesSources.routesBaseFilenameType) {
|
|
279
|
-
routesBaseType = `-${project.externalRoutesSources.routesBaseFilenameType}`;
|
|
280
|
-
}
|
|
281
|
-
const euiVersionNumber = euiVersion.split('.')[0];
|
|
282
|
-
routeDefsBaseFilename = `${project.externalRoutesSources.routesBaseFilenamePrefix}-v${euiVersionNumber}${routesBaseType}.json`;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
const projectAssetsPath = path.join(process.cwd(), project.folder, 'src', 'assets');
|
|
286
|
-
const baseRouteDefsPath = path.join(projectAssetsPath, routeDefsBaseFilename);
|
|
287
|
-
|
|
288
|
-
if (!tools.isFileExists(baseRouteDefsPath)) {
|
|
289
|
-
tools.logError(`${baseRouteDefsPath} File NOT FOUND`);
|
|
290
|
-
throw 'BASE_ROUTE_DEFS_FILE_NOT_FOUND';
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
// fetching base route defs file content
|
|
294
|
-
const baseRouteDefsJSON = require(baseRouteDefsPath);
|
|
295
|
-
|
|
296
|
-
// getting env route defs content if build mode (not serve)
|
|
297
|
-
let envRouteDefsPath, envRouteDefsJSON = [];
|
|
298
|
-
const envTargetFinal = getEnvTarget(envTarget, build);
|
|
299
|
-
|
|
300
|
-
envRouteDefsPath = path.join(projectAssetsPath, 'route-defs.' + envTargetFinal + '.json');
|
|
301
|
-
|
|
302
|
-
if (!tools.isFileExists(envRouteDefsPath)) {
|
|
303
|
-
tools.logError(`${envRouteDefsPath} File NOT FOUND`);
|
|
304
|
-
throw 'ENV_ROUTE_DEFS_FILE_NOT_FOUND';
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
// fetching file content
|
|
308
|
-
envRouteDefsJSON = require(envRouteDefsPath);
|
|
309
|
-
|
|
310
|
-
// merging content of base + env
|
|
311
|
-
tools.logInfo(`Merging ${baseRouteDefsPath} with ${envRouteDefsPath}`);
|
|
312
|
-
|
|
313
|
-
let mergedRouteDefs = _.merge(_.keyBy(baseRouteDefsJSON, 'path'), _.keyBy(envRouteDefsJSON, 'path'));
|
|
314
|
-
let finalRouteDefs = _.values(mergedRouteDefs);
|
|
315
|
-
|
|
316
|
-
// checking if overrides needs to be applied specific to env + version
|
|
317
|
-
let euiVersionNumber;
|
|
318
|
-
if (euiVersion === 'DEFAULT') {
|
|
319
|
-
euiVersionNumber = '7'
|
|
320
|
-
} else {
|
|
321
|
-
euiVersionNumber = euiVersion.split('.')[0];
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
const envRouteVersionOverridesPath = path.join(projectAssetsPath, 'route-defs.' + envTargetFinal + '-overrides-v' + euiVersionNumber + '.json');
|
|
325
|
-
|
|
326
|
-
if (!tools.isFileExists(envRouteVersionOverridesPath)) {
|
|
327
|
-
tools.logInfo('Routes file overrides not found for ' + envTargetFinal + ' ' + euiVersionNumber + '...skipping');
|
|
328
|
-
|
|
329
|
-
} else {
|
|
330
|
-
const euiRoutesOVerridesJSON = require(envRouteVersionOverridesPath);
|
|
331
|
-
tools.logInfo(`Merging ${envRouteVersionOverridesPath}`);
|
|
332
|
-
mergedRouteDefs = _.merge(_.keyBy(mergedRouteDefs, 'path'), _.keyBy(euiRoutesOVerridesJSON, 'path'));
|
|
333
|
-
finalRouteDefs = _.values(mergedRouteDefs);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
// processing routes
|
|
337
|
-
let placeHolderContent = '';
|
|
338
|
-
|
|
339
|
-
tools.logInfo('Processing routes replacement');
|
|
340
|
-
|
|
341
|
-
finalRouteDefs.forEach((route) => {
|
|
342
|
-
if (debug) tools.logInfo(`====> route : ${route.path}`);
|
|
343
|
-
|
|
344
|
-
if (!route.loadChildren) {
|
|
345
|
-
tools.logInfo('Loadchildren does not exist for route...skipping');
|
|
346
|
-
tools.logInfo('Route excluded:');
|
|
347
|
-
console.log(route);
|
|
348
|
-
|
|
349
|
-
} else {
|
|
350
|
-
if (euiVersion === 'DEFAULT' || euiVersion === '10.x') {
|
|
351
|
-
tools.logInfo(`Legacy routes replacement for v7 and v10 => replacing ${route.path}`);
|
|
352
|
-
placeHolderContent += replaceRouteLegacy(route);
|
|
353
|
-
|
|
354
|
-
} else {
|
|
355
|
-
tools.logInfo(`New route replacement for v14+ => replacing ${route.path}`);
|
|
356
|
-
placeHolderContent += replaceRoute(route);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
if (debug) tools.logSuccess('======> OK replaced');
|
|
360
|
-
}
|
|
361
|
-
})
|
|
362
|
-
|
|
363
|
-
const placeHolderToken = '// routes-placeholder';
|
|
364
|
-
routesFileContent = tools.replaceAll(routesFileContent, placeHolderToken, placeHolderContent);
|
|
365
|
-
|
|
366
|
-
if (debug) {
|
|
367
|
-
tools.logInfo('Routes file content replaced : ');
|
|
368
|
-
console.log(routesFileContent);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
return routesFileContent;
|
|
372
|
-
})
|
|
373
|
-
|
|
374
|
-
.catch((e) => {
|
|
375
|
-
throw e;
|
|
376
|
-
})
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
const processRoutesConfigV2 = (project, envTarget, build, routesFileContent, euiVersion) => {
|
|
154
|
+
const processRoutesConfig = (project, envTarget, build, routesFileContent, euiVersion) => {
|
|
382
155
|
return Promise.resolve()
|
|
383
156
|
.then(() => {
|
|
384
157
|
tools.logInfo('Replace routes v2...');
|
|
@@ -618,7 +391,7 @@ const processRoutesConfigV2 = (project, envTarget, build, routesFileContent, eui
|
|
|
618
391
|
let placeHolderContent = '';
|
|
619
392
|
|
|
620
393
|
appRoutes.forEach((route) => {
|
|
621
|
-
placeHolderContent +=
|
|
394
|
+
placeHolderContent += replaceRoute(route);
|
|
622
395
|
});
|
|
623
396
|
|
|
624
397
|
const placeHolderToken = '// routes-placeholder';
|
|
@@ -683,9 +456,7 @@ module.exports.buildRoutes = (project, envTarget, build) => {
|
|
|
683
456
|
|
|
684
457
|
return Promise.resolve()
|
|
685
458
|
.then(() => {
|
|
686
|
-
|
|
687
|
-
return injectRoutesConfig(project, project.externalRoutesSources.routesConfigNpmPkg);
|
|
688
|
-
}
|
|
459
|
+
return injectRoutesConfig(project, project.externalRoutesSources.routesConfigNpmPkg);
|
|
689
460
|
})
|
|
690
461
|
|
|
691
462
|
.then(() => {
|
|
@@ -700,11 +471,7 @@ module.exports.buildRoutes = (project, envTarget, build) => {
|
|
|
700
471
|
})
|
|
701
472
|
|
|
702
473
|
.then(() => {
|
|
703
|
-
|
|
704
|
-
return processRoutesConfigV2(project, envTarget, build, routesFileContent, euiVersion);
|
|
705
|
-
} else {
|
|
706
|
-
return replaceRoutes(project, envTarget, build, routesFileContent, euiVersion);
|
|
707
|
-
}
|
|
474
|
+
return processRoutesConfig(project, envTarget, build, routesFileContent, euiVersion);
|
|
708
475
|
})
|
|
709
476
|
|
|
710
477
|
.then((finalRouteFileContent) => {
|
|
@@ -27,12 +27,19 @@ module.exports.generate = (inputScopes = '', inputPkg) => {
|
|
|
27
27
|
const destFolder = path.join(rootSrcFolder, 'assets/i18n-compiled');
|
|
28
28
|
const globalTranslationsFolder = path.join(rootSrcFolder, 'assets/i18n-global');
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
let nmPath = pkg.paths.repoNodeModules;
|
|
31
|
+
|
|
32
|
+
let langs = ['en', 'fr'];
|
|
33
|
+
if (pkg.build && pkg.build.translationLanguages) {
|
|
34
|
+
if (pkg.build.translationLanguages === 'ALL') {
|
|
35
|
+
langs = ['bg', 'es', 'cs', 'da', 'de', 'et', 'el', 'en', 'fr', 'ga', 'hr', 'it', 'lv', 'lt', 'hu', 'mt', 'nl', 'pl', 'pt', 'ro', 'sk', 'sl', 'fi', 'sv'];
|
|
36
|
+
} else {
|
|
37
|
+
langs = pkg.build.translationLanguages;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
let packages = [];
|
|
34
41
|
|
|
35
|
-
|
|
42
|
+
let genScopes;
|
|
36
43
|
if (scopes) {
|
|
37
44
|
genScopes = scopes;
|
|
38
45
|
} else {
|