@eui/tools 6.12.33 → 6.12.35
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 +21 -0
- package/package.json +1 -1
- package/sandbox.js +56 -7
- package/scripts/app/public/index.html +21 -1
- package/scripts/app/public/index.js +14 -2
- package/scripts/csdr/config/global.js +19 -2
- package/scripts/csdr/config/init.js +7 -3
- package/scripts/csdr/config/packages.js +24 -0
- package/scripts/csdr/config/projects.js +6 -1
- package/scripts/csdr/config/remotes.js +7 -0
- package/scripts/csdr/init/init-custom.js +16 -13
- package/scripts/csdr/init/meta.js +15 -0
- package/scripts/csdr/init/repos.js +9 -1
- package/scripts/utils/git-utils.js +3 -3
- package/scripts/utils/pre-build/pre-build-utils.js +1 -0
- package/scripts/utils/pre-build/routes-replacement/routes-replacement.js +85 -9
- package/scripts/utils/publish/npm.js +42 -19
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.12.
|
|
1
|
+
6.12.35
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## 6.12.35 (2023-08-03)
|
|
2
|
+
|
|
3
|
+
##### Chores
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* sandbox update ([4bdda3b2](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/4bdda3b2fa84cc888a6f89a822b98b56b235078b))
|
|
7
|
+
* adapted init scripts for custom host installation - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([ae114c1a](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/ae114c1ad762ee0bcc9a91ef7bcd5784b93d96c9))
|
|
8
|
+
* adapted init vue app including branch seletion and retrieval from config - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([e9be35c6](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/e9be35c6331748021f812edf06c9a9d31533cd1a))
|
|
9
|
+
* custom routes for custom installation impl. - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([21738675](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/21738675a3e4f0a05b5f6a39f73d312070108597))
|
|
10
|
+
|
|
11
|
+
* * *
|
|
12
|
+
* * *
|
|
13
|
+
## 6.12.34 (2023-08-02)
|
|
14
|
+
|
|
15
|
+
##### Chores
|
|
16
|
+
|
|
17
|
+
* **other:**
|
|
18
|
+
* check for already published package on publish script - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([4a0e4db7](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/4a0e4db7bee3d1224285f3d3d61a0b603d61f240))
|
|
19
|
+
|
|
20
|
+
* * *
|
|
21
|
+
* * *
|
|
1
22
|
## 6.12.33 (2023-07-26)
|
|
2
23
|
|
|
3
24
|
##### Chores
|
package/package.json
CHANGED
package/sandbox.js
CHANGED
|
@@ -20,6 +20,7 @@ const translationUtils = require('./scripts/utils/pre-build/translations/transla
|
|
|
20
20
|
const preBuildUtils = require('./scripts/utils/pre-build/pre-build-utils');
|
|
21
21
|
const apiUtils = require('./scripts/utils/api-utils');
|
|
22
22
|
const versionUtils = require('./scripts/csdr/version/version-utils');
|
|
23
|
+
const publishUtils = require('./scripts/utils/publish/publish-utils');
|
|
23
24
|
|
|
24
25
|
// console.log(configUtils.packages.getPackages());
|
|
25
26
|
// console.log(configUtils.packages.getPackage('eui-tools'));
|
|
@@ -1256,16 +1257,64 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
|
|
|
1256
1257
|
// .catch((e) => {
|
|
1257
1258
|
// console.log(e);
|
|
1258
1259
|
// })
|
|
1260
|
+
// Promise.resolve()
|
|
1261
|
+
// .then(() => {
|
|
1262
|
+
// // old package without gates forced
|
|
1263
|
+
// const pkg = configUtils.packages.getPackage('cc-flex-ui', true);
|
|
1264
|
+
// console.log(pkg);
|
|
1265
|
+
|
|
1266
|
+
// return auditUtils.styles.audit(pkg);
|
|
1267
|
+
// })
|
|
1268
|
+
// .then((report) => {
|
|
1269
|
+
// console.log(report);
|
|
1270
|
+
// })
|
|
1271
|
+
|
|
1272
|
+
// .catch((e) => {
|
|
1273
|
+
// console.log(e);
|
|
1274
|
+
// })
|
|
1275
|
+
|
|
1276
|
+
// route replacement test
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
// // BUILD PACKAGE FIRST !!
|
|
1280
|
+
|
|
1281
|
+
// const pkg = configUtils.packages.getPackage('eui');
|
|
1282
|
+
// const pkgChild = configUtils.packages.getPackage('eui-base');
|
|
1283
|
+
// const version = '15.4.1';
|
|
1284
|
+
|
|
1285
|
+
// Promise.resolve()
|
|
1286
|
+
// .then(() => {
|
|
1287
|
+
// return versionUtils.package.updateVersion(pkg,version);
|
|
1288
|
+
// })
|
|
1289
|
+
// .then(() => {
|
|
1290
|
+
// return buildPackageUtils.postBuild(pkg);
|
|
1291
|
+
// })
|
|
1292
|
+
// .then(() => {
|
|
1293
|
+
// // IF individual child packages have to be published individually
|
|
1294
|
+
|
|
1295
|
+
// // console.log(pkgChild);
|
|
1296
|
+
// // const publishNpmCore = require('./scripts/utils/publish/npm');
|
|
1297
|
+
// // return publishNpmCore.publishCore(pkgChild, 'https://registry.npmjs.org', true)
|
|
1298
|
+
// return publishUtils.publish(pkg);
|
|
1299
|
+
// })
|
|
1300
|
+
// .then((report) => {
|
|
1301
|
+
// console.log(report);
|
|
1302
|
+
// })
|
|
1303
|
+
|
|
1304
|
+
// .catch((e) => {
|
|
1305
|
+
// console.log(e);
|
|
1306
|
+
// })
|
|
1307
|
+
|
|
1308
|
+
|
|
1309
|
+
|
|
1310
|
+
|
|
1259
1311
|
Promise.resolve()
|
|
1260
1312
|
.then(() => {
|
|
1261
|
-
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1313
|
+
const prjName = 'my-workplace-host-playground-custom';
|
|
1314
|
+
const project = configUtils.projects.getCsdrProject(prjName);
|
|
1315
|
+
const envTarget = 'cdn-dev-local';
|
|
1264
1316
|
|
|
1265
|
-
return
|
|
1266
|
-
})
|
|
1267
|
-
.then((report) => {
|
|
1268
|
-
console.log(report);
|
|
1317
|
+
return preBuildUtils.routesReplacement.buildRoutes(project, envTarget);
|
|
1269
1318
|
})
|
|
1270
1319
|
|
|
1271
1320
|
.catch((e) => {
|
|
@@ -130,7 +130,27 @@
|
|
|
130
130
|
Derived UI packages to be locally cloned :
|
|
131
131
|
<span class="text-primary fw-bold">{{ packages.length }}</span>
|
|
132
132
|
</h5>
|
|
133
|
-
{{ packages }}
|
|
133
|
+
<!-- {{ packages }} -->
|
|
134
|
+
<table class="table table-striped" v-show="packages.length !== 0">
|
|
135
|
+
<thead>
|
|
136
|
+
<tr>
|
|
137
|
+
<th scope="col">Pkg name</th>
|
|
138
|
+
<th scope="col">Branch</th>
|
|
139
|
+
</tr>
|
|
140
|
+
</thead>
|
|
141
|
+
<tbody>
|
|
142
|
+
<tr v-for="pkg in packages">
|
|
143
|
+
<td>{{pkg.name}}</td>
|
|
144
|
+
<td><input type="text" class="form-control" :id="pkg.name" v-model="pkg.branch"></td>
|
|
145
|
+
</tr>
|
|
146
|
+
</tbody>
|
|
147
|
+
</table>
|
|
148
|
+
<!-- <div class="form-group row" v-for="pkg in packages">
|
|
149
|
+
<label class="col-sm-2 col-form-label">{{ pkg.name }}</label>
|
|
150
|
+
<div class="col-sm-10">
|
|
151
|
+
<input type="email" class="form-control" id="{{pkg.name}}" :value="pkg.branch">
|
|
152
|
+
</div>
|
|
153
|
+
</div> -->
|
|
134
154
|
|
|
135
155
|
<hr />
|
|
136
156
|
|
|
@@ -21,6 +21,7 @@ new Vue({
|
|
|
21
21
|
packages: [],
|
|
22
22
|
saveConfigSubmitted: false,
|
|
23
23
|
saveConfigOK: false,
|
|
24
|
+
configPackages: null
|
|
24
25
|
};
|
|
25
26
|
},
|
|
26
27
|
created() {
|
|
@@ -44,15 +45,26 @@ new Vue({
|
|
|
44
45
|
this.selectedInstalledRemotes = finalRes.installedRemotes;
|
|
45
46
|
this.deps = finalRes.deps;
|
|
46
47
|
this.packages = finalRes.packages;
|
|
48
|
+
this.configPackages = finalRes.packages;
|
|
47
49
|
}
|
|
48
50
|
},
|
|
49
51
|
async getPackages() {
|
|
50
52
|
const res = await fetch("http://localhost:3000/api/remotes/packages", getRequestBody(this.selectedRemotes));
|
|
51
53
|
const finalRes = await res.json();
|
|
54
|
+
this.deps = finalRes.deps;
|
|
55
|
+
|
|
52
56
|
this.packages = finalRes.packages.filter(
|
|
53
|
-
(p) => p.indexOf("csdr-") < 0 && p.indexOf("cc-shared-ui") < 0 && p.indexOf("mywp-shared-ui") < 0
|
|
57
|
+
(p) => p.name.indexOf("csdr-") < 0 && p.name.indexOf("cc-shared-ui") < 0 && p.name.indexOf("mywp-shared-ui") < 0
|
|
54
58
|
);
|
|
55
|
-
this.
|
|
59
|
+
if (this.configPackages) {
|
|
60
|
+
this.packages = this.packages.map((p) => {
|
|
61
|
+
const configPkg = this.configPackages.find(cp => cp.name === p.name);
|
|
62
|
+
return {
|
|
63
|
+
name: p.name,
|
|
64
|
+
branch: configPkg.branch,
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
}
|
|
56
68
|
},
|
|
57
69
|
reset() {
|
|
58
70
|
this.selectedRemotes = [];
|
|
@@ -85,6 +85,7 @@ const getGeneratedConfig = (euircBaseFile) => {
|
|
|
85
85
|
// initializing projects and packages objects
|
|
86
86
|
genConfig.projects = {};
|
|
87
87
|
genConfig.packages = {};
|
|
88
|
+
genConfig.packagesBranches = [];
|
|
88
89
|
genConfig.remotes = {};
|
|
89
90
|
|
|
90
91
|
// remapping projects against csdr projects config
|
|
@@ -133,6 +134,9 @@ const getGeneratedConfig = (euircBaseFile) => {
|
|
|
133
134
|
})
|
|
134
135
|
}
|
|
135
136
|
|
|
137
|
+
// packages branches for custom initialization
|
|
138
|
+
genConfig.packagesBranches = configContent.packagesBranches;
|
|
139
|
+
|
|
136
140
|
return genConfig;
|
|
137
141
|
}
|
|
138
142
|
|
|
@@ -164,7 +168,7 @@ module.exports.getConfig = () => {
|
|
|
164
168
|
|
|
165
169
|
|
|
166
170
|
|
|
167
|
-
module.exports.updateConfig = (args = { project, packages, remotes, reset}) => {
|
|
171
|
+
module.exports.updateConfig = (args = { project, packages, packagesBranches, remotes, reset}) => {
|
|
168
172
|
tools.logInfo('Updating euirc config');
|
|
169
173
|
console.log(args);
|
|
170
174
|
|
|
@@ -181,6 +185,10 @@ module.exports.updateConfig = (args = { project, packages, remotes, reset}) => {
|
|
|
181
185
|
if (args.packages) {
|
|
182
186
|
newConfig.packages = args.packages;
|
|
183
187
|
}
|
|
188
|
+
newConfig.packagesBranches = [];
|
|
189
|
+
if (args.packagesBranches) {
|
|
190
|
+
newConfig.packagesBranches = args.packagesBranches;
|
|
191
|
+
}
|
|
184
192
|
newConfig.remotes = [];
|
|
185
193
|
if (args.remotes) {
|
|
186
194
|
newConfig.remotes = args.remotes;
|
|
@@ -198,6 +206,9 @@ module.exports.updateConfig = (args = { project, packages, remotes, reset}) => {
|
|
|
198
206
|
if (args.packages) {
|
|
199
207
|
newConfig.packages = tools.removeArrayDuplicates([...newConfig.packages || [], ...args.packages]);
|
|
200
208
|
}
|
|
209
|
+
if (args.packagesBranches) {
|
|
210
|
+
newConfig.packagesBranches = tools.removeArrayDuplicates([...newConfig.packagesBranches || [], ...args.packagesBranches]);
|
|
211
|
+
}
|
|
201
212
|
|
|
202
213
|
if (args.remotes) {
|
|
203
214
|
newConfig.remotes = tools.removeArrayDuplicates([...newConfig.remotes || [], ...args.remotes]);
|
|
@@ -442,5 +453,11 @@ module.exports.generateCustomConfig = (customConfig) => {
|
|
|
442
453
|
module.exports.getCustomConfig = () => {
|
|
443
454
|
const configFile = path.join(process.cwd(), '.csdr', '.euirc-csdr-custom.json');
|
|
444
455
|
|
|
445
|
-
|
|
456
|
+
delete require.cache[configFile];
|
|
457
|
+
|
|
458
|
+
if (tools.isFileExists(configFile)) {
|
|
459
|
+
return tools.getJsonFileContent(configFile) || null;
|
|
460
|
+
} else {
|
|
461
|
+
return null;
|
|
462
|
+
}
|
|
446
463
|
}
|
|
@@ -18,7 +18,7 @@ module.exports.run = (args) => {
|
|
|
18
18
|
return Promise.resolve()
|
|
19
19
|
.then(() => {
|
|
20
20
|
if (args.custom) {
|
|
21
|
-
return initConfigCustom();
|
|
21
|
+
return initConfigCustom(args);
|
|
22
22
|
|
|
23
23
|
} else {
|
|
24
24
|
return initConfigCore(args);
|
|
@@ -31,7 +31,7 @@ module.exports.run = (args) => {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
const initConfigCustom = () => {
|
|
34
|
+
const initConfigCustom = (args) => {
|
|
35
35
|
return Promise.resolve()
|
|
36
36
|
.then(() => {
|
|
37
37
|
tools.logInfo('Updating local configuration - custom init');
|
|
@@ -42,9 +42,13 @@ const initConfigCustom = () => {
|
|
|
42
42
|
throw new Error('Custom config not found... run the command "npm run init:custom" to generate your customized config');
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
let defaultPackages = [];
|
|
46
|
+
defaultPackages = getInputPackages(args.project, args.pkg, args.team, args.prjOnly, args.containerOnly);
|
|
47
|
+
|
|
45
48
|
return innerGlobal.updateConfig({
|
|
46
49
|
project: customConfig.project,
|
|
47
|
-
packages: customConfig.packages,
|
|
50
|
+
packages: [...defaultPackages, ...customConfig.packages.map(p => p.name)],
|
|
51
|
+
packagesBranches: customConfig.packages,
|
|
48
52
|
remotes: customConfig.remotes,
|
|
49
53
|
reset: true
|
|
50
54
|
});
|
|
@@ -71,6 +71,30 @@ module.exports.getPackageByNpmPkg = (npmPkg, fromCsdrConfig) => {
|
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
module.exports.getPackageByRepository = (repository, fromCsdrConfig) => {
|
|
75
|
+
let packages;
|
|
76
|
+
|
|
77
|
+
// getting all config packages
|
|
78
|
+
if (fromCsdrConfig) {
|
|
79
|
+
packages = innerGlobal.getCsdrConfig().packages;
|
|
80
|
+
|
|
81
|
+
// get only packages installed config based on super .euirc.json file generated
|
|
82
|
+
} else {
|
|
83
|
+
packages = innerGlobal.getConfig().packages;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const pkg = Object.keys(packages).filter((p) => {
|
|
87
|
+
const pkg = packages[p];
|
|
88
|
+
return pkg.repository === repository;
|
|
89
|
+
})[0];
|
|
90
|
+
|
|
91
|
+
if (pkg) {
|
|
92
|
+
return this.getPackage(pkg, fromCsdrConfig);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
74
98
|
module.exports.isLocalPackage = (npmPkg) => {
|
|
75
99
|
tools.logInfo(`Checking if ${npmPkg} is localled installed`);
|
|
76
100
|
|
|
@@ -223,9 +223,14 @@ module.exports.getBaseHref = (prj, version, providedBaseHref) => {
|
|
|
223
223
|
const getEuiVersionCore = (project) => {
|
|
224
224
|
let version;
|
|
225
225
|
|
|
226
|
+
tools.logInfo(`Checking project dependencies in : ${project.folder}`);
|
|
226
227
|
const depsCompositeFile = path.join(project.folder, 'dependencies-composite.json');
|
|
227
228
|
|
|
228
|
-
if (tools.isFileExists(depsCompositeFile)) {
|
|
229
|
+
if (!tools.isFileExists(depsCompositeFile)) {
|
|
230
|
+
tools.logWarning('Unable to find project version / dependencies-composite.json does not exist in project');
|
|
231
|
+
|
|
232
|
+
} else {
|
|
233
|
+
tools.logInfo(`parsing ${depsCompositeFile}`);
|
|
229
234
|
const jsonFileContnet = JSON.parse(tools.getFileContent(depsCompositeFile));
|
|
230
235
|
const deps = jsonFileContnet.dependencies;
|
|
231
236
|
|
|
@@ -197,6 +197,13 @@ module.exports.getRemotesPackages = (remotes) => {
|
|
|
197
197
|
// adding the package root as source
|
|
198
198
|
const pkg = innerPackages.getPackageByNpmPkg(rootNpmPkgName, true);
|
|
199
199
|
packages.push(pkg.name);
|
|
200
|
+
|
|
201
|
+
packages = packages.map((p) => {
|
|
202
|
+
return {
|
|
203
|
+
name: p,
|
|
204
|
+
branch: 'develop'
|
|
205
|
+
}
|
|
206
|
+
});
|
|
200
207
|
});
|
|
201
208
|
|
|
202
209
|
return {
|
|
@@ -14,21 +14,17 @@ const { skipInstall, build } = tools.getArgs();
|
|
|
14
14
|
let customConfig;
|
|
15
15
|
|
|
16
16
|
module.exports.init = (finalResponse) => {
|
|
17
|
+
tools.logTitle('Starting init custom');
|
|
18
|
+
|
|
17
19
|
return Promise.resolve()
|
|
18
20
|
.then(() => {
|
|
19
21
|
customConfig = configUtils.global.getCustomConfig();
|
|
22
|
+
|
|
20
23
|
if (!customConfig) {
|
|
21
24
|
throw new Error('Custom config not found... run the command "npm run init:custom" to generate your customized config');
|
|
22
25
|
}
|
|
23
26
|
})
|
|
24
27
|
|
|
25
|
-
.then(() => {
|
|
26
|
-
finalResponse.project = customConfig.project;
|
|
27
|
-
finalResponse.euiVersion = customConfig.euiVersion;
|
|
28
|
-
|
|
29
|
-
return innerInitProject.init(finalResponse);
|
|
30
|
-
})
|
|
31
|
-
|
|
32
28
|
.then(() => {
|
|
33
29
|
return customConfig.remotes.reduce((promise, remote) => {
|
|
34
30
|
return promise.then(() => (
|
|
@@ -38,15 +34,22 @@ module.exports.init = (finalResponse) => {
|
|
|
38
34
|
})
|
|
39
35
|
|
|
40
36
|
.then(() => {
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
finalResponse.project = customConfig.project;
|
|
38
|
+
finalResponse.euiVersion = customConfig.euiVersion;
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
if (!build && !skipInstall) {
|
|
46
|
-
return installUtils.localDev.install(customConfig.deps);
|
|
47
|
-
}
|
|
40
|
+
return innerInitProject.init(finalResponse);
|
|
48
41
|
})
|
|
49
42
|
|
|
43
|
+
// .then(() => {
|
|
44
|
+
// return innerPackages.importPackages(finalResponse);
|
|
45
|
+
// })
|
|
46
|
+
|
|
47
|
+
// .then(() => {
|
|
48
|
+
// if (!build && !skipInstall) {
|
|
49
|
+
// return installUtils.localDev.install(customConfig.deps);
|
|
50
|
+
// }
|
|
51
|
+
// })
|
|
52
|
+
|
|
50
53
|
.catch((e) => {
|
|
51
54
|
throw e;
|
|
52
55
|
});
|
|
@@ -64,3 +64,18 @@ module.exports.getMetaProjects = () => {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
|
|
67
|
+
module.exports.getBranchFromRepo = (repo) => {
|
|
68
|
+
tools.logInfo(`Getting branch from meta repo : ${repo.folder}`);
|
|
69
|
+
const config = configUtils.global.getConfig();
|
|
70
|
+
|
|
71
|
+
if (config.packagesBranches && config.packagesBranches.length !== 0) {
|
|
72
|
+
const pkg = configUtils.packages.getPackageByRepository(repo.uri);
|
|
73
|
+
const pkgBranch = config.packagesBranches.find(p => p.name === pkg.name);
|
|
74
|
+
if (pkgBranch) {
|
|
75
|
+
return pkgBranch.branch;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
} else {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -71,7 +71,15 @@ const cloneAndCheckout = (repo, args) => {
|
|
|
71
71
|
|
|
72
72
|
return Promise.resolve()
|
|
73
73
|
.then(() => {
|
|
74
|
-
|
|
74
|
+
const branch = innerMeta.getBranchFromRepo(repo);
|
|
75
|
+
let cloneBranch;
|
|
76
|
+
|
|
77
|
+
if (branch) {
|
|
78
|
+
cloneBranch = branch;
|
|
79
|
+
} else {
|
|
80
|
+
cloneBranch = args.branch;
|
|
81
|
+
}
|
|
82
|
+
return gitUtils.cloneAndCheckout(repo.uri, repo.folder, cloneBranch, false, shallowClone);
|
|
75
83
|
})
|
|
76
84
|
|
|
77
85
|
.catch((e) => {
|
|
@@ -337,9 +337,9 @@ const checkout = (branch, folder, shallow = false) => {
|
|
|
337
337
|
});
|
|
338
338
|
})
|
|
339
339
|
.catch((e) => {
|
|
340
|
-
if (!build) {
|
|
341
|
-
|
|
342
|
-
}
|
|
340
|
+
// if (!build) {
|
|
341
|
+
// console.log(e);
|
|
342
|
+
// }
|
|
343
343
|
throw new Error(`Error trying to checkout ${branch} on ${folder}`);
|
|
344
344
|
})
|
|
345
345
|
}
|
|
@@ -31,18 +31,23 @@ const { debug } = tools.getArgs();
|
|
|
31
31
|
* @param {boolean} build if the script is launched from a release pipeline OR from local CSDR playground environment (false in that case)
|
|
32
32
|
* @returns {Promise} returns a Promise as it involves async I/O processes
|
|
33
33
|
*/
|
|
34
|
-
module.exports.buildRoutes = (project, envTarget, build) => {
|
|
34
|
+
module.exports.buildRoutes = (project, envTarget, build = false) => {
|
|
35
35
|
tools.logTitle('Starting routes replacement');
|
|
36
36
|
|
|
37
|
+
// fetch custom config flag from project definition (used by host-playground-custom CSDR app config)
|
|
38
|
+
const custom = project.externalRoutesSources.custom;
|
|
39
|
+
|
|
40
|
+
// fetch generated envTarget
|
|
37
41
|
const envTargetFinal = subs.getEnvTarget(envTarget, build);
|
|
38
42
|
|
|
43
|
+
// proceed to routes individual fetching and replacements
|
|
39
44
|
return Promise.resolve()
|
|
40
45
|
.then(() => {
|
|
41
46
|
// injecting routes json definitions into project assets
|
|
42
47
|
injectRoutesConfig(project);
|
|
43
48
|
|
|
44
49
|
// getting all routes defs to be processed
|
|
45
|
-
const rawRoutesDefs = getRawRoutesDefs(project, envTargetFinal);
|
|
50
|
+
const rawRoutesDefs = getRawRoutesDefs(project, envTargetFinal, custom);
|
|
46
51
|
|
|
47
52
|
// getting project routes remapped
|
|
48
53
|
const routes = getProjectRoutes(project, rawRoutesDefs);
|
|
@@ -114,12 +119,61 @@ const injectRoutesConfig = (project) => {
|
|
|
114
119
|
};
|
|
115
120
|
|
|
116
121
|
|
|
122
|
+
const getCustomRoutesDefs = (project) => {
|
|
123
|
+
let routes = [];
|
|
124
|
+
|
|
125
|
+
tools.logInfo('Generating playground routes from custom config :');
|
|
126
|
+
|
|
127
|
+
const customConfig = configUtils.global.getCustomConfig();
|
|
128
|
+
|
|
129
|
+
if (Object.keys(customConfig).length === 0) {
|
|
130
|
+
tools.logError('No custom config found in your local csdr setup, run "npm run init:custom" for generating your own');
|
|
131
|
+
throw 'NO_CUSTOM_CONFIG_FOUND';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
tools.logInfo('Custom config found :');
|
|
135
|
+
console.log(customConfig);
|
|
136
|
+
|
|
137
|
+
const routeDefsBaseFilename = 'route-defs-base.json';
|
|
138
|
+
const routeDefsBaseJSON = require(path.join(project.paths.assetsPath, routeDefsBaseFilename));
|
|
139
|
+
|
|
140
|
+
const getRouteFromNpmPkg = (npmPkg) => {
|
|
141
|
+
let route = null;
|
|
142
|
+
|
|
143
|
+
routeDefsBaseJSON.forEach((r) => {
|
|
144
|
+
if (r.lazyLoadDef) {
|
|
145
|
+
if (r.lazyLoadDef.npmPkg === npmPkg) {
|
|
146
|
+
route = r;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
return route;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// get routes from local packages to be installed
|
|
155
|
+
customConfig.packages.forEach((pkgName) => {
|
|
156
|
+
const pkg = configUtils.packages.getPackage(pkgName);
|
|
117
157
|
|
|
158
|
+
tools.logInfo(`getting route def for : ${pkg.name} - ${pkg.npmPkg}`);
|
|
159
|
+
const route = getRouteFromNpmPkg(pkg.npmPkg);
|
|
160
|
+
|
|
161
|
+
if (route) {
|
|
162
|
+
routes.push({ path: route.path, lazy: true });
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
return routes;
|
|
166
|
+
}
|
|
118
167
|
|
|
119
168
|
|
|
120
|
-
const
|
|
169
|
+
const getRoutesDefs = (project, envTargetFinal) => {
|
|
121
170
|
// getting generated from input params
|
|
122
171
|
const euiVersion = configUtils.projects.getProjectEuiVersion(project);
|
|
172
|
+
|
|
173
|
+
if (!euiVersion) {
|
|
174
|
+
throw 'PROJECT_EUI_VERSION_NOT_FOUND';
|
|
175
|
+
}
|
|
176
|
+
|
|
123
177
|
const euiVersionNumber = euiVersion.split('.')[0];
|
|
124
178
|
|
|
125
179
|
tools.logInfo(`Processing for envTarget : ${envTargetFinal}`);
|
|
@@ -152,6 +206,29 @@ const getRawRoutesDefs = (project, envTargetFinal) => {
|
|
|
152
206
|
|
|
153
207
|
const routeDefsInputJSON = require(path.join(routeDefsInputPath));
|
|
154
208
|
|
|
209
|
+
return routeDefsInputJSON;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
const getRawRoutesDefs = (project, envTargetFinal, custom) => {
|
|
216
|
+
|
|
217
|
+
let routesDefsBase = [];
|
|
218
|
+
|
|
219
|
+
if (custom) {
|
|
220
|
+
routesDefsBase = getCustomRoutesDefs(project);
|
|
221
|
+
|
|
222
|
+
} else {
|
|
223
|
+
routesDefsBase = getRoutesDefs(project, envTargetFinal);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (routesDefsBase.length === 0) {
|
|
227
|
+
tools.logError('No routes base defs can be found, check your mywp-host-ui branch status or contact support');
|
|
228
|
+
throw 'NO_ROUTES_DEFS'
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
|
|
155
232
|
// Merging content with "local" route file defs if existing
|
|
156
233
|
|
|
157
234
|
let routes = [];
|
|
@@ -164,7 +241,7 @@ const getRawRoutesDefs = (project, envTargetFinal) => {
|
|
|
164
241
|
tools.logInfo(`Merging local configuration found : ${localRouteDefsInputFilename}`);
|
|
165
242
|
const localRouteDefsInputJSON = require(path.join(localRouteDefsInputPath));
|
|
166
243
|
|
|
167
|
-
|
|
244
|
+
routesDefsBase.forEach((route) => {
|
|
168
245
|
const matchedRoute = localRouteDefsInputJSON.filter(newRoute => newRoute.path === route.path)[0];
|
|
169
246
|
if (matchedRoute) {
|
|
170
247
|
tools.logInfo(`-- replacing ${route.path} route entry with overriden local config`);
|
|
@@ -176,7 +253,7 @@ const getRawRoutesDefs = (project, envTargetFinal) => {
|
|
|
176
253
|
});
|
|
177
254
|
}
|
|
178
255
|
} else {
|
|
179
|
-
routes =
|
|
256
|
+
routes = routesDefsBase;
|
|
180
257
|
}
|
|
181
258
|
|
|
182
259
|
return routes;
|
|
@@ -499,8 +576,7 @@ const generateLinks = (project, routes, envTargetFinal) => {
|
|
|
499
576
|
}
|
|
500
577
|
});
|
|
501
578
|
|
|
502
|
-
tools.logInfo(
|
|
503
|
-
console.log(workspaceLinks);
|
|
579
|
+
tools.logInfo(`Workspaces links generated : ${workspaceLinks.length}`);
|
|
504
580
|
|
|
505
581
|
const globalLinks = [
|
|
506
582
|
...routeDefsBaseLinksJSON,
|
|
@@ -525,7 +601,7 @@ const generateLinks = (project, routes, envTargetFinal) => {
|
|
|
525
601
|
const defRoute = getRouteMenuDef(subLink);
|
|
526
602
|
|
|
527
603
|
if (defRoute) {
|
|
528
|
-
if (project.
|
|
604
|
+
if (project.name.indexOf('playground') > 0) {
|
|
529
605
|
const routePathInInputRoutes = routes.filter(r => r.angularRouteDef.path === defRoute.path)[0];
|
|
530
606
|
|
|
531
607
|
if (!routePathInInputRoutes) {
|
|
@@ -545,7 +621,7 @@ const generateLinks = (project, routes, envTargetFinal) => {
|
|
|
545
621
|
const defRoute = getRouteMenuDef(link);
|
|
546
622
|
|
|
547
623
|
if (defRoute) {
|
|
548
|
-
if (project.
|
|
624
|
+
if (project.name.indexOf('playground') > 0) {
|
|
549
625
|
const routePathInInputRoutes = routes.filter(r => r.angularRouteDef.path === defRoute.path)[0];
|
|
550
626
|
|
|
551
627
|
if (!routePathInInputRoutes) {
|
|
@@ -22,17 +22,28 @@ const getPkgVersion = (pkg) => {
|
|
|
22
22
|
return version;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
async function runCommandWithOutput(_args, cwdFolder) {
|
|
26
|
+
const { error, stdout, stderr } = await execa('npm', _args, { cwd: cwdFolder });
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
error, stdout, stderr
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const publishCore = module.exports.publishCore = (pkg, registry, isPublicAccess) => {
|
|
26
34
|
tools.logInfo(`Publishing package "${pkg.name}" from "${pkg.paths.publish}" on ${registry}`);
|
|
27
35
|
|
|
28
|
-
let
|
|
36
|
+
let args = ['publish', pkg.paths.publish, '--registry', registry];
|
|
37
|
+
|
|
38
|
+
// let command = `npm publish ${pkg.paths.publish} --registry ${registry}`;
|
|
29
39
|
|
|
30
40
|
if (isPublicAccess) {
|
|
31
|
-
|
|
41
|
+
args.push('--access public');
|
|
42
|
+
// command += ' --access public';
|
|
32
43
|
}
|
|
33
44
|
|
|
34
45
|
if (dryRun) {
|
|
35
|
-
tools.logInfo(`DRY-RUN: npm publish command to be executed : ${
|
|
46
|
+
tools.logInfo(`DRY-RUN: npm publish command to be executed : ${args}`);
|
|
36
47
|
|
|
37
48
|
return notificationUtils.package.sendPackageMessage({
|
|
38
49
|
package: pkg,
|
|
@@ -41,12 +52,16 @@ const publishCore = (pkg, registry, isPublicAccess) => {
|
|
|
41
52
|
|
|
42
53
|
} else {
|
|
43
54
|
|
|
44
|
-
tools.logInfo(`Executing command : ${
|
|
55
|
+
tools.logInfo(`Executing command : ${args}`);
|
|
45
56
|
|
|
46
57
|
const version = getPkgVersion(pkg);
|
|
47
58
|
|
|
48
|
-
return
|
|
49
|
-
|
|
59
|
+
return runCommandWithOutput(args, process.cwd())
|
|
60
|
+
// return execa.shell(command, { stdio: 'inherit' })
|
|
61
|
+
.then((out) => {
|
|
62
|
+
tools.logInfo('NPM output');
|
|
63
|
+
console.log(out.stdout);
|
|
64
|
+
|
|
50
65
|
tools.logSuccess('OK => Package release succeeded! version : ' + version);
|
|
51
66
|
|
|
52
67
|
return notificationUtils.package.sendPackageMessage({
|
|
@@ -64,19 +79,27 @@ const publishCore = (pkg, registry, isPublicAccess) => {
|
|
|
64
79
|
})
|
|
65
80
|
|
|
66
81
|
.catch((e) => {
|
|
67
|
-
|
|
68
|
-
|
|
82
|
+
// continue publication of other sub-packages in the same group (eUI f.e.) if one of the sub-packages
|
|
83
|
+
// have already been published, as npmjs does not allow re-publication of same pkg version
|
|
84
|
+
if (e.stderr !== undefined && e.stderr.indexOf('You cannot publish over the previously published versions') > -1) {
|
|
85
|
+
console.log('PACKAGE ALREADY PUBLISHED');
|
|
86
|
+
return Promise.resolve();
|
|
69
87
|
|
|
70
|
-
|
|
71
|
-
package
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
} else {
|
|
89
|
+
tools.logError(`Error publishing package "${pkg.name}"`);
|
|
90
|
+
console.log(e.stderr);
|
|
91
|
+
|
|
92
|
+
return notificationUtils.package.sendPackageMessage({
|
|
93
|
+
package: pkg,
|
|
94
|
+
version: version,
|
|
95
|
+
exception: e,
|
|
96
|
+
title: '[PACKAGE RELEASE FAILED]',
|
|
97
|
+
subtitle: `Error while publishing Package to *${registry}*`
|
|
98
|
+
})
|
|
99
|
+
.then(() => {
|
|
100
|
+
process.exit(1);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
80
103
|
});
|
|
81
104
|
}
|
|
82
105
|
}
|