@eui/tools 6.11.24 → 6.11.26

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.11.24
1
+ 6.11.26
package/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## 6.11.26 (2023-06-05)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * saving of final remotes metadata for sub-remotes - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([9608db16](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/9608db1640a57e1ac709f9f84fd23d5590090a5e))
7
+ * adapted pre-build injection for openid and routes-replacement - extract remotes metadata for sub-remotes participants - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([1133ddd0](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/1133ddd0d52286e758dd22adae38feb0159cc7ab))
8
+
9
+ * * *
10
+ * * *
11
+ ## 6.11.25 (2023-06-02)
12
+
13
+ ##### Bug Fixes
14
+
15
+ * **other:**
16
+ * adapted generated metadata script when metadata for package are not existing for particular version set - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([23bd7f5f](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/23bd7f5f3c0bc719c42901a21c7147d37412305b))
17
+
18
+ * * *
19
+ * * *
1
20
  ## 6.11.24 (2023-06-01)
2
21
 
3
22
  ##### Bug Fixes
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const preBuildUtils = require('../../scripts/utils/pre-build/pre-build-utils');
3
+ const injectionUtils = require('../../scripts/utils/pre-build/injection/injection-utils');
4
4
  const tools = require('../../scripts/utils/tools');
5
5
  const configUtils = require('../../scripts/csdr/config/config-utils');
6
6
 
@@ -9,7 +9,7 @@ let { configEnvTarget } = tools.getArgs();
9
9
  Promise.resolve()
10
10
  .then(() => {
11
11
  const prj = configUtils.projects.getProject();
12
- return preBuildUtils.projects.injectAppConfig(prj, configEnvTarget);
12
+ return injectionUtils.openid.injectAppConfig(prj, configEnvTarget);
13
13
  })
