@eui/tools 4.19.7 → 4.19.8

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
- 4.19.7
1
+ 4.19.8
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 4.19.8 (2022-02-16)
2
+
3
+ ##### Bug Fixes
4
+
5
+ * **other:**
6
+ * routes replacement for local-dev not taken into account - MWP-7941 [MWP-7941](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-7941) ([18a42cee](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/18a42ceeeb32aacf72fb2d441059ec91b6cef055))
7
+
8
+ * * *
9
+ * * *
1
10
  ## 4.19.7 (2022-02-13)
2
11
 
3
12
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "4.19.7",
3
+ "version": "4.19.8",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
package/sandbox.js CHANGED
@@ -649,5 +649,5 @@ return Promise.resolve()
649
649
  // })
650
650
  .then(() => {
651
651
  // return injectionUtils.externals.remapRoutesByEnvConfig(prj, 'DEV', true);
652
- return injectionUtils.routesReplacement.buildRoutes(prj, 'DEV', false);
652
+ return injectionUtils.routesReplacement.buildRoutes(prj, 'DEV', true);
653
653
  })
@@ -7,6 +7,29 @@ const tools = require('../../tools');
7
7
  const configUtils = require('../../../csdr/config/config-utils');
8
8
 
9
9
 
10
+ const getEnvTarget = (envTarget, build) => {
11
+ let envTargetFinal = envTarget.toLowerCase();
12
+
13
+ if (build) {
14
+ // dirty fix as openid files do not respect envTarget names
15
+ if (envTargetFinal === 'tst') {
16
+ envTargetFinal = 'test';
17
+ }
18
+
19
+ // serve configuration based
20
+ } else {
21
+ if (envTarget.indexOf('local') > -1) {
22
+ envTargetFinal = envTarget.replace('-openid', '');
23
+ } else {
24
+ envTargetFinal = 'local-' + envTargetFinal;
25
+ }
26
+ }
27
+
28
+ return envTargetFinal;
29
+ }
30
+
31
+
32
+
10
33
  const getEnvConfig = (project, envTarget, build) => {
11
34
  tools.logInfo(`Getting config file for env : ${envTarget}`);
12
35
 
@@ -14,25 +37,8 @@ const getEnvConfig = (project, envTarget, build) => {
14
37
  .then(() => {
15
38
  // getting config file
16
39
  const projectAssetsPath = path.join(process.cwd(), project.folder, 'src', 'assets');
17
- let configFile;
18
-
19
- // build - envTarget based
20
- if (build) {
21
- let envTargetFinal = envTarget.toLowerCase();
22
- // dirty fix as openid files do not respect envTarget names
23
- if (envTargetFinal === 'tst') {
24
- envTargetFinal = 'test';
25
- }
26
- configFile = path.join(projectAssetsPath, 'openid-login-config.' + envTargetFinal + '.json');
27
-
28
- // serve configuration based
29
- } else {
30
- if (envTarget.indexOf('local') > -1) {
31
- configFile = path.join(projectAssetsPath, 'openid-login-config.' + envTarget.replace('-openid', '') + '.json');
32
- } else {
33
- configFile = path.join(projectAssetsPath, 'openid-login-config.local-' + envTarget + '.json');
34
- }
35
- }
40
+ const envTargetFinal = getEnvTarget(envTarget, build);
41
+ const configFile = path.join(projectAssetsPath, 'openid-login-config.' + envTargetFinal + '.json');
36
42
 
37
43
  tools.logInfo(`checking ${configFile}`);
38
44
  if (!tools.isFileExists(configFile)) {
@@ -178,15 +184,15 @@ const replaceRoutes = (project, envTarget, build, routesFileContent) => {
178
184
 
179
185
  // getting env route defs content if build mode (not serve)
180
186
  let envRouteDefsPath, envRouteDefsJSON = [];
181
- if (build) {
182
- envRouteDefsPath = path.join(projectAssetsPath, 'route-defs.' + envTarget.toLowerCase() + '.json');
187
+ const envTargetFinal = getEnvTarget(envTarget, build);
183
188
 
184
- if (!tools.isFileExists(envRouteDefsPath)) {
185
- tools.logError(`${envRouteDefsPath} File NOT FOUND`);
186
- throw 'ENV_ROUTE_DEFS_FILE_NOT_FOUND';
187
- }
188
- envRouteDefsJSON = require(envRouteDefsPath);
189
+ envRouteDefsPath = path.join(projectAssetsPath, 'route-defs.' + envTargetFinal + '.json');
190
+
191
+ if (!tools.isFileExists(envRouteDefsPath)) {
192
+ tools.logError(`${envRouteDefsPath} File NOT FOUND`);
193
+ throw 'ENV_ROUTE_DEFS_FILE_NOT_FOUND';
189
194
  }
195
+ envRouteDefsJSON = require(envRouteDefsPath);
190
196
 
191
197
  // merging content of base + env
192
198
  tools.logInfo(`Merging ${baseRouteDefsPath} with ${envRouteDefsPath}`);