@eui/tools 6.7.1 → 6.7.3

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.7.1
1
+ 6.7.3
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 6.7.3 (2023-03-09)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * added remotes stat for all envs - MWP-9204 [MWP-9204](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9204) ([17ada3ed](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/17ada3edeb3e42a18ec542e809bd64bdec5abf67))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.7.2 (2023-03-07)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * mwp v15 custom installation - Phase 2 - WIP - MWP-9204 [MWP-9204](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9204) ([981bfc57](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/981bfc575501099c0d7d1479042ce22d5118918d))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 6.7.1 (2023-03-06)
2
20
 
3
21
  ##### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.7.1",
3
+ "version": "6.7.3",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -35,7 +35,7 @@
35
35
  <div class="row mb-3">
36
36
  <label class="col-sm-2 col-form-label">App</label>
37
37
  <div class="col-sm-10">
38
- <select disabled class="form-select" v-model="selectedApp">
38
+ <select disabled class="form-select" v-model="selectedProject">
39
39
  <option value="my-workplace">MyWorkplace</option>
40
40
  </select>
41
41
  </div>
@@ -87,7 +87,7 @@
87
87
  type="checkbox"
88
88
  :value="remote.name"
89
89
  :id="remote.name"
90
- v-model="selectedLocalRemotes" />
90
+ v-model="selectedRemotes" />
91
91
  </div>
92
92
  </td>
93
93
  <td>
@@ -109,9 +109,9 @@
109
109
  <div class="col-6">
110
110
  <h5 class="mt-5 mb-3">
111
111
  Selected local remotes (intialized as sources):
112
- <span class="text-primary fw-bold">{{ selectedLocalRemotes.length }}</span>
112
+ <span class="text-primary fw-bold">{{ selectedRemotes.length }}</span>
113
113
  </h5>
114
- {{ selectedLocalRemotes }}
114
+ {{ selectedRemotes }}
115
115
  <h5 class="mt-5 mb-3">
116
116
  Selected local remotes (intialized as dependencies):
117
117
  <span class="text-primary fw-bold">{{ selectedInstalledRemotes.length }}</span>
@@ -135,7 +135,7 @@
135
135
  <button
136
136
  class="btn btn-primary"
137
137
  type="button"
138
- :disabled="selectedLocalRemotes.length === 0 && selectedInstalledRemotes.length === 0"
138
+ :disabled="selectedRemotes.length === 0 && selectedInstalledRemotes.length === 0"
139
139
  @click="saveConfig()">
140
140
  Save configuration
141
141
  </button>