14
14
  .catch((e) => {
15
15
  console.error(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.11.24",
3
+ "version": "6.11.26",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
package/sandbox.js CHANGED
@@ -1212,15 +1212,15 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
1212
1212
  // console.log(config);
1213
1213
  // })
1214
1214
 
1215
- // Promise.resolve()
1216
- // .then(() => {
1217
- // const prjName = 'my-workplace-host-playground';
1218
- // const project = configUtils.projects.getCsdrProject(prjName);
1219
- // return preBuildUtils.projects.preBuild(project, 'TST', true, 'TST');
1220
- // })
1221
- // .catch((e) => {
1222
- // console.log(e);
1223
- // })
1215
+ Promise.resolve()
1216
+ .then(() => {
1217
+ const prjName = 'my-workplace-host-playground';
1218
+ const project = configUtils.projects.getCsdrProject(prjName);
1219
+ return preBuildUtils.projects.preBuild(project, 'TST', true, 'cdn-tst');
1220
+ })
1221
+ .catch((e) => {
1222
+ console.log(e);
1223
+ })
1224
1224
 
1225
1225
  // Promise.resolve()
1226
1226
  // .then(() => {
@@ -1233,18 +1233,18 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
1233
1233
  // console.log(e);
1234
1234
  // })
1235
1235
 
1236
- const fromVersion = '4.0.0-ACC.0';
1237
- const toVersion = '4.0.0-ACC.1';
1238
- const pkg = configUtils.remotes.getRemote('cc-pmm-participants-eui15-remote-el-ui');
1236
+ // const fromVersion = '4.0.0-ACC.0';
1237
+ // const toVersion = '4.0.0-ACC.1';
1238
+ // const pkg = configUtils.remotes.getRemote('cc-pmm-participants-eui15-remote-el-ui');
1239
1239
 
1240
- Promise.resolve()
1241
- .then(() => {
1242
- return metadataUtils.packageHistory.generateDiffReport(pkg, 'ACC', fromVersion, toVersion);
1243
- })
1244
- .then((diffMetadata) => {
1245
- console.log(diffMetadata);
1246
- })
1247
- .catch((e) => {
1248
- console.log(e);
1249
- process.exit(1);
1250
- })
1240
+ // Promise.resolve()
1241
+ // .then(() => {
1242
+ // return metadataUtils.packageHistory.generateDiffReport(pkg, 'ACC', fromVersion, toVersion);
1243
+ // })
1244
+ // .then((diffMetadata) => {
1245
+ // console.log(diffMetadata);
1246
+ // })
1247
+ // .catch((e) => {
1248
+ // console.log(e);
1249
+ // process.exit(1);
1250
+ // })
@@ -104,26 +104,26 @@ module.exports.cloneHostPackage = (projectName) => {
104
104
 
105
105
  module.exports.installHostPackage = (projectName) => {
106
106
 
107
- const project = configUtils.projects.getProject(projectName);
108
-
109
- if (!project.hostPackage || project.externalSourcesOnInit === false) {
110
- return;
111
- }
112
-
113
- tools.logTitle('Installing host package');
114
-
115
- return Promise.resolve()
116
- .then(() => {
117
- const pkg = configUtils.packages.getPackageByNpmPkg(project.hostPackage, true);
118
- if (!pkg) {
119
- throw new Error('Invalid host package provided / unknown to CSDR config');
120
- }
121
- // return installUtils.projects.installHostPackage(project, pkg.npmPkg); // TODO
122
- })
123
-
124
- .catch((e) => {
125
- throw e;
126
- })
107
+ // TODO to be removed - only sources are pulled / not installed
108
+ // const project = configUtils.projects.getProject(projectName);
109
+
110
+ // if (!project.hostPackage || project.externalSourcesOnInit === false) {
111
+ // return;
112
+ // }
113
+
114
+ // tools.logTitle('Installing host package');
115
+
116
+ // return Promise.resolve()
117
+ // .then(() => {
118
+ // const pkg = configUtils.packages.getPackageByNpmPkg(project.hostPackage, true);
119
+ // if (!pkg) {
120
+ // throw new Error('Invalid host package provided / unknown to CSDR config');
121
+ // }
122
+ // })
123
+
124
+ // .catch((e) => {
125
+ // throw e;
126
+ // })
127
127
  }
128
128
 
129
129
 
@@ -160,13 +160,20 @@ const storeMetadataAssetsStandAlone = () => {
160
160
 
161
161
  packageDepsMetadata = Object.keys(deps).map((d) => {
162
162
  const pkg = configUtils.packages.getPackageByNpmPkg(d, true);
163
+ tools.logInfo(`getting pkg versions metadata for : ${pkg.name} / version: ${deps[d]}`);
163
164
  const pkgVersionMetadata = innerPackage.getVersionMetadata(pkg, deps[d]);
164
- return {
165
- npmPkg: d,
166
- repository: pkgVersionMetadata.name,
167
- version: pkgVersionMetadata.version,
168
- releaseDate: pkgVersionMetadata.date,
169
- buildDuration: pkgVersionMetadata.duration,
165
+
166
+ if (!pkgVersionMetadata) {
167
+ tools.logWarning(`===> version of pkg not found in metadata, probably caused by a failure of the package build`);
168
+
169
+ } else {
170
+ return {
171
+ npmPkg: d,
172
+ repository: pkgVersionMetadata.name,
173
+ version: pkgVersionMetadata.version,
174
+ releaseDate: pkgVersionMetadata.date,
175
+ buildDuration: pkgVersionMetadata.duration,
176
+ }
170
177
  }
171
178
  });
172
179
  })
@@ -281,7 +281,6 @@ module.exports.getLastMajorVersion = (pkg, major, isMaster) => {
281
281
  module.exports.getVersionMetadata = (pkg, version) => {
282
282
  const pkgVersions = this.getPackageVersions(pkg);
283
283
  if (pkgVersions) {
284
- console.log(pkgVersions);
285
284
  return pkgVersions.filter((v) => {
286
285
  return v.version === version
287
286
  })[0];
@@ -83,8 +83,8 @@ module.exports.build = (pkg, isMaster) => {
83
83
  return tools.runNodeScriptProcessOutput(args, pkg.paths.root);
84
84
 
85
85
  } else {
86
- return execa('node', args, { cwd: pkg.paths.root, stdio: 'inherit' });
87
- }
86
+ return execa('node', args, { cwd: pkg.paths.root, stdio: 'inherit' });
87
+ }
88
88
  }
89
89
  })
90
90
 
@@ -118,7 +118,7 @@ module.exports.postBuild = (pkg, version) => {
118
118
  })
119
119
 
120
120
  .then(() => {
121
- return remotesUtils.concatFiles(path.join(pkg.paths.dist, 'bundles'), euiVersionNumber);
121
+ return remotesUtils.concatFiles(pkg, path.join(pkg.paths.dist, 'bundles'), euiVersionNumber);
122
122
  })
123
123
 
124
124
  .then(() => {
@@ -1,13 +1,8 @@
1
1
  'use strict';
2
2
 
3
- // inner modules
4
- const innerConfig = require('./config');
5
- const innerSkeletons = require('./skeletons');
6
- const innerExternals = require('./externals');
7
- const innerRoutesReplacement = require('./routes-replacement');
8
-
9
3
  // re-exports inner modules
10
- module.exports.config = innerConfig;
11
- module.exports.skeletons = innerSkeletons;
12
- module.exports.externals = innerExternals;
13
- module.exports.routesReplacement = innerRoutesReplacement;
4
+ module.exports.config = require('./config');
5
+ module.exports.skeletons = require('./skeletons');
6
+ module.exports.externals = require('./externals');
7
+ module.exports.routesReplacement = require('./routes-replacement');
8
+ module.exports.openid = require('./openid');
@@ -0,0 +1,122 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+
5
+ const tools = require('../../tools');
6
+
7
+ let { openid } = tools.getArgs();
8
+
9
+ module.exports.injectConfig = (project, configEnvTarget) => {
10
+ return (
11
+ Promise.resolve()
12
+
13
+ .then(() => {
14
+ tools.logTitle('PRE-BUILD : preparing the project...');
15
+ })
16
+
17
+ // openId files replacement
18
+ .then(() => {
19
+ if ((project.build && project.build.openid) || openid) {
20
+ tools.logInfo('Executing scripts files replacement for openId Connect');
21
+
22
+ const nodeModulesPath = project.paths.nodeModulesPath;
23
+ let rootTargetFolder = 'src';
24
+
25
+ tools.logInfo(`Copying ${nodeModulesPath}/oidc-client/dist/oidc-client.min.js to ${rootTargetFolder}/assets/oidc-client.min.js`);
26
+ tools.copy(
27
+ path.join(nodeModulesPath, '/oidc-client/dist/oidc-client.min.js'),
28
+ path.join(project.paths.angularPath, `${rootTargetFolder}/assets/oidc-client.min.js`)
29
+ );
30
+ tools.logSuccess();
31
+
32
+ tools.logInfo(`Copying ${nodeModulesPath}/jsrsasign/lib/jsrsasign-all-min.js to ${rootTargetFolder}/assets/jsrsasign-all-min.js`);
33
+ tools.copy(
34
+ path.join(nodeModulesPath, '/jsrsasign/lib/jsrsasign-all-min.js'),
35
+ path.join(project.paths.angularPath, `${rootTargetFolder}/assets/jsrsasign-all-min.js`)
36
+ );
37
+ tools.logSuccess();
38
+
39
+ let { configuration } = tools.getArgs();
40
+ if (configuration !== 'proxy-mock') {
41
+ if (project.build && project.build.providedOpenidLoginScript) {
42
+ tools.logInfo(`Provided openid-login.js script...skipping copy from eUI distribution`);
43
+
44
+ } else {
45
+ tools.logInfo(`Copying ${nodeModulesPath}/@eui/base/assets/openid/openid-login.js to ${rootTargetFolder}/assets/openid-login.js`);
46
+ tools.copy(
47
+ path.join(nodeModulesPath, '/@eui/base/assets/openid/openid-login.js'),
48
+ path.join(project.paths.angularPath, `${rootTargetFolder}/assets/openid-login.js`)
49
+ );
50
+ }
51
+ } else {
52
+ tools.logInfo(`Clearing ${rootTargetFolder}/assets/openid-login.js`);
53
+ tools.writeFileContent(
54
+ path.join(project.paths.angularPath, `${rootTargetFolder}/assets/openid-login.js`),
55
+ ''
56
+ );
57
+ }
58
+ tools.logSuccess();
59
+ }
60
+ })
61
+
62
+ // injection config based on configEnvTarget (for openid files replacement)
63
+ .then(() => {
64
+ return injectAppConfig(project, configEnvTarget);
65
+ })
66
+
67
+ .catch((e) => {
68
+ throw e;
69
+ })
70
+ );
71
+ };
72
+
73
+ // extracted from main openid injectConfig above as this can be called stand-alone using bin/eui-scripts
74
+
75
+ const injectAppConfig = (module.exports.injectAppConfig = (project, configEnvTarget) => {
76
+ return Promise.resolve()
77
+ .then(() => {
78
+ // set default if not envTarget provided
79
+ let envFilePath = path.join(project.paths.angularPath, 'src/assets/config', `env-json-config.json`);
80
+
81
+ if (configEnvTarget) {
82
+ tools.logInfo(`Executing configuration replacement for : ${configEnvTarget} environment`);
83
+
84
+ let envOpenidPrefix = 'env-json-config-';
85
+ if (project.build && project.build.envOpenidPrefix) {
86
+ envOpenidPrefix = project.build.envOpenidPrefix;
87
+ }
88
+
89
+ let openidConfigAssetsFolder = 'assets/config';
90
+ if (project.build && project.build.openidConfigAssetsFolder) {
91
+ openidConfigAssetsFolder = project.build.openidConfigAssetsFolder;
92
+ }
93
+ envFilePath = path.join(project.paths.angularPath, `src/${openidConfigAssetsFolder}`, `${envOpenidPrefix}${configEnvTarget}.json`);
94
+ }
95
+
96
+ if (project.build && project.build.customEnvJsonConfigInjection) {
97
+ return;
98
+ }
99
+ if (!tools.isFileExists(envFilePath)) {
100
+ tools.logError(`Cannot find environment config to inject : `);
101
+ tools.logError(`${envFilePath} missing...`);
102
+ return;
103
+ }
104
+
105
+ let rootTargetFolder = 'src';
106
+ let replacedFile;
107
+
108
+ if ((project.build && project.build.openid) || openid) {
109
+ replacedFile = `${rootTargetFolder}/assets/openid-login-config.json`;
110
+ } else {
111
+ replacedFile = `${rootTargetFolder}/assets/env-json-config.json`;
112
+ }
113
+ tools.logInfo(`Replacing default ${replacedFile} file by ${envFilePath} content`);
114
+ tools.copy(envFilePath, path.join(project.paths.angularPath, `${replacedFile}`));
115
+
116
+ tools.logSuccess();
117
+ })
118
+
119
+ .catch((e) => {
120
+ throw e;
121
+ });
122
+ });
@@ -624,3 +624,53 @@ const injectRoutesConfig = (project, npmPkg) => {
624
624
  tools.logInfo(`${routesConfigPath} - injecting in ${projectAssetsPath}`);
625
625
  tools.copydir(routesConfigPath, projectAssetsPath);
626
626
  };
627
+
628
+
629
+ module.exports.extractRemotesMetadata = (project) => {
630
+ tools.logTitle('Extracting remotes-metadata.json for known participant remotes');
631
+
632
+ const projectAssetsPath = path.join(process.cwd(), project.folder, 'src', 'assets');
633
+
634
+ const finalRemotesDefsFile = path.join(projectAssetsPath, 'remotes-metadata.json');
635
+ const openidConfigFile = path.join(projectAssetsPath, 'openid-login-config.json');
636
+
637
+ let remoteMetadataJSON = tools.getJsonFileContent(finalRemotesDefsFile);
638
+ const openidConfigJSON = tools.getJsonFileContent(openidConfigFile);
639
+
640
+ remoteMetadataJSON.forEach((r) => {
641
+ tools.logInfo(`Fetching remote info for : ${r}`);
642
+
643
+ let remote;
644
+ if (configUtils.remotes.isVirtualRemote(r)) {
645
+ remote = configUtils.remotes.getRemote(r);
646
+ } else {
647
+ remote = configUtils.packages.getPackage(r, true);
648
+ }
649
+
650
+ if (remote.build && remote.build.hasParticipants) {
651
+ let participantsList;
652
+ if (remote.euiVersion === '15.x') {
653
+ participantsList = openidConfigJSON.modules[remote.build.configModuleName].participants_v15
654
+ } else {
655
+ participantsList = openidConfigJSON.modules[remote.build.configModuleName].participants
656
+ }
657
+ if (participantsList) {
658
+ let participantRemotes = [];
659
+ Object.keys(participantsList).forEach((p) => {
660
+ participantRemotes.push(participantsList[p].moduleId);
661
+ });
662
+ tools.logInfo('Found participant remotes : ');
663
+ console.log(participantRemotes);
664
+
665
+ remoteMetadataJSON = [...remoteMetadataJSON, ...participantRemotes];
666
+ }
667
+ }
668
+ })
669
+
670
+ remoteMetadataJSON = tools.removeArrayDuplicates(remoteMetadataJSON);
671
+
672
+ tools.logInfo('Final remotes metadata list found :');
673
+ console.log(remoteMetadataJSON);
674
+
675
+ tools.writeJsonFileSync(finalRemotesDefsFile, remoteMetadataJSON);
676
+ }
@@ -10,15 +10,14 @@ const translationUtils = require('./translations/translation-utils');
10
10
  const configUtils = require('../../csdr/config/config-utils');
11
11
  const svgUtils = require('../svg-utils');
12
12
 
13
- let { openid, dryRun } = tools.getArgs();
14
-
13
+ let { dryRun } = tools.getArgs();
15
14
 
16
15
  module.exports.preBuild = (project, envTarget, build, configEnvTarget) => {
17
16
 
18
17
  return Promise.resolve()
19
18
 
20
19
  .then(() => {
21
- tools.logTitle('PRE-BUILD : preparing the project...')
20
+ tools.logTitle('PRE-BUILD : preparing the project...');
22
21
  })
23
22
 
24
23
  // inject external app sources declaration
@@ -59,13 +58,6 @@ module.exports.preBuild = (project, envTarget, build, configEnvTarget) => {
59
58
  }
60
59
  })
61
60
 
62
-
63
- .then(() => {
64
- if (project.config && project.externalRoutesSources) {
65
- return injectionUtils.routesReplacement.buildRoutes(project, envTarget, build);
66
- }
67
- })
68
-
69
61
  // inject skeleton sources
70
62
  .then(() => {
71
63
  if (project.csdrSkeleton) {
@@ -89,65 +81,28 @@ module.exports.preBuild = (project, envTarget, build, configEnvTarget) => {
89
81
  }
90
82
  })
91
83
 
92
-
93
- // openId files replacement
84
+ // openId files replacement and app config injection
94
85
  .then(() => {
95
- if ((project.build && project.build.openid) || openid) {
96
- tools.logInfo('Executing scripts files replacement for openId Connect');
97
-
98
- const nodeModulesPath = project.paths.nodeModulesPath;
99
- let rootTargetFolder = 'src';
100
-
101
- tools.logInfo(`Copying ${nodeModulesPath}/oidc-client/dist/oidc-client.min.js to ${rootTargetFolder}/assets/oidc-client.min.js`);
102
- tools.copy(
103
- path.join(nodeModulesPath, '/oidc-client/dist/oidc-client.min.js'),
104
- path.join(project.paths.angularPath, `${rootTargetFolder}/assets/oidc-client.min.js`)
105
- );
106
- tools.logSuccess();
107
-
108
- tools.logInfo(`Copying ${nodeModulesPath}/jsrsasign/lib/jsrsasign-all-min.js to ${rootTargetFolder}/assets/jsrsasign-all-min.js`);
109
- tools.copy(
110
- path.join(nodeModulesPath, '/jsrsasign/lib/jsrsasign-all-min.js'),
111
- path.join(project.paths.angularPath, `${rootTargetFolder}/assets/jsrsasign-all-min.js`)
112
- );
113
- tools.logSuccess();
114
-
115
- let { configuration } = tools.getArgs();
116
- if (configuration !== 'proxy-mock') {
117
- if (project.build && project.build.providedOpenidLoginScript) {
118
- tools.logInfo(`Provided openid-login.js script...skipping copy from eUI distribution`);
86
+ return injectionUtils.openid.injectConfig(project, configEnvTarget);
87
+ })
119
88
 
120
- } else {
121
- tools.logInfo(`Copying ${nodeModulesPath}/@eui/base/assets/openid/openid-login.js to ${rootTargetFolder}/assets/openid-login.js`);
122
- tools.copy(
123
- path.join(nodeModulesPath, '/@eui/base/assets/openid/openid-login.js'),
124
- path.join(project.paths.angularPath, `${rootTargetFolder}/assets/openid-login.js`)
125
- );
126
- }
127
- } else {
128
- tools.logInfo(`Clearing ${rootTargetFolder}/assets/openid-login.js`);
129
- tools.writeFileContent(
130
- path.join(project.paths.angularPath, `${rootTargetFolder}/assets/openid-login.js`),
131
- ''
132
- );
133
- }
134
- tools.logSuccess();
89
+ // replace app routes
90
+ .then(() => {
91
+ if (project.config && project.externalRoutesSources) {
92
+ return injectionUtils.routesReplacement.buildRoutes(project, envTarget, build);
135
93
  }
136
94
  })
137
-
138
-
139
- // injection config based on configEnvTarget (for openid files replacement)
140
95
  .then(() => {
141
- return this.injectAppConfig(project, configEnvTarget);
96
+ if (project.config && project.externalRoutesSources) {
97
+ return injectionUtils.routesReplacement.extractRemotesMetadata(project, configEnvTarget);
98
+ }
142
99
  })
143
100
 
144
-
145
101
  // processing custom script injection if enabled in project config
146
102
  .then(() => {
147
103
  return this.processCustomEnvScriptInjection(project, envTarget);
148
104
  })
149
105
 
150
-
151
106
  // checking if project as own pre-build.js script defined, and executing it
152
107
  .then(() => {
153
108
  const prebuildScript = path.join(project.paths.rootPath, 'pre-build.js');
@@ -156,7 +111,6 @@ module.exports.preBuild = (project, envTarget, build, configEnvTarget) => {
156
111
  tools.logInfo('Executing pre-build script');
157
112
 
158
113
  return tools.runScript(`node ${prebuildScript}`);
159
-
160
114
  } else {
161
115
  tools.logInfo('DRY-RUN or pre-build script not found in project folder --- skipping');
162
116
  }
@@ -165,57 +119,7 @@ module.exports.preBuild = (project, envTarget, build, configEnvTarget) => {
165
119
  .catch((e) => {
166
120
  throw e;
167
121
  })
168
- }
169
-
170
-
171
- module.exports.injectAppConfig = (project, configEnvTarget) => {
172
- return Promise.resolve()
173
- .then(() => {
174
- // set default if not envTarget provided
175
- let envFilePath = path.join(project.paths.angularPath, 'src/assets/config', `env-json-config.json`);;
176
-
177
- if (configEnvTarget) {
178
- tools.logInfo(`Executing configuration replacement for : ${configEnvTarget} environment`);
179
-
180
- let envOpenidPrefix = 'env-json-config-';
181
- if (project.build && project.build.envOpenidPrefix) {
182
- envOpenidPrefix = project.build.envOpenidPrefix;
183
- }
184
-
185
- let openidConfigAssetsFolder = 'assets/config';
186
- if (project.build && project.build.openidConfigAssetsFolder) {
187
- openidConfigAssetsFolder = project.build.openidConfigAssetsFolder;
188
- }
189
- envFilePath = path.join(project.paths.angularPath, `src/${openidConfigAssetsFolder}`, `${envOpenidPrefix}${configEnvTarget}.json`);
190
- }
191
-
192
- if (project.build && project.build.customEnvJsonConfigInjection) {
193
- return;
194
- }
195
- if (!tools.isFileExists(envFilePath)) {
196
- tools.logError(`Cannot find environment config to inject : `);
197
- tools.logError(`${envFilePath} missing...`);
198
- return;
199
- }
200
-
201
- let rootTargetFolder = 'src';
202
- let replacedFile;
203
-
204
- if ((project.build && project.build.openid) || openid) {
205
- replacedFile = `${rootTargetFolder}/assets/openid-login-config.json`;
206
- } else {
207
- replacedFile = `${rootTargetFolder}/assets/env-json-config.json`;
208
- }
209
- tools.logInfo(`Replacing default ${replacedFile} file by ${envFilePath} content`);
210
- tools.copy(envFilePath, path.join(project.paths.angularPath, `${replacedFile}`));
211
-
212
- tools.logSuccess();
213
- })
214
-
215
- .catch((e) => {
216
- throw e;
217
- })
218
- }
122
+ };
219
123
 
220
124
 
221
125
  module.exports.processCustomEnvScriptInjection = (project, envTarget) => {
@@ -224,11 +128,10 @@ module.exports.processCustomEnvScriptInjection = (project, envTarget) => {
224
128
  if (project.build && project.build.customEnvScriptInjection) {
225
129
  tools.logInfo(`Processing custom script injection for ${project.name} - envTarget: ${envTarget}`);
226
130
 
227
- const scriptName = project.build.customEnvScriptInjection[(envTarget.toLowerCase())];
131
+ const scriptName = project.build.customEnvScriptInjection[envTarget.toLowerCase()];
228
132
  if (!scriptName) {
229
133
  tools.logWarning('Unable to find script replacement definition for envTarget...skipping');
230
134
  return;
231
-
232
135
  } else {
233
136
  tools.logInfo(`Script to replace : ${scriptName}`);
234
137
  const injectedScript = `<script type="text/javascript" src="${scriptName}" crossorigin="anonymous"></script>`;
@@ -236,12 +139,7 @@ module.exports.processCustomEnvScriptInjection = (project, envTarget) => {
236
139
  const fileToReplace = path.join(project.paths.angularPath, 'src', 'index.html');
237
140
 
238
141
  if (tools.isFileExists(fileToReplace)) {
239
- return tools.replaceInFile(
240
- fileToReplace,
241
- placeholderToReplace,
242
- injectedScript
243
- );
244
-
142
+ return tools.replaceInFile(fileToReplace, placeholderToReplace, injectedScript);
245
143
  } else {
246
144
  tools.logWarning(`Source replacement file does not exist : ${fileToReplace}`);
247
145
  }
@@ -251,9 +149,8 @@ module.exports.processCustomEnvScriptInjection = (project, envTarget) => {
251
149
 
252
150
  .catch((e) => {
253
151
  throw e;
254
- })
255
- }
256
-
152
+ });
153
+ };
257
154
 
258
155
  module.exports.processSvgAssets = (project) => {
259
156
  return Promise.resolve()
@@ -267,5 +164,5 @@ module.exports.processSvgAssets = (project) => {
267
164
 
268
165
  .catch((e) => {
269
166
  throw e;
270
- })
271
- }
167
+ });
168
+ };
@@ -8,7 +8,7 @@ const concat = require('concat');
8
8
  const tools = require('../tools');
9
9
 
10
10
 
11
- module.exports.concatFiles = (workingPath, euiVersionNumber = 10) => {
11
+ module.exports.concatFiles = (pkg, workingPath, euiVersionNumber = 10) => {
12
12
  return Promise.resolve()
13
13
  .then(() => {
14
14
  tools.logInfo('Concatening JS files to main.js');
@@ -30,6 +30,13 @@ module.exports.concatFiles = (workingPath, euiVersionNumber = 10) => {
30
30
  return concat(files, outFilePath);
31
31
  })
32
32
 
33
+ // TODO
34
+ // .then(() => {
35
+ // tools.logInfo('Checking elements assets replacement for non-mwp app delivery (sedia, ...)');
36
+
37
+ // const mainFileContent = tools.getFileContent(path.join(workingPath, 'main.js'));
38
+ // })
39
+
33
40
  .catch((e) => {
34
41
  throw e;
35
42
  })
@@ -98,7 +98,7 @@ module.exports.serve = (remote = false) => {
98
98
  })
99
99
 
100
100
  .then(() => {
101
- return remotesUtils.concatFiles(destPath, euiVersionNumber);
101
+ return remotesUtils.concatFiles(pkg, destPath, euiVersionNumber);
102
102
  })
103
103
 
104
104
  .then(() => {