@eui/tools 6.13.16 → 6.14.1
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 +18 -0
- package/bin/eui-scripts.js +3 -1
- package/bin/scripts/release-app-group.js +5 -0
- package/package.json +1 -1
- package/scripts/csdr/cli/package-prompt.js +94 -93
- package/scripts/csdr/config/global.js +60 -47
- package/scripts/csdr/config/init.js +31 -23
- package/scripts/csdr/config/projects.js +51 -50
- package/scripts/csdr/init/init-projects-group.js +64 -0
- package/scripts/csdr/init/init.js +9 -3
- package/scripts/csdr/init/prompt.js +106 -108
- package/scripts/csdr/init/repos.js +3 -3
- package/scripts/csdr/install/common.js +65 -67
- package/scripts/csdr/install/projects.js +41 -64
- package/scripts/csdr/metadata/app.js +100 -108
- package/scripts/csdr/release/app/release-app-group.js +350 -0
- package/scripts/csdr/release/app/release-app.js +284 -319
- package/scripts/csdr/version/app.js +2 -4
- package/scripts/index.js +9 -0
- package/scripts/utils/build/app/build-app-utils.js +62 -37
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// GLOBAL
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const execa = require('execa');
|
|
6
|
+
|
|
7
|
+
// UTILS
|
|
8
|
+
const utils = require('../../../utils');
|
|
9
|
+
|
|
10
|
+
// CSDR RELATED
|
|
11
|
+
const installUtils = require('../../install/install-utils');
|
|
12
|
+
const metadataUtils = require('../../metadata/metadata-utils');
|
|
13
|
+
const versionUtils = require('../../version/version-utils');
|
|
14
|
+
const configUtils = require('../../config/config-utils');
|
|
15
|
+
|
|
16
|
+
module.exports.run = () => {
|
|
17
|
+
// getting projects from group
|
|
18
|
+
|
|
19
|
+
let { root, projectsGroup, euiVersion, branch } = utils.tools.getArgs();
|
|
20
|
+
|
|
21
|
+
if (!projectsGroup) {
|
|
22
|
+
projectsGroup = root;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// checking branch and envTarget types
|
|
26
|
+
if (branch && typeof branch === 'boolean') {
|
|
27
|
+
branch = null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
utils.tools.logTitle(`Building project group: ${projectsGroup} - eUI version: ${euiVersion} - branch: ${branch}`);
|
|
31
|
+
|
|
32
|
+
if (!projectsGroup || !euiVersion || !branch) {
|
|
33
|
+
throw new Error('ERROR!!!! either projectsGroup or euiVersion or branch have not been provided');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Getting branch flags
|
|
37
|
+
let isSupportSnapshotBranch;
|
|
38
|
+
let isSupportBranch;
|
|
39
|
+
let isSnapshot;
|
|
40
|
+
let isMaster;
|
|
41
|
+
let isSupport;
|
|
42
|
+
|
|
43
|
+
if (branch) {
|
|
44
|
+
isSupportSnapshotBranch = branch !== 'master' && branch.indexOf('support/develop') > -1;
|
|
45
|
+
isSupportBranch = branch !== 'master' && !isSupportSnapshotBranch && branch.indexOf('support/') > -1;
|
|
46
|
+
isSnapshot = branch !== 'master' && !isSupportBranch;
|
|
47
|
+
isMaster = branch === 'master';
|
|
48
|
+
isSupport = branch !== 'master' && branch.indexOf('support/') > -1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// deducting envTarget from branch
|
|
52
|
+
let envTargetGen;
|
|
53
|
+
|
|
54
|
+
if (isSnapshot || isSupportSnapshotBranch) {
|
|
55
|
+
envTargetGen = 'DEV';
|
|
56
|
+
} else {
|
|
57
|
+
envTargetGen = 'PROD';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Starting the release process
|
|
61
|
+
return (
|
|
62
|
+
Promise.resolve()
|
|
63
|
+
.then(() => {
|
|
64
|
+
utils.tools.logVersion();
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
// *****************************************************************
|
|
68
|
+
// RELEASE PACKAGE START
|
|
69
|
+
// *****************************************************************
|
|
70
|
+
.then(() => {
|
|
71
|
+
// Starting the release flow
|
|
72
|
+
console.log('\n\n');
|
|
73
|
+
utils.tools.logTitle('-------------------------------------------------------------');
|
|
74
|
+
utils.tools.logTitle(`Releasing new version of application "${projectsGroup}"`);
|
|
75
|
+
utils.tools.logTitle('-------------------------------------------------------------');
|
|
76
|
+
|
|
77
|
+
// start mailStack
|
|
78
|
+
utils.notification.messageStack.startStack();
|
|
79
|
+
|
|
80
|
+
return utils.notification.project.sendProjectMessage({
|
|
81
|
+
project: projectsGroup,
|
|
82
|
+
text: `:arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: Launching *${projectsGroup}* release projects group for *${envTargetGen}* environment`,
|
|
83
|
+
});
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
// *****************************************************************
|
|
87
|
+
// GET AND CHECK DEVOPS CONFIG
|
|
88
|
+
// *****************************************************************
|
|
89
|
+
.then(() => {
|
|
90
|
+
// check if global flag is enabled, if not enabled, this will throw a GLOBAL_PIPELINE_DISABLED exception
|
|
91
|
+
return metadataUtils.common.isPipelineEnabled();
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
// *****************************************************************
|
|
95
|
+
// GET ALL DEPENDENCIES AND INSTALL ONCE FOR PROJECTS GROUP
|
|
96
|
+
// *****************************************************************
|
|
97
|
+
.then(() => {
|
|
98
|
+
let resolvedDeps = {};
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
Promise.resolve()
|
|
102
|
+
// Getting internal packages deps - project cloned locally
|
|
103
|
+
.then(() => {
|
|
104
|
+
return installUtils.projects.getLocalProjectsDeps();
|
|
105
|
+
})
|
|
106
|
+
.then((deps) => {
|
|
107
|
+
resolvedDeps = { ...resolvedDeps, ...deps };
|
|
108
|
+
})
|
|
109
|
+
// getting internal projects fixed deps if any
|
|
110
|
+
.then(() => {
|
|
111
|
+
return installUtils.projects.getLocalProjectsFixedDeps();
|
|
112
|
+
})
|
|
113
|
+
.then((deps) => {
|
|
114
|
+
resolvedDeps = { ...resolvedDeps, ...deps };
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
// Parse dependencies against carrets ones for projects
|
|
118
|
+
.then(() => {
|
|
119
|
+
const fixedDeps = configUtils.global.getConfigOptions().NPM_FIXED_DEPENDENCIES;
|
|
120
|
+
const configDeps = { ...resolvedDeps, ...fixedDeps };
|
|
121
|
+
return installUtils.common.getResolvedCarretDeps(configDeps, isMaster || isSupport);
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
// Install dependencies
|
|
125
|
+
.then((deps) => {
|
|
126
|
+
return installUtils.common.installDeps(deps);
|
|
127
|
+
})
|
|
128
|
+
);
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
// *****************************************************************
|
|
132
|
+
// RELEASE EACH PROJECTS IN THE GROUP INDIVIDUALLY
|
|
133
|
+
// *****************************************************************
|
|
134
|
+
.then(() => {
|
|
135
|
+
const projects = configUtils.projects.getCsdrProjectsGroupForEuiVersion(projectsGroup, euiVersion);
|
|
136
|
+
|
|
137
|
+
return projects.reduce((promise, project) => {
|
|
138
|
+
return promise.then(() => releaseProject(project, isSnapshot, isSupportBranch, branch));
|
|
139
|
+
}, Promise.resolve());
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
.catch((e) => {
|
|
143
|
+
throw e;
|
|
144
|
+
})
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
const releaseProject = (projectName, isSnapshot, isSupportBranch, branch) => {
|
|
151
|
+
const { dryRun } = utils.tools.getArgs();
|
|
152
|
+
|
|
153
|
+
// fetch the project config based on group name
|
|
154
|
+
const project = configUtils.projects.getProject(projectName);
|
|
155
|
+
|
|
156
|
+
utils.tools.logTitle(`Release group project: ${project.name}`);
|
|
157
|
+
|
|
158
|
+
let newVersion;
|
|
159
|
+
|
|
160
|
+
return (
|
|
161
|
+
Promise.resolve()
|
|
162
|
+
// get release version
|
|
163
|
+
.then(() => {
|
|
164
|
+
utils.tools.logTitle('Getting app new version...');
|
|
165
|
+
|
|
166
|
+
return versionUtils.app.getNewVersion(project, isSnapshot, isSupportBranch);
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
// set the new version found for later use
|
|
170
|
+
.then((version) => {
|
|
171
|
+
newVersion = version;
|
|
172
|
+
utils.tools.logSuccess('New version : ' + newVersion);
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
// update project version
|
|
176
|
+
.then(() => {
|
|
177
|
+
return versionUtils.app.updatePackageVersion(project, newVersion);
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
// update project metadata assets
|
|
181
|
+
.then(() => {
|
|
182
|
+
return metadataUtils.app.storeMetadataAssets(project, newVersion);
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
// build angular project
|
|
186
|
+
.then(() => {
|
|
187
|
+
return utils.buildApp.angular({
|
|
188
|
+
project: project,
|
|
189
|
+
isSnapshot: isSnapshot,
|
|
190
|
+
version: newVersion,
|
|
191
|
+
});
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
// post-build
|
|
195
|
+
.then(() => {
|
|
196
|
+
return utils.buildApp.postBuild(project);
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
// generate distribution for s3
|
|
200
|
+
.then(() => {
|
|
201
|
+
utils.tools.logTitle('Generate distribution list');
|
|
202
|
+
return utils.buildApp.generateProjectDistributionList(project, isSnapshot);
|
|
203
|
+
})
|
|
204
|
+
.then((distJson) => {
|
|
205
|
+
utils.tools.logInfo('Distribution list for project :');
|
|
206
|
+
console.log(distJson);
|
|
207
|
+
|
|
208
|
+
// distributing to s3 buckets
|
|
209
|
+
utils.tools.logTitle('Distributing to S3 buckets');
|
|
210
|
+
|
|
211
|
+
let sourcePath, s3Path;
|
|
212
|
+
|
|
213
|
+
// checking app main dist folder
|
|
214
|
+
if (distJson.folder) {
|
|
215
|
+
utils.tools.logTitle(`Distributing main dist folder: `);
|
|
216
|
+
|
|
217
|
+
sourcePath = project.paths.distPath;
|
|
218
|
+
s3Path = `s3://${distJson.folder}`;
|
|
219
|
+
console.log(`FROM ===> ${sourcePath}`);
|
|
220
|
+
console.log(` TO ===> ${s3Path}`);
|
|
221
|
+
|
|
222
|
+
if (!dryRun) {
|
|
223
|
+
execa.sync('aws', ['s3', 'cp', '--recursive', sourcePath, s3Path]);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// checking docFolder 1
|
|
228
|
+
if (distJson.docFolder1 && distJson.docS3Folder1) {
|
|
229
|
+
utils.tools.logTitle(`Distributing docFolder 1: `);
|
|
230
|
+
|
|
231
|
+
sourcePath = path.join(project.paths.distPath, distJson.docFolder1);
|
|
232
|
+
s3Path = `s3://${distJson.docS3Folder1}`;
|
|
233
|
+
console.log(`FROM ===> ${sourcePath}`);
|
|
234
|
+
console.log(` TO ===> ${s3Path}`);
|
|
235
|
+
|
|
236
|
+
if (!dryRun) {
|
|
237
|
+
execa.sync('aws', ['s3', 'cp', '--recursive', sourcePath, s3Path]);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// checking docFolder 2
|
|
242
|
+
if (distJson.docFolder2 && distJson.docS3Folder2) {
|
|
243
|
+
utils.tools.logTitle(`Distributing docFolder 2: `);
|
|
244
|
+
|
|
245
|
+
sourcePath = path.join(project.paths.distPath, distJson.docFolder2);
|
|
246
|
+
s3Path = `s3://${distJson.docS3Folder2}`;
|
|
247
|
+
console.log(`FROM ===> ${sourcePath}`);
|
|
248
|
+
console.log(` TO ===> ${s3Path}`);
|
|
249
|
+
|
|
250
|
+
if (!dryRun) {
|
|
251
|
+
execa.sync('aws', ['s3', 'cp', '--recursive', sourcePath, s3Path]);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// checking docFolder 3
|
|
256
|
+
if (distJson.docFolder3 && distJson.docS3Folder3) {
|
|
257
|
+
utils.tools.logTitle(`Distributing docFolder 3: `);
|
|
258
|
+
|
|
259
|
+
sourcePath = path.join(project.paths.distPath, distJson.docFolder3);
|
|
260
|
+
s3Path = `s3://${distJson.docS3Folder3}`;
|
|
261
|
+
console.log(`FROM ===> ${sourcePath}`);
|
|
262
|
+
console.log(` TO ===> ${s3Path}`);
|
|
263
|
+
|
|
264
|
+
if (!dryRun) {
|
|
265
|
+
execa.sync('aws', ['s3', 'cp', '--recursive', sourcePath, s3Path]);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
// commit release message
|
|
271
|
+
.then(() => {
|
|
272
|
+
let message;
|
|
273
|
+
if (isSnapshot) {
|
|
274
|
+
message = `chore(pre-release): pre-release v${newVersion} - from CI server`;
|
|
275
|
+
} else {
|
|
276
|
+
message = `chore(release): release v${newVersion} - from CI server`;
|
|
277
|
+
}
|
|
278
|
+
const projectFolder = path.join(process.cwd(), project.folder);
|
|
279
|
+
return utils.git.commitAndPush(branch, message, projectFolder);
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
// tag release
|
|
283
|
+
.then(() => {
|
|
284
|
+
if (!isSnapshot) {
|
|
285
|
+
return utils.git.tagVersion(newVersion, branch, `chore(release): release v${newVersion} - from CI server`, project.folder);
|
|
286
|
+
}
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
// commit back to develop or support/develop
|
|
290
|
+
.then(() => {
|
|
291
|
+
if (!isSnapshot && !isSupportBranch && !isSupportSnapshotBranch) {
|
|
292
|
+
if (project.build && !project.build.masterBranchOnly) {
|
|
293
|
+
return utils.git.mergeMasterToDevelop(project, project.folder);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (isSupportBranch && project.build && project.build.supportSnapshotBranch) {
|
|
298
|
+
utils.tools.logInfo('Branch is support / supportSnapshotBranch config detected');
|
|
299
|
+
return utils.git.mergeSupportToSupportDevelop(project, project.folder, branch, project.build.supportSnapshotBranch);
|
|
300
|
+
}
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
// send notification success
|
|
304
|
+
.then(() => {
|
|
305
|
+
return (
|
|
306
|
+
utils.notification.project
|
|
307
|
+
.sendProjectMessage({
|
|
308
|
+
project: project,
|
|
309
|
+
version: newVersion,
|
|
310
|
+
title: '[APPLICATION BUILD SUCCESS]',
|
|
311
|
+
subtitle: 'Successful build of the application! :)',
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
// store package config in the root folder to send config to gitlab
|
|
315
|
+
.then(() => {
|
|
316
|
+
return utils.notification.config.storeProjectConfig(project);
|
|
317
|
+
})
|
|
318
|
+
|
|
319
|
+
.then(() => {
|
|
320
|
+
utils.notification.messageStack.endStack();
|
|
321
|
+
})
|
|
322
|
+
);
|
|
323
|
+
})
|
|
324
|
+
|
|
325
|
+
// error for the project in group
|
|
326
|
+
.catch((e) => {
|
|
327
|
+
utils.tools.logError(`ERROR!!!! - ${e.message}`);
|
|
328
|
+
console.log(e);
|
|
329
|
+
|
|
330
|
+
return (
|
|
331
|
+
utils.notification.project
|
|
332
|
+
.sendProjectMessage({
|
|
333
|
+
project: project,
|
|
334
|
+
exception: e,
|
|
335
|
+
title: '[APPLICATION BUILD FAILED]',
|
|
336
|
+
subtitle: 'Error building the App container application! :(',
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
// store package config in the root folder to send config to gitlab
|
|
340
|
+
.then(() => {
|
|
341
|
+
return utils.notification.config.storeProjectConfig(project);
|
|
342
|
+
})
|
|
343
|
+
.then(() => {
|
|
344
|
+
utils.notification.messageStack.endStack();
|
|
345
|
+
return utils.notification.messageStack.sendProjectMessage(project);
|
|
346
|
+
})
|
|
347
|
+
);
|
|
348
|
+
})
|
|
349
|
+
);
|
|
350
|
+
};
|