@eui/tools 6.12.28 → 6.12.30
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 +1 -1
- package/CHANGELOG.md +19 -0
- package/package.json +1 -1
- package/scripts/app/public/index.html +1 -1
- package/scripts/app/public/index.js +2 -2
- package/scripts/app/routes/index.js +32 -1
- package/scripts/csdr/config/projects.js +2 -0
- package/scripts/csdr/metadata/stats.js +29 -23
- package/scripts/index.js +4 -1
- package/scripts/utils/pre-build/injection/injection-utils.js +0 -1
- package/scripts/utils/pre-build/projects.js +5 -3
- package/scripts/utils/pre-build/routes-replacement/routes-replacement-subs.js +143 -0
- package/scripts/utils/pre-build/routes-replacement/routes-replacement.js +682 -0
- package/scripts/utils/pre-build/injection/routes-replacement.js +0 -776
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.12.
|
|
1
|
+
6.12.30
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## 6.12.30 (2023-07-21)
|
|
2
|
+
|
|
3
|
+
##### Chores
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* fix test failing ([e0208503](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/e0208503a4b939eced6903ecf1ce3a1892d91ed9))
|
|
7
|
+
* refactor route replacements and cleanup - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([ce7cad37](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/ce7cad37193099685fc0c5ba0def280d9ac353e4))
|
|
8
|
+
|
|
9
|
+
* * *
|
|
10
|
+
* * *
|
|
11
|
+
## 6.12.29 (2023-07-19)
|
|
12
|
+
|
|
13
|
+
##### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **other:**
|
|
16
|
+
* stats and lock custom install for v16 remotes - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([a4736428](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/a4736428e3c4d843c67a58608a3c4818e37a980d))
|
|
17
|
+
|
|
18
|
+
* * *
|
|
19
|
+
* * *
|
|
1
20
|
## 6.12.28 (2023-07-19)
|
|
2
21
|
|
|
3
22
|
##### Chores
|
package/package.json
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
<label class="col-sm-2 col-form-label">eUI Version</label>
|
|
45
45
|
<div class="col-sm-10">
|
|
46
46
|
<select dis abled class="form-select" v-model="selectedEuiVersion">
|
|
47
|
-
<option value="
|
|
47
|
+
<option value="16.x">eUI 16</option>
|
|
48
48
|
</select>
|
|
49
49
|
</div>
|
|
50
50
|
</div>
|
|
@@ -13,7 +13,7 @@ new Vue({
|
|
|
13
13
|
data() {
|
|
14
14
|
return {
|
|
15
15
|
selectedProject: "my-workplace-host-playground-custom",
|
|
16
|
-
selectedEuiVersion: "
|
|
16
|
+
selectedEuiVersion: "16.x",
|
|
17
17
|
remotes: [],
|
|
18
18
|
selectedRemotes: [],
|
|
19
19
|
selectedInstalledRemotes: [],
|
|
@@ -29,7 +29,7 @@ new Vue({
|
|
|
29
29
|
},
|
|
30
30
|
methods: {
|
|
31
31
|
async getRemotes() {
|
|
32
|
-
const res = await fetch("http://localhost:3000/api/
|
|
32
|
+
const res = await fetch("http://localhost:3000/api/remotesForConfig");
|
|
33
33
|
const finalRes = await res.json();
|
|
34
34
|
this.remotes = finalRes;
|
|
35
35
|
},
|
|
@@ -17,7 +17,38 @@ const handlerError = (res, e) => {
|
|
|
17
17
|
router.get('/remotes', function (req, res) {
|
|
18
18
|
return Promise.resolve()
|
|
19
19
|
.then(() => {
|
|
20
|
-
return
|
|
20
|
+
return [
|
|
21
|
+
...configUtils.remotes.getCsdrRemotesArray('my-workplace', '15.x'),
|
|
22
|
+
...configUtils.remotes.getCsdrRemotesArray('my-workplace', '16.x'),
|
|
23
|
+
];
|
|
24
|
+
})
|
|
25
|
+
.then((fetchedRemotes) => {
|
|
26
|
+
let remotes = tools.sortArray(fetchedRemotes, 'name');
|
|
27
|
+
remotes = remotes.filter((r) => {
|
|
28
|
+
let participant = false;
|
|
29
|
+
if (r.fullSkeletonSources) {
|
|
30
|
+
if (r.skeletonConfig.options && r.skeletonConfig.options.participant) {
|
|
31
|
+
participant = true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (r.fullSkeletonSources && !participant) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
res.send(remotes);
|
|
40
|
+
})
|
|
41
|
+
.catch((e) => {
|
|
42
|
+
handlerError(res, e);
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
router.get('/remotesForConfig', function (req, res) {
|
|
47
|
+
return Promise.resolve()
|
|
48
|
+
.then(() => {
|
|
49
|
+
return [
|
|
50
|
+
...configUtils.remotes.getCsdrRemotesArray('my-workplace', '16.x'),
|
|
51
|
+
];
|
|
21
52
|
})
|
|
22
53
|
.then((fetchedRemotes) => {
|
|
23
54
|
let remotes = tools.sortArray(fetchedRemotes, 'name');
|
|
@@ -41,6 +41,7 @@ const getProjectPaths = (prj) => {
|
|
|
41
41
|
if (prj.build && prj.build.maven) {
|
|
42
42
|
angularPath = path.join(rootPath, 'src/main/angular');
|
|
43
43
|
}
|
|
44
|
+
const assetsPath = path.join(angularPath, 'src', 'assets');
|
|
44
45
|
const elementsPath = path.join(angularPath, 'src', 'assets', 'elements');
|
|
45
46
|
|
|
46
47
|
let installPath = process.cwd();
|
|
@@ -56,6 +57,7 @@ const getProjectPaths = (prj) => {
|
|
|
56
57
|
elementsPath: elementsPath,
|
|
57
58
|
installPath: installPath,
|
|
58
59
|
nodeModulesPath: nodeModulesPath,
|
|
60
|
+
assetsPath: assetsPath,
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
// locate and find the TSLint or ESLint configuration files
|
|
@@ -466,33 +466,39 @@ module.exports.getRemoteAllStats = () => {
|
|
|
466
466
|
}
|
|
467
467
|
})
|
|
468
468
|
.then(() => {
|
|
469
|
-
let remotesArray =
|
|
469
|
+
let remotesArray = [
|
|
470
|
+
...configUtils.remotes.getCsdrRemotesArray('my-workplace', '16.x'),
|
|
471
|
+
...configUtils.remotes.getCsdrRemotesArray('my-workplace', '15.x'),
|
|
472
|
+
];
|
|
473
|
+
|
|
470
474
|
remotesArray = tools.sortArray(remotesArray, 'name');
|
|
471
475
|
|
|
472
476
|
remotesArray.forEach((r) => {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
const remoteStats = {
|
|
487
|
-
name: r.name,
|
|
488
|
-
// versions: versionsMatadata.versions,
|
|
489
|
-
lastVersion,
|
|
490
|
-
summary: {
|
|
491
|
-
versionsCount,
|
|
492
|
-
versionsCountEnvs
|
|
477
|
+
try {
|
|
478
|
+
const remote = configUtils.remotes.getRemote(r.name);
|
|
479
|
+
const versionsMatadata = metadataUtils.packageVersions.getMetadataSync(remote);
|
|
480
|
+
let versionsCount = 0, versionsCountEnvs = { "DEV": 0, "TST": 0, "INT": 0, "ACC": 0, "TRN": 0, "PROD": 0}, lastVersion = {};
|
|
481
|
+
if (versionsMatadata.versions) {
|
|
482
|
+
versionsCount = versionsMatadata.versions.length;
|
|
483
|
+
versionsCountEnvs['DEV'] = versionsMatadata.versions.filter(v => v.envTarget === 'DEV').length;
|
|
484
|
+
versionsCountEnvs['TST'] = versionsMatadata.versions.filter(v => v.envTarget === 'TST').length;
|
|
485
|
+
versionsCountEnvs['INT'] = versionsMatadata.versions.filter(v => v.envTarget === 'INT').length;
|
|
486
|
+
versionsCountEnvs['ACC'] = versionsMatadata.versions.filter(v => v.envTarget === 'ACC').length;
|
|
487
|
+
versionsCountEnvs['TRN'] = versionsMatadata.versions.filter(v => v.envTarget === 'TRN').length;
|
|
488
|
+
versionsCountEnvs['PROD'] = versionsMatadata.versions.filter(v => v.envTarget === 'PROD').length;
|
|
489
|
+
lastVersion = versionsMatadata.versions.slice(-1).pop();
|
|
493
490
|
}
|
|
494
|
-
|
|
495
|
-
|
|
491
|
+
const remoteStats = {
|
|
492
|
+
name: r.name,
|
|
493
|
+
// versions: versionsMatadata.versions,
|
|
494
|
+
lastVersion,
|
|
495
|
+
summary: {
|
|
496
|
+
versionsCount,
|
|
497
|
+
versionsCountEnvs
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
stats.push(remoteStats);
|
|
501
|
+
} catch(e) {}
|
|
496
502
|
})
|
|
497
503
|
})
|
|
498
504
|
.then(() => {
|
package/scripts/index.js
CHANGED
|
@@ -48,7 +48,10 @@ module.exports.prebuildInjectionUtils = require('./utils/pre-build/injection/inj
|
|
|
48
48
|
module.exports.prebuildInjectionConfig = require('./utils/pre-build/injection/config');
|
|
49
49
|
module.exports.prebuildInjectionSkeletons = require('./utils/pre-build/injection/skeletons');
|
|
50
50
|
module.exports.prebuildInjectionExternals = require('./utils/pre-build/injection/externals');
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
// utils -pre-build - routes replacement
|
|
53
|
+
module.exports.prebuildRoutesReplacement = require('./utils/pre-build/routes-replacement/routes-replacement');
|
|
54
|
+
module.exports.prebuildRoutesReplacementSubs = require('./utils/pre-build/routes-replacement/routes-replacement-subs');
|
|
52
55
|
|
|
53
56
|
// utils -pre-build - translations
|
|
54
57
|
module.exports.prebuildTranslationUtils = require('./utils/pre-build/translations/translation-utils');
|
|
@@ -6,6 +6,7 @@ const tools = require('../tools');
|
|
|
6
6
|
|
|
7
7
|
const injectionUtils = require('./injection/injection-utils');
|
|
8
8
|
const translationUtils = require('./translations/translation-utils');
|
|
9
|
+
const routesReplacement = require('./routes-replacement/routes-replacement');
|
|
9
10
|
|
|
10
11
|
const configUtils = require('../../csdr/config/config-utils');
|
|
11
12
|
const svgUtils = require('../svg-utils');
|
|
@@ -89,12 +90,13 @@ module.exports.preBuild = (project, envTarget, build, configEnvTarget) => {
|
|
|
89
90
|
// replace app routes
|
|
90
91
|
.then(() => {
|
|
91
92
|
if (project.config && project.externalRoutesSources) {
|
|
92
|
-
return
|
|
93
|
+
return routesReplacement.buildRoutes(project, envTarget, build);
|
|
93
94
|
}
|
|
94
95
|
})
|
|
96
|
+
// generate remotes metadata during CI build of the host only (feeding the about page)
|
|
95
97
|
.then(() => {
|
|
96
|
-
if (project.config && project.externalRoutesSources) {
|
|
97
|
-
return
|
|
98
|
+
if (project.config && project.externalRoutesSources && build) {
|
|
99
|
+
return routesReplacement.extractRemotesMetadata(project, configEnvTarget);
|
|
98
100
|
}
|
|
99
101
|
})
|
|
100
102
|
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
const tools = require('../../tools');
|
|
6
|
+
const configUtils = require('../../../csdr/config/config-utils');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get the env target, transform input envTarget to known files suffix or handle local / playground file
|
|
10
|
+
*
|
|
11
|
+
* @param {string} envTargetIn The build-time environment target provided to target specific routes for specific environment deployments
|
|
12
|
+
* @param {boolean} build if the script is launched from a release pipeline OR from local CSDR playground environment (false in that case) * @return routeContent the text block transformed from the route object as input
|
|
13
|
+
* @returns {string} the envTarget transformed
|
|
14
|
+
*/
|
|
15
|
+
module.exports.getEnvTarget = (envTargetIn, build) => {
|
|
16
|
+
if (!envTargetIn) {
|
|
17
|
+
// check if envTarget has been provided as cli args for stand-alone local build of CSDR apps
|
|
18
|
+
const { envTarget } = tools.getArgs();
|
|
19
|
+
|
|
20
|
+
if (!envTarget) {
|
|
21
|
+
throw 'ENV_TARGET_NOT_FOUND';
|
|
22
|
+
} else {
|
|
23
|
+
envTargetIn = envTarget;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let envTargetFinal = envTargetIn.toLowerCase();
|
|
28
|
+
|
|
29
|
+
if (build) {
|
|
30
|
+
// dirty fix as openid files do not respect envTarget names
|
|
31
|
+
if (envTargetFinal === 'tst') {
|
|
32
|
+
envTargetFinal = 'test';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// serve configuration based
|
|
36
|
+
} else {
|
|
37
|
+
if (envTargetIn.indexOf('local') > -1) {
|
|
38
|
+
envTargetFinal = envTargetIn.replace('-openid', '');
|
|
39
|
+
} else {
|
|
40
|
+
envTargetFinal = 'local-' + envTargetFinal;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return envTargetFinal;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Replace route object and transform into an Angular / eUI route definition
|
|
52
|
+
*
|
|
53
|
+
* @param {route} route route object containing the result of the route translated into route props
|
|
54
|
+
* @returns {string} routeContent the text block transformed from the route object as input
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Get routes file of project
|
|
60
|
+
*
|
|
61
|
+
* PRIVATE
|
|
62
|
+
*
|
|
63
|
+
* @param {project} project The CSDR project object fetched from csdr global projects config
|
|
64
|
+
* @param {string} euiVersion the eUI version of the current project used mainly in local CSDR playground environment (format : v.x)
|
|
65
|
+
* @returns {string} routeContent the text block transformed from the route object as input
|
|
66
|
+
*/
|
|
67
|
+
module.exports.getRoutesFile = (project, euiVersion) => {
|
|
68
|
+
tools.logInfo('Getting routes file for replacement');
|
|
69
|
+
|
|
70
|
+
if (!project.externalRoutesSources) {
|
|
71
|
+
tools.logError('project requires externalRoutesSources definition');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
let routesFilePath;
|
|
76
|
+
let srcRoutesFilePath;
|
|
77
|
+
|
|
78
|
+
if (
|
|
79
|
+
!project.externalRoutesSources.routesConfigNpmPkg ||
|
|
80
|
+
!project.externalRoutesSources.routesFileSource ||
|
|
81
|
+
!project.externalRoutesSources.routesFilePath
|
|
82
|
+
) {
|
|
83
|
+
tools.logError('project requires externalRoutesSources.routesConfigNpmPkg, routesFileSources and routesFilePath definitions');
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// check if package is locally cloned
|
|
88
|
+
const localPackage = configUtils.packages.getPackages().filter((p) => {
|
|
89
|
+
return p.npmPkg === project.externalRoutesSources.routesConfigNpmPkg;
|
|
90
|
+
})[0];
|
|
91
|
+
|
|
92
|
+
// if local package is found
|
|
93
|
+
if (localPackage) {
|
|
94
|
+
tools.logInfo('local package found, copying from local');
|
|
95
|
+
|
|
96
|
+
tools.logInfo(`constructing route path with eUI version provided: ${euiVersion}`);
|
|
97
|
+
|
|
98
|
+
srcRoutesFilePath = path.join(
|
|
99
|
+
process.cwd(),
|
|
100
|
+
'packages',
|
|
101
|
+
localPackage.name,
|
|
102
|
+
'assets',
|
|
103
|
+
euiVersion,
|
|
104
|
+
project.externalRoutesSources.routesFileSource
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
// if not sources are taken from the npm package def in node_modules
|
|
108
|
+
} else {
|
|
109
|
+
tools.logInfo('remote package found, copying from remote');
|
|
110
|
+
const npmPkgScope = project.externalRoutesSources.routesConfigNpmPkg.substr(
|
|
111
|
+
0,
|
|
112
|
+
project.externalRoutesSources.routesConfigNpmPkg.indexOf('/')
|
|
113
|
+
);
|
|
114
|
+
const npmPkgName = project.externalRoutesSources.routesConfigNpmPkg.substr(
|
|
115
|
+
project.externalRoutesSources.routesConfigNpmPkg.indexOf('/') + 1
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
tools.logInfo(`constructing route path with eUI version provided: ${euiVersion}`);
|
|
119
|
+
|
|
120
|
+
srcRoutesFilePath = path.join(
|
|
121
|
+
process.cwd(),
|
|
122
|
+
'node_modules',
|
|
123
|
+
npmPkgScope,
|
|
124
|
+
npmPkgName,
|
|
125
|
+
'assets',
|
|
126
|
+
euiVersion,
|
|
127
|
+
project.externalRoutesSources.routesFileSource
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
routesFilePath = path.join(project.paths.rootPath, project.externalRoutesSources.routesFilePath);
|
|
132
|
+
|
|
133
|
+
// copy source file to project destination
|
|
134
|
+
tools.copy(srcRoutesFilePath, routesFilePath);
|
|
135
|
+
|
|
136
|
+
// checking is routes path declared
|
|
137
|
+
if (!tools.isFileExists(routesFilePath)) {
|
|
138
|
+
tools.logError(`Unable to find ${routesFilePath}`);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return routesFilePath;
|
|
143
|
+
};
|