@@ -12,10 +12,10 @@ new Vue({
12
12
  el: "#app",
13
13
  data() {
14
14
  return {
15
- selectedApp: "my-workplace-host-playground-custom",
15
+ selectedProject: "my-workplace-host-playground-custom",
16
16
  selectedEuiVersion: "15.x",
17
17
  remotes: [],
18
- selectedLocalRemotes: [],
18
+ selectedRemotes: [],
19
19
  selectedInstalledRemotes: [],
20
20
  deps: [],
21
21
  packages: [],
@@ -38,9 +38,9 @@ new Vue({
38
38
  const finalRes = await res.json();
39
39
 
40
40
  if (Object.keys(finalRes).length !== 0) {
41
- this.selectedApp = finalRes.app;
41
+ this.selectedApp = finalRes.project;
42
42
  this.selectedEuiVersion = finalRes.euiVersion;
43
- this.selectedLocalRemotes = finalRes.localRemotes;
43
+ this.selectedLocalRemotes = finalRes.remotes;
44
44
  this.selectedInstalledRemotes = finalRes.installedRemotes;
45
45
  this.deps = finalRes.deps;
46
46
  this.packages = finalRes.packages;
@@ -67,9 +67,9 @@ new Vue({
67
67
  const res = await fetch(
68
68
  "http://localhost:3000/api/config",
69
69
  getRequestBody({
70
- app: this.selectedApp,
70
+ project: this.selectedProject,
71
71
  euiVersion: this.selectedEuiVersion,
72
- localRemotes: this.selectedLocalRemotes,
72
+ remotes: this.selectedRemotes,
73
73
  installedRemotes: this.selectedInstalledRemotes,
74
74
  deps: this.deps,
75
75
  packages: this.packages,
@@ -15,6 +15,47 @@ const innerGlobal = require('./global');
15
15
 
16
16
 
17
17
  module.exports.run = (args) => {
18
+ return Promise.resolve()
19
+ .then(() => {
20
+ if (args.custom) {
21
+ return initConfigCustom();
22
+
23
+ } else {
24
+ return initConfigCore(args);
25
+ }
26
+ })
27
+
28
+ .catch((e) => {
29
+ throw e;
30
+ })
31
+ }
32
+
33
+
34
+ const initConfigCustom = () => {
35
+ return Promise.resolve()
36
+ .then(() => {
37
+ tools.logInfo('Updating local configuration - custom init');
38
+
39
+ const customConfig = innerGlobal.getCustomConfig();
40
+
41
+ if (!customConfig) {
42
+ throw new Error('Custom config not found... run the command "npm run init:custom" to generate your customized config');
43
+ }
44
+
45
+ return innerGlobal.updateConfig({
46
+ project: customConfig.project,
47
+ packages: customConfig.packages,
48
+ remotes: customConfig.remotes,
49
+ reset: true
50
+ });
51
+ })
52
+ .catch((e) => {
53
+ throw e;
54
+ })
55
+ }
56
+
57
+
58
+ const initConfigCore = (args) => {
18
59
  return Promise.resolve()
19
60
  .then(() => {
20
61
  tools.logInfo('Updating local configuration')
@@ -28,14 +69,13 @@ module.exports.run = (args) => {
28
69
 
29
70
  if (args.remote) {
30
71
  const remote = innerRemotes.getCsdrRemotes()[args.remote];
31
- if (remote) {
72
+ if (remote) {
32
73
  remotes.push(args.remote);
33
74
  }
34
75
  }
35
76
 
36
77
  return innerGlobal.updateConfig({ project: args.project, packages: packages, remotes: remotes, reset: args.reset });
37
78
  })
38
-
39
79
  .catch((e) => {
40
80
  throw e;
41
81
  })
@@ -44,6 +84,9 @@ module.exports.run = (args) => {
44
84
 
45
85
 
46
86
 
87
+
88
+
89
+
47
90
  const getInputPackages = (project, pkg, team, prjOnly, containerOnly) => {
48
91
  tools.logInfo('Gathering team packages');
49
92
 
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+
3
+ const tools = require('../../utils/tools');
4
+ const configUtils = require('../config/config-utils');
5
+
6
+ const innerInitProject = require('./init-project');
7
+ const innerRemotes = require('./remotes');
8
+ const innerPackages = require('./packages');
9
+
10
+ const { skipInstall, build } = tools.getArgs();
11
+
12
+
13
+ let customConfig;
14
+
15
+ module.exports.init = (finalResponse) => {
16
+ return Promise.resolve()
17
+ .then(() => {
18
+ customConfig = configUtils.global.getCustomConfig();
19
+ if (!customConfig) {
20
+ throw new Error('Custom config not found... run the command "npm run init:custom" to generate your customized config');
21
+ }
22
+ })
23
+
24
+ .then(() => {
25
+ finalResponse.project = customConfig.project;
26
+ finalResponse.euiVersion = customConfig.euiVersion;
27
+
28
+ return innerInitProject.init(finalResponse);
29
+ })
30
+
31
+ .then(() => {
32
+ return customConfig.remotes.reduce((promise, remote) => {
33
+ return promise.then(() => (
34
+ innerRemotes.generateVirtualRemote(remote)
35
+ ));
36
+ }, Promise.resolve());
37
+ })
38
+
39
+ .then(() => {
40
+ return innerPackages.importPackages(finalResponse);
41
+ })
42
+
43
+ .then(() => {
44
+ // this is only executed for local dev installation,
45
+ // in case of release the initialisation is managed by the application / package themselves
46
+ if (!build && !skipInstall) {
47
+ return installUtils.localDev.install();
48
+ }
49
+ })
50
+
51
+ .catch((e) => {
52
+ throw e;
53
+ });
54
+ }
@@ -0,0 +1,210 @@
1
+ 'use strict';
2
+
3
+ const tools = require('../../utils/tools');
4
+ const initUtils = require('./init-utils');
5
+ const installUtils = require('../install/install-utils');
6
+ const configUtils = require('../config/config-utils');
7
+
8
+ // Getting arguments if they are provided for the CI/CD pipeline
9
+ const {
10
+ project, team, pkg, branch, configOnly, skipClone, skipInstall, reset, pkgOnly, prjOnly,
11
+ build, containerOnly, skipAppContainers, remote, euiVersion, remoteOnly, remoteBuild, virtual, custom
12
+ } = tools.getArgs();
13
+
14
+
15
+ module.exports.init = () => {
16
+ // Initializing a common response
17
+ const initialResponse = {
18
+ project: project || null,
19
+ team: team || 'all',
20
+ pkg: pkg || null,
21
+ remote: remote || null,
22
+ remoteBuild: remoteBuild || false,
23
+ virtual: virtual || false,
24
+ euiVersion: euiVersion || null,
25
+ branch: branch || 'develop',
26
+ configOnly: configOnly || false,
27
+ skipClone: skipClone || false,
28
+ reset: reset || false,
29
+ pkgOnly: pkgOnly || false,
30
+ prjOnly: prjOnly || false,
31
+ remoteOnly: remoteOnly || false,
32
+ build: build || false,
33
+ containerOnly: containerOnly || false,
34
+ skipAppContainers: skipAppContainers || false,
35
+ custom: custom || false
36
+ }
37
+
38
+ // converting inputs args
39
+ initialResponse.branch = tools.convertStringArg(initialResponse.branch, 'develop');
40
+ initialResponse.euiVersion = tools.convertStringArg(initialResponse.euiVersion);
41
+ initialResponse.remoteBuild = tools.convertBooleanArg(initialResponse.remoteBuild);
42
+ initialResponse.virtual = tools.convertBooleanArg(initialResponse.virtual);
43
+
44
+
45
+ // setting project to null if forced to NONE
46
+ if (initialResponse.project === 'NONE') {
47
+ initialResponse.project = null;
48
+ }
49
+
50
+ // swapping to remote build if virtual remote is pass to default gitlab call
51
+ if (initialResponse.remoteBuild && initialResponse.pkg && initialResponse.virtual) {
52
+ initialResponse.remote = initialResponse.pkg;
53
+ initialResponse.pkg = null;
54
+ }
55
+
56
+
57
+ // Storing the response for propagation
58
+ let finalResponse;
59
+
60
+ return Promise.resolve()
61
+ .then(() => {
62
+
63
+ // if no project has been provided we prompt for project and team selection
64
+ if (!project && !pkg && !remote && !custom ) {
65
+ // TODO refactor to handle dynamic mywp-host-playground install (pre-remotes install etc...)
66
+ // return initUtils.prompt.start();
67
+ tools.logError('****************************************');
68
+ tools.logError('*************** ERROR ******************');
69
+ tools.logError('****************************************\n');
70
+ tools.logError('At least "pkg" or "project" or "remote" type should be used for init, for example :\n');
71
+ tools.logError('npm run init -- --pkg PKG_NAME [--branch BRANCH_NAME|default develop] [--git local] [--pkgOnly] [--skipInstall]');
72
+ tools.logError('npm run init -- --project PROJECT_NAME [--branch BRANCH_NAME|default develop] [--git local] [--prjOnly] [--skipInstall]');
73
+ tools.logError('npm run init -- --remote VIRTUAL_REMOTE_NAME [--remoteOnly] [--skipInstall]');
74
+ tools.logError('npm run init -- --custom [--skipInstall] [--git local]');
75
+ process.exit(0);
76
+
77
+ // if provided, we are on automated mode, we use the initialized response
78
+ } else {
79
+ return initialResponse;
80
+ }
81
+ })
82
+
83
+ // merge with response found from prompts
84
+ .then((response) => {
85
+ finalResponse = { ...initialResponse, ...response };
86
+
87
+ tools.logInfo('Configuration generated based on provided args:');
88
+ console.log(finalResponse);
89
+ })
90
+
91
+ // Initializing .euirc.json local file - the core of CSDR operations
92
+ .then(() => {
93
+ // Initialize config
94
+ return configUtils.init.run(finalResponse);
95
+ })
96
+
97
+ // clone or install linked host package to project if any
98
+ .then(() => {
99
+ // TODO
100
+ // if (finalResponse.project && !build) {
101
+ if (finalResponse.project) {
102
+ return initUtils.packages.cloneHostPackage(finalResponse.project);
103
+ }
104
+ // TODO
105
+ // } else if (finalResponse.project && build) {
106
+ // return initUtils.packages.installHostPackage(finalResponse.project);
107
+ // }
108
+ })
109
+
110
+ // Initializing .meta based on .euirc.json for local respoisitories cloning
111
+ .then(() => {
112
+ if (!finalResponse.remote) {
113
+ return initUtils.meta.init();
114
+ }
115
+ })
116
+
117
+ // Cloning repositories based on the .meta file generated
118
+ .then(() => {
119
+ if (!skipClone && !finalResponse.remote) {
120
+ return initUtils.repos.init(finalResponse);
121
+ }
122
+ })
123
+
124
+ // Importing external sources
125
+ .then(() => {
126
+ if (finalResponse.project) {
127
+ return initUtils.projects.importExternalSources(true);
128
+ }
129
+ })
130
+
131
+ // Generating virtual remote - experimental
132
+ .then(() => {
133
+ if (finalResponse.remote) {
134
+ return initUtils.remotes.generateVirtualRemote(finalResponse.remote);
135
+ }
136
+ })
137
+
138
+ // Importing packages and generating definitions
139
+ .then(() => {
140
+ return initUtils.packages.importPackages(finalResponse);
141
+ })
142
+
143
+ // adapt and inject particular root data/config for eUI version detected on project
144
+ // if multiple versions of eUI are detected on the same project, an exception is thrown
145
+ .then(() => {
146
+ return initUtils.global.processLocalEuiVersions();
147
+ })
148
+
149
+ // specific resolution injection based on NodeJS (recent failure of nodejs10.x for MWP v7)
150
+ .then(() => {
151
+ return initUtils.global.processResolutionsForNodeVersion();
152
+ })
153
+
154
+ // Install deps based on current config generated => take last know snapshots
155
+ .then(() => {
156
+ // this is only executed for local dev installation,
157
+ // in case of release the initialisation is managed by the application / package themselves
158
+ if (!build && !skipInstall) {
159
+ if (finalResponse.pkgOnly || finalResponse.remoteOnly) {
160
+ if (finalResponse.remote) {
161
+ return installUtils.localDev.installRemote(finalResponse.remote);
162
+ } else {
163
+ return installUtils.localDev.installPackage(finalResponse.pkg);
164
+ }
165
+ } else {
166
+ return installUtils.localDev.install();
167
+ }
168
+ }
169
+ })
170
+
171
+ // Attaching app scripts to root package.json
172
+ .then(() => {
173
+ if (finalResponse.project) {
174
+ return initUtils.projects.importScripts();
175
+ }
176
+ })
177
+
178
+
179
+ // Attaching extra tsconfig from project
180
+ .then(() => {
181
+ if (finalResponse.project) {
182
+ return initUtils.projects.importExtraTsConfig();
183
+ }
184
+ })
185
+
186
+
187
+ // Attaching external features from project
188
+ .then(() => {
189
+ if (finalResponse.project && !build) {
190
+ return initUtils.projects.importExternalFeatures();
191
+ }
192
+ })
193
+
194
+
195
+ // Attaching external mock repo for project
196
+ .then(() => {
197
+ if (finalResponse.project && !build && !finalResponse.prjOnly) {
198
+ return initUtils.projects.importExternalMock();
199
+ }
200
+ })
201
+
202
+
203
+ .then(() => {
204
+ tools.logSuccess('OK => Project successfully initialized');
205
+ })
206
+
207
+ .catch((e) => {
208
+ throw e;
209
+ });
210
+ }
@@ -0,0 +1,63 @@
1
+ 'use strict';
2
+
3
+ const tools = require('../../utils/tools');
4
+ const initUtils = require('./init-utils');
5
+ const installUtils = require('../install/install-utils');
6
+ const configUtils = require('../config/config-utils');
7
+
8
+ const { skipClone, skipInstall, build } = tools.getArgs();
9
+
10
+
11
+ module.exports.init = (finalResponse) => {
12
+ return Promise.resolve()
13
+ // Initializing .euirc.json local file - the core of CSDR operations
14
+ .then(() => {
15
+ // Initialize config
16
+ return configUtils.init.run(finalResponse);
17
+ })
18
+
19
+ // Initializing .meta based on .euirc.json for local respoisitories cloning
20
+ .then(() => {
21
+ return initUtils.meta.init();
22
+ })
23
+
24
+ // Cloning repositories based on the .meta file generated
25
+ .then(() => {
26
+ if (!skipClone) {
27
+ return initUtils.repos.init(finalResponse);
28
+ }
29
+ })
30
+
31
+ // Importing packages and generating definitions
32
+ .then(() => {
33
+ return initUtils.packages.importPackages(finalResponse);
34
+ })
35
+
36
+ // adapt and inject particular root data/config for eUI version detected on project
37
+ // if multiple versions of eUI are detected on the same project, an exception is thrown
38
+ .then(() => {
39
+ return initUtils.global.processLocalEuiVersions();
40
+ })
41
+
42
+ // specific resolution injection based on NodeJS (recent failure of nodejs10.x for MWP v7)
43
+ .then(() => {
44
+ return initUtils.global.processResolutionsForNodeVersion();
45
+ })
46
+
47
+ // Install deps based on current config generated => take last know snapshots
48
+ .then(() => {
49
+ // this is only executed for local dev installation,
50
+ // in case of release the initialisation is managed by the application / package themselves
51
+ if (!build && !skipInstall) {
52
+ if (finalResponse.pkgOnly) {
53
+ return installUtils.localDev.installPackage(finalResponse.pkg);
54
+ } else {
55
+ return installUtils.localDev.install();
56
+ }
57
+ }
58
+ })
59
+
60
+ .catch((e) => {
61
+ throw e;
62
+ });
63
+ }
@@ -0,0 +1,103 @@
1
+ 'use strict';
2
+
3
+ const tools = require('../../utils/tools');
4
+ const initUtils = require('./init-utils');
5
+ const installUtils = require('../install/install-utils');
6
+ const configUtils = require('../config/config-utils');
7
+ const injectionUtils = require('../../utils/pre-build/injection/injection-utils');
8
+
9
+ const { skipClone, skipInstall, build } = tools.getArgs();
10
+
11
+
12
+ module.exports.init = (finalResponse) => {
13
+ return Promise.resolve()
14
+ // Initializing .euirc.json local file - the core of CSDR operations
15
+ .then(() => {
16
+ // Initialize config
17
+ return configUtils.init.run(finalResponse);
18
+ })
19
+
20
+ // clone or install linked host package to project if any
21
+ .then(() => {
22
+ return initUtils.packages.cloneHostPackage(finalResponse.project);
23
+ })
24
+
25
+ // Initializing .meta based on .euirc.json for local respoisitories cloning
26
+ .then(() => {
27
+ return initUtils.meta.init();
28
+ })
29
+
30
+ // Cloning repositories based on the .meta file generated
31
+ .then(() => {
32
+ if (!skipClone) {
33
+ return initUtils.repos.init(finalResponse);
34
+ }
35
+ })
36
+
37
+ // Importing external sources
38
+ .then(() => {
39
+ const prj = configUtils.projects.getProject(finalResponse.project);
40
+ return injectionUtils.externals.injectExternalAppSources(prj, false, true, finalResponse.euiVersion);
41
+ // return initUtils.projects.importExternalSources(true);
42
+ })
43
+
44
+ // Importing packages and generating definitions
45
+ .then(() => {
46
+ return initUtils.packages.importPackages(finalResponse);
47
+ })
48
+
49
+ // adapt and inject particular root data/config for eUI version detected on project
50
+ // if multiple versions of eUI are detected on the same project, an exception is thrown
51
+ .then(() => {
52
+ return initUtils.global.processLocalEuiVersions();
53
+ })
54
+
55
+ // specific resolution injection based on NodeJS (recent failure of nodejs10.x for MWP v7)
56
+ .then(() => {
57
+ return initUtils.global.processResolutionsForNodeVersion();
58
+ })
59
+
60
+ // Install deps based on current config generated => take last know snapshots
61
+ .then(() => {
62
+ // this is only executed for local dev installation,
63
+ // in case of release the initialisation is managed by the application / package themselves
64
+ if (!build && !skipInstall) {
65
+ return installUtils.localDev.install();
66
+ }
67
+ })
68
+
69
+ // Attaching app scripts to root package.json
70
+ .then(() => {
71
+ return initUtils.projects.importScripts();
72
+ })
73
+
74
+
75
+ // Attaching extra tsconfig from project
76
+ .then(() => {
77
+ return initUtils.projects.importExtraTsConfig();
78
+ })
79
+
80
+
81
+ // Attaching external features from project
82
+ .then(() => {
83
+ if (!build) {
84
+ return initUtils.projects.importExternalFeatures();
85
+ }
86
+ })
87
+
88
+
89
+ // Attaching external mock repo for project
90
+ .then(() => {
91
+ if (!build) {
92
+ return initUtils.projects.importExternalMock();
93
+ }
94
+ })
95
+
96
+ .then(() => {
97
+ tools.logSuccess('OK => Project successfully initialized');
98
+ })
99
+
100
+ .catch((e) => {
101
+ throw e;
102
+ });
103
+ }
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ const tools = require('../../utils/tools');
4
+ const initUtils = require('./init-utils');
5
+ const installUtils = require('../install/install-utils');
6
+ const configUtils = require('../config/config-utils');
7
+
8
+ // Getting arguments if they are provided for the CI/CD pipeline
9
+ const { skipInstall, build } = tools.getArgs();
10
+
11
+
12
+
13
+ module.exports.init = (finalResponse) => {
14
+ return Promise.resolve()
15
+ // Initializing .euirc.json local file - the core of CSDR operations
16
+ .then(() => {
17
+ // Initialize config
18
+ return configUtils.init.run(finalResponse);
19
+ })
20
+
21
+ // Generating virtual remote - experimental
22
+ .then(() => {
23
+ return initUtils.remotes.generateVirtualRemote(finalResponse.remote);
24
+ })
25
+
26
+ // Importing packages and generating definitions
27
+ .then(() => {
28
+ return initUtils.packages.importPackages(finalResponse);
29
+ })
30
+
31
+ // Install deps based on current config generated => take last know snapshots
32
+ .then(() => {
33
+ // this is only executed for local dev installation,
34
+ // in case of release the initialisation is managed by the application / package themselves
35
+ if (!build && !skipInstall) {
36
+ if (finalResponse.remoteOnly) {
37
+ return installUtils.localDev.installRemote(finalResponse.remote);
38
+ } else {
39
+ return installUtils.localDev.install();
40
+ }
41
+ }
42
+ })
43
+
44
+ .catch((e) => {
45
+ throw e;
46
+ });
47
+ }
@@ -3,6 +3,9 @@
3
3
  // INNER MODULES - RE-EXPORTS
4
4
  module.exports.global = require('./global');
5
5
  module.exports.init = require('./init');
6
+ module.exports.initProject = require('./init-project');
7
+ module.exports.initPackage = require('./init-package');
8
+ module.exports.initRemote = require('./init-remote');
6
9
  module.exports.meta = require('./meta');
7
10
  module.exports.packages = require('./packages');
8
11
  module.exports.projects = require('./projects');
@@ -1,14 +1,18 @@
1
1
  'use strict';
2
2
 
3
3
  const tools = require('../../utils/tools');
4
- const initUtils = require('./init-utils');
5
- const installUtils = require('../install/install-utils');
6
- const configUtils = require('../config/config-utils');
4
+
5
+ // inner modules
6
+ const innerInitProject = require('./init-project');
7
+ const innerInitPackage = require('./init-package');
8
+ const innerInitRemote = require('./init-remote');
9
+ const innerInitCustom = require('./init-custom');
10
+
7
11
 
8
12
  // Getting arguments if they are provided for the CI/CD pipeline
9
13
  const {
10
14
  project, team, pkg, branch, configOnly, skipClone, skipInstall, reset, pkgOnly, prjOnly,
11
- build, containerOnly, skipAppContainers, remote, euiVersion, remoteOnly, remoteBuild, virtual
15
+ build, containerOnly, skipAppContainers, remote, euiVersion, remoteOnly, remoteBuild, virtual, custom
12
16
  } = tools.getArgs();
13
17
 
14
18
 
@@ -31,7 +35,8 @@ module.exports.init = () => {
31
35
  remoteOnly: remoteOnly || false,
32
36
  build: build || false,
33
37
  containerOnly: containerOnly || false,
34
- skipAppContainers: skipAppContainers || false
38
+ skipAppContainers: skipAppContainers || false,
39
+ custom: custom || false
35
40
  }
36
41
 
37
42
  // converting inputs args
@@ -52,7 +57,6 @@ module.exports.init = () => {
52
57
  initialResponse.pkg = null;
53
58
  }
54
59
 
55
-
56
60
  // Storing the response for propagation
57
61
  let finalResponse;
58
62
 
@@ -60,7 +64,7 @@ module.exports.init = () => {
60
64
  .then(() => {
61
65
 
62
66
  // if no project has been provided we prompt for project and team selection
63
- if (!project && !pkg && !remote) {
67
+ if (!project && !pkg && !remote && !custom ) {
64
68
  // TODO refactor to handle dynamic mywp-host-playground install (pre-remotes install etc...)
65
69
  // return initUtils.prompt.start();
66
70
  tools.logError('****************************************');
@@ -70,6 +74,7 @@ module.exports.init = () => {
70
74
  tools.logError('npm run init -- --pkg PKG_NAME [--branch BRANCH_NAME|default develop] [--git local] [--pkgOnly] [--skipInstall]');
71
75
  tools.logError('npm run init -- --project PROJECT_NAME [--branch BRANCH_NAME|default develop] [--git local] [--prjOnly] [--skipInstall]');
72
76
  tools.logError('npm run init -- --remote VIRTUAL_REMOTE_NAME [--remoteOnly] [--skipInstall]');
77
+ tools.logError('npm run init -- --custom [--skipInstall] [--git local]');
73
78
  process.exit(0);
74
79
 
75
80
  // if provided, we are on automated mode, we use the initialized response
@@ -86,118 +91,21 @@ module.exports.init = () => {
86
91
  console.log(finalResponse);
87
92
  })
88
93
 
89
- // Initializing .euirc.json local file - the core of CSDR operations
90
94
  .then(() => {
91
- // Initialize config
92
- return configUtils.init.run(finalResponse);
93
- })
94
-
95
- // clone or install linked host package to project if any
96
- .then(() => {
97
- // TODO
98
- // if (finalResponse.project && !build) {
99
95
  if (finalResponse.project) {
100
- return initUtils.packages.cloneHostPackage(finalResponse.project);
101
- }
102
- // TODO
103
- // } else if (finalResponse.project && build) {
104
- // return initUtils.packages.installHostPackage(finalResponse.project);
105
- // }
106
- })
96
+ return innerInitProject.init(finalResponse);
107
97
 
108
- // Initializing .meta based on .euirc.json for local respoisitories cloning
109
- .then(() => {
110
- if (!finalResponse.remote) {
111
- return initUtils.meta.init();
112
- }
113
- })
114
-
115
- // Cloning repositories based on the .meta file generated
116
- .then(() => {
117
- if (!skipClone && !finalResponse.remote) {
118
- return initUtils.repos.init(finalResponse);
119
- }
120
- })
98
+ } else if (finalResponse.pkg) {
99
+ return innerInitPackage.init(finalResponse);
121
100
 
122
- // Importing external sources
123
- .then(() => {
124
- if (finalResponse.project) {
125
- return initUtils.projects.importExternalSources(true);
126
- }
127
- })
101
+ } else if (finalResponse.remote) {
102
+ return innerInitRemote.init(finalResponse);
128
103
 
129
- // Generating virtual remote - experimental
130
- .then(() => {
131
- if (finalResponse.remote) {
132
- return initUtils.remotes.generateVirtualRemote(finalResponse.remote);
104
+ } else if (finalResponse.custom) {
105
+ return innerInitCustom.init(finalResponse);
133
106
  }
134
107
  })
135
108
 
136
- // Importing packages and generating definitions
137
- .then(() => {
138
- return initUtils.packages.importPackages(finalResponse);
139
- })
140
-
141
- // adapt and inject particular root data/config for eUI version detected on project
142
- // if multiple versions of eUI are detected on the same project, an exception is thrown
143
- .then(() => {
144
- return initUtils.global.processLocalEuiVersions();
145
- })
146
-
147
- // specific resolution injection based on NodeJS (recent failure of nodejs10.x for MWP v7)
148
- .then(() => {
149
- return initUtils.global.processResolutionsForNodeVersion();
150
- })
151
-
152
- // Install deps based on current config generated => take last know snapshots
153
- .then(() => {
154
- // this is only executed for local dev installation,
155
- // in case of release the initialisation is managed by the application / package themselves
156
- if (!build && !skipInstall) {
157
- if (finalResponse.pkgOnly || finalResponse.remoteOnly) {
158
- if (finalResponse.remote) {
159
- return installUtils.localDev.installRemote(finalResponse.remote);
160
- } else {
161
- return installUtils.localDev.installPackage(finalResponse.pkg);
162
- }
163
- } else {
164
- return installUtils.localDev.install();
165
- }
166
- }
167
- })
168
-
169
- // Attaching app scripts to root package.json
170
- .then(() => {
171
- if (finalResponse.project) {
172
- return initUtils.projects.importScripts();
173
- }
174
- })
175
-
176
-
177
- // Attaching extra tsconfig from project
178
- .then(() => {
179
- if (finalResponse.project) {
180
- return initUtils.projects.importExtraTsConfig();
181
- }
182
- })
183
-
184
-
185
- // Attaching external features from project
186
- .then(() => {
187
- if (finalResponse.project && !build) {
188
- return initUtils.projects.importExternalFeatures();
189
- }
190
- })
191
-
192
-
193
- // Attaching external mock repo for project
194
- .then(() => {
195
- if (finalResponse.project && !build && !finalResponse.prjOnly) {
196
- return initUtils.projects.importExternalMock();
197
- }
198
- })
199
-
200
-
201
109
  .then(() => {
202
110
  tools.logSuccess('OK => Project successfully initialized');
203
111
  })
@@ -476,6 +476,11 @@ module.exports.getRemoteAllStats = () => {
476
476
  if (versionsMatadata.versions) {
477
477
  versionsCount = versionsMatadata.versions.length;
478
478
  versionsCountEnvs['DEV'] = versionsMatadata.versions.filter(v => v.envTarget === 'DEV').length;
479
+ versionsCountEnvs['TST'] = versionsMatadata.versions.filter(v => v.envTarget === 'TST').length;
480
+ versionsCountEnvs['INT'] = versionsMatadata.versions.filter(v => v.envTarget === 'INT').length;
481
+ versionsCountEnvs['ACC'] = versionsMatadata.versions.filter(v => v.envTarget === 'ACC').length;
482
+ versionsCountEnvs['TRN'] = versionsMatadata.versions.filter(v => v.envTarget === 'TRN').length;
483
+ versionsCountEnvs['PROD'] = versionsMatadata.versions.filter(v => v.envTarget === 'PROD').length;
479
484
  lastVersion = versionsMatadata.versions.slice(-1).pop();
480
485
  }
481
486
  const remoteStats = {
@@ -148,7 +148,7 @@ const injectExternalAppRootCore = (project, build = false, injectedNpmPkg, injec
148
148
 
149
149
 
150
150
 
151
- module.exports.injectExternalAppSources = (project, build = false, init = false) => {
151
+ module.exports.injectExternalAppSources = (project, build = false, init = false, euiVersion) => {
152
152
 
153
153
  if (!project.externalSources) {
154
154
  tools.logInfo('No external app sources setup...skipping');
@@ -160,17 +160,18 @@ module.exports.injectExternalAppSources = (project, build = false, init = false)
160
160
  return;
161
161
  }
162
162
 
163
- let { euiVersion } = tools.getArgs();
164
-
165
- if (!euiVersion && project.virtual) {
166
- euiVersion = configUtils.projects.getProjectEuiVersion(project);
167
-
168
- if (!euiVersion) {
169
- throw new Error(`
170
- eUI version of ${project.name} cannot be found...
171
- if you're initializing the project, pass the "euiVersion" as parameter :
172
- f.e. : npm run init -- --project ${project.name} .... --euiVersion 10.x
173
- `);
163
+ if (!euiVersion) {
164
+ const { euiVersionArg } = tools.getArgs();
165
+ if (!euiVersionArg && project.virtual) {
166
+ euiVersion = configUtils.projects.getProjectEuiVersion(project);
167
+
168
+ if (!euiVersion) {
169
+ throw new Error(`
170
+ eUI version of ${project.name} cannot be found...
171
+ if you're initializing the project, pass the "euiVersion" as parameter :
172
+ f.e. : npm run init -- --project ${project.name} .... --euiVersion 10.x
173
+ `);
174
+ }
174
175
  }
175
176
  }
176
177