@eui/tools 6.2.10 → 6.2.12

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.
@@ -97,38 +97,40 @@ module.exports.init = (pkg, envTarget, compositeType) => {
97
97
  }
98
98
  }
99
99
 
100
+
101
+
100
102
  return Promise.resolve()
101
103
 
102
- // Starting the release flow
103
- .then(() => {
104
- // initiating mail buffer
105
- utils.notification.mailstack.startMailStack();
104
+ // Starting the release flow
105
+ .then(() => {
106
+ // initiating mail buffer
107
+ utils.notification.mailstack.startMailStack();
106
108
 
107
- // run start
108
- console.log('\n\n');
109
- utils.tools.logTitle('-------------------------------------------------------------------------------');
110
- utils.tools.logTitle(`Releasing new version of package "${pkg.name}" on branch "${branches.branch}"`);
111
- utils.tools.logTitle('-------------------------------------------------------------------------------');
109
+ // run start
110
+ console.log('\n\n');
111
+ utils.tools.logTitle('-------------------------------------------------------------------------------');
112
+ utils.tools.logTitle(`Releasing new version of package "${pkg.name}" on branch "${branches.branch}"`);
113
+ utils.tools.logTitle('-------------------------------------------------------------------------------');
112
114
 
113
- console.log(pkg);
115
+ console.log(pkg);
114
116
 
115
- let launchMessage = ':arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward:';
117
+ let launchMessage = ':arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward:';
116
118
 
117
- if (pkg.remote) {
118
- launchMessage += ` Launching remote *${pkg.name}* release for ENV: *${envTarget}* - compositeType: *${compositeType}*`;
119
- } else {
120
- launchMessage += ` Launching *${pkg.name}* release for branch *${branches.branch}*`;
121
- }
119
+ if (pkg.remote) {
120
+ launchMessage += ` Launching remote *${pkg.name}* release for ENV: *${envTarget}* - compositeType: *${compositeType}*`;
121
+ } else {
122
+ launchMessage += ` Launching *${pkg.name}* release for branch *${branches.branch}*`;
123
+ }
122
124
 
123
- return utils.notification.package.sendPackageMessage({
124
- package: pkg,
125
- text: launchMessage
126
- });
127
- })
125
+ return utils.notification.package.sendPackageMessage({
126
+ package: pkg,
127
+ text: launchMessage
128
+ });
129
+ })
128
130
 
129
- .catch((e) => {
130
- throw e;
131
- })
131
+ .catch((e) => {
132
+ throw e;
133
+ })
132
134
  }
133
135
 
134
136
 
@@ -257,47 +259,52 @@ module.exports.updateVersion = (pkg, pkgMetadata, envTarget) => {
257
259
  const branches = this.getBranches();
258
260
 
259
261
  // local vars
260
- var newVersion;
262
+ let newVersion;
261
263
 
262
- return Promise.resolve()
264
+ let metadataCommits;
263
265
 
264
- // GET NEW VERSION from VALID commits found in metadata
265
- .then(() => {
266
- return versionUtils.package.getNewVersion(
267
- pkg,
268
- pkgMetadata.commits,
269
- (branches.isSnapshot || branches.isSupportSnapshot),
270
- branches.isNext,
271
- branches.isSupport,
272
- branches.isHotfix,
273
- envTarget
274
- );
275
- })
266
+ if (pkgMetadata) {
267
+ metadataCommits = pkgMetadata.commits;
268
+ }
276
269
 
270
+ return Promise.resolve()
271
+ // GET NEW VERSION from VALID commits found in metadata
272
+ .then(() => {
273
+ return versionUtils.package.getNewVersion(
274
+ pkg,
275
+ metadataCommits,
276
+ (branches.isSnapshot || branches.isSupportSnapshot),
277
+ branches.isNext,
278
+ branches.isSupport,
279
+ branches.isHotfix,
280
+ envTarget
281
+ );
282
+ })
277
283
 
278
- // UPDATE PACKAGE VERSION with the new generated one
279
- .then((version) => {
280
- newVersion = version;
281
284
 
282
- return versionUtils.package.updateVersion(
283
- pkg,
284
- version,
285
- (branches.isSnapshot || branches.isSupportSnapshot),
286
- branches.isNext,
287
- branches.isSupport,
288
- branches.isHotfix,
289
- envTarget
290
- );
291
- })
285
+ // UPDATE PACKAGE VERSION with the new generated one
286
+ .then((version) => {
287
+ newVersion = version;
292
288
 
293
- // returning new version generated
294
- .then(() => {
295
- return newVersion;
296
- })
289
+ return versionUtils.package.updateVersion(
290
+ pkg,
291
+ version,
292
+ (branches.isSnapshot || branches.isSupportSnapshot),
293
+ branches.isNext,
294
+ branches.isSupport,
295
+ branches.isHotfix,
296
+ envTarget
297
+ );
298
+ })
297
299
 
298
- .catch((e) => {
299
- throw e;
300
- })
300
+ // returning new version generated
301
+ .then(() => {
302
+ return newVersion;
303
+ })
304
+
305
+ .catch((e) => {
306
+ throw e;
307
+ })
301
308
 
302
309
  }
303
310
 
@@ -474,7 +481,7 @@ module.exports.storeMetadata = (pkg, version, pkgMetadata, pkgCompositeDeps, dur
474
481
  .then(() => {
475
482
  return metadataUtils.package.storeMetadata(
476
483
  pkg, version, pkgMetadata,
477
- branches.isSnapshot, branches.isMaster, branches.isSupport, branches.isNext, branches.isSupportSnapshot, branches.isHotfix,
484
+ branches,
478
485
  pkgCompositeDeps,
479
486
  duration,
480
487
  envTarget
@@ -1,207 +1,43 @@
1
1
  'use strict';
2
2
 
3
- // GLOBAL
4
- const path = require('path');
5
-
6
3
  // UTILS
7
- const utils = require('../../../utils');
8
-
9
- // CSDR RELATED
10
- const configUtils = require('../../config/config-utils');
11
- const metadataUtils = require('../../metadata/metadata-utils');
4
+ const tools = require('../../../utils/tools');
12
5
 
13
6
  // INNER MODULES
14
- const innerCommon = require('./common');
15
- const innerUi = require('./ui');
16
- const innerRemote = require('./remote');
7
+ const innerReleaseVirtualRemote = require('./release-virtual-remote');
8
+ const innerReleaseUi = require('./release-ui');
17
9
 
18
10
 
19
11
  module.exports.run = () => {
20
12
 
21
- // fetching package from config based on default arg
22
- const pkg = configUtils.packages.getPackage();
23
-
24
- // checking if the package can be retrieved from args
25
- if (!pkg.name) {
26
- utils.tools.logError('ERROR : "package" NOT PROVIDED as argument !!!');
27
- process.exit(1);
28
- }
29
-
30
- // Get branches flags
31
- const branches = innerCommon.getBranches();
32
-
33
- // Get envTarget (used by remotes)
34
- const envTarget = innerCommon.getEnvTarget();
35
-
36
- // Get compositeType (used by remotes)
37
- const compositeType = innerCommon.getCompositeType();
38
-
39
-
40
- // local saved vars
41
- var newVersion, pkgMetadata, pkgCompositeDeps;
42
-
43
-
44
- return Promise.resolve()
45
- // LOGGING CURRENT eUI TOOLS VERSION
46
- .then(() => {
47
- utils.tools.logVersion();
48
- })
49
-
50
- // RELEASE PACKAGE START
51
- .then(() => {
52
- return innerCommon.init(pkg, envTarget, compositeType);
53
- })
54
-
55
- // FOR UI and REMOTES clone metadata repositories
56
- .then(() => {
57
- return innerCommon.cloneMetadataRepos();
58
- })
59
-
60
- // PRE-RELEASE & COMMON CHECKS
61
- .then(() => {
62
- return innerCommon.preReleaseChecks(pkg);
63
- })
64
-
65
- // FETCHING COMMITS METADATA
66
- .then(() => {
67
- return metadataUtils.commit.getMetadata(pkg);
68
- })
69
- .then((metadata) => {
70
- pkgMetadata = metadata;
71
- })
72
-
73
- // COMMIT METADATA CHECKS
74
- .then(() => {
75
- return innerCommon.commitMetadataChecks(pkg);
76
- })
77
- .then((metadata) => {
78
- pkgMetadata = metadata;
79
- })
80
-
81
-
82
- // EXECUTING PRE BUILD SCRIPT IF AVAILABLE
83
- .then(() => {
84
- return innerCommon.preBuild(pkg);
85
- })
86
-
87
-
88
- // INSTALL dependencies by type
89
- .then(() => {
90
- if (pkg.remote) {
91
- return innerRemote.install(pkg, envTarget, compositeType);
92
-
93
- } else {
94
- return innerUi.install(pkg, branches.isMaster);
95
- }
96
- })
97
- .then((compositeDeps) => {
98
- // storing for later use
99
- pkgCompositeDeps = compositeDeps;
100
- })
101
-
102
-
103
- // BUILD PACKAGE
104
- .then(() => {
105
- return utils.buildPackage.build(pkg, branches.isMaster);
106
- })
107
-
108
-
109
- // EXECUTING SONAR ANALYSIS
110
- .then(() => {
111
- return utils.sonar.run(pkg, branches.isMaster);
112
- })
113
-
114
-
115
- // GENERATE and UPDATE new version
116
- .then(() => {
117
- return innerCommon.updateVersion(pkg, pkgMetadata, envTarget);
118
- })
119
- .then((version) => {
120
- // storing version for later use
121
- newVersion = version;
122
- })
123
-
124
-
125
- // GENERATE CHANGELOG
126
- .then(() => {
127
- if (!pkg.remote) {
128
- return innerCommon.generateChangelog(pkg, newVersion, pkgMetadata);
129
- }
130
- })
131
-
132
-
133
- // EXECUTING GLOBAL POST BUILD
134
- .then(() => {
135
- return innerCommon.postBuild(pkg, newVersion);
136
- })
137
-
138
-
139
- // STORING METADATA ASSETS
140
- .then(() => {
141
- return innerCommon.storeMetadataAssets(pkg, pkgCompositeDeps);
142
- })
143
-
144
-
145
- // PUBLISH PACKAGE
146
- .then(() => {
147
- return utils.publish.publish(pkg);
148
- })
149
-
150
-
151
- // EXECUTING POST PUBLISH SCRIPT IF AVAILABLE
152
- .then(() => {
153
- return utils.publish.postPublish(pkg);
154
- })
155
-
156
-
157
-
158
- // GIT OPERATIONS
159
- .then(() => {
160
- return innerCommon.runGitOperations(pkg, newVersion);
161
- })
162
-
163
- // STORING CENTRALIZED METADATA
164
- .then(() => {
165
- // get run duration
166
- const duration = utils.pipeline.getTimerDuration();
167
- return innerCommon.storeMetadata(pkg, newVersion, pkgMetadata, pkgCompositeDeps, duration, envTarget);
168
- })
169
-
170
- // STORING PACKAGE HISTORY
171
- .then(() => {
172
- if (branches.isMaster && pkg.remote) {
173
- return innerCommon.generateDiffReport(pkg, newVersion);
174
- }
175
- })
13
+ // TESTING a release pipeline in DRY-RUN mode :
14
+ // virtual remotes
15
+ // npm run pkg:release mywp-dashboard -- --euiVersion 15.x --dryRun --branch master --remoteBuild true --virtual true --envTarget DEV --skipInstall
176
16
 
177
- // COMMITING METADATA
178
- .then(() => {
179
- return innerCommon.commitMetadata(pkg, newVersion);
180
- })
17
+ // normal UI package / old style remote
18
+ // npm run pkg:release csdr-core-ui -- --dryRun --branch develop --skipInstall
181
19
 
182
- .catch((e) => {
183
- throw e;
184
- })
185
20
 
21
+ return Promise.resolve()
22
+ // LOGGING CURRENT eUI TOOLS VERSION
23
+ .then(() => {
24
+ tools.logVersion();
25
+ })
186
26
 
187
- // EXPORT ADDITIONAL PIPELINE VARIABLES
188
- .then(() => {
189
- return innerCommon.exportPipelineVariables(pkg, compositeType);
190
- })
27
+ // CHECKING if release is for virtual remote or normal UI package (including normal remote)
28
+ .then(() => {
29
+ let { remoteBuild, virtual } = tools.getArgs();
30
+ remoteBuild = tools.convertBooleanArg(remoteBuild);
31
+ virtual = tools.convertBooleanArg(virtual);
191
32
 
192
- // SEND SUCCESS NOTIFICATION
193
- .then(() => {
194
- return innerCommon.sendSuccessNotification(pkg, newVersion, pkgMetadata)
195
- .then(() => {
196
- innerCommon.close(pkg);
197
- });
198
- })
33
+ if (remoteBuild && virtual) {
34
+ return innerReleaseVirtualRemote.run();
35
+ } else {
36
+ return innerReleaseUi.run();
37
+ }
38
+ })
199
39
 
200
- .catch((e) => {
201
- return innerCommon.sendErrorNotification(pkg, e, pkgMetadata)
202
- .then(() => {
203
- innerCommon.close(pkg);
204
- process.exit(1);
205
- });
206
- })
40
+ .catch((e) => {
41
+ throw e;
42
+ })
207
43
  }
@@ -0,0 +1,199 @@
1
+ 'use strict';
2
+
3
+ // GLOBAL
4
+ const path = require('path');
5
+
6
+ // UTILS
7
+ const utils = require('../../../utils');
8
+
9
+ // CSDR RELATED
10
+ const configUtils = require('../../config/config-utils');
11
+ const metadataUtils = require('../../metadata/metadata-utils');
12
+
13
+ // INNER MODULES
14
+ const innerCommon = require('./common');
15
+ const innerUi = require('./ui');
16
+ const innerRemote = require('./remote');
17
+
18
+
19
+ module.exports.run = () => {
20
+ utils.tools.logBanner('Starting UI pipeline');
21
+
22
+ // fetching package from config based on default arg
23
+ const pkg = configUtils.packages.getPackage();
24
+
25
+ // checking if the package can be retrieved from args
26
+ if (!pkg.name) {
27
+ utils.tools.logError('ERROR : "package" NOT PROVIDED as argument !!!');
28
+ process.exit(1);
29
+ }
30
+
31
+ // Get branches flags
32
+ const branches = innerCommon.getBranches();
33
+
34
+ // Get envTarget (used by remotes)
35
+ const envTarget = innerCommon.getEnvTarget();
36
+
37
+ // Get compositeType (used by remotes)
38
+ const compositeType = innerCommon.getCompositeType();
39
+
40
+
41
+ // local saved vars
42
+ var newVersion, pkgMetadata, pkgCompositeDeps;
43
+
44
+
45
+ return Promise.resolve()
46
+
47
+ // RELEASE PACKAGE START
48
+ .then(() => {
49
+ return innerCommon.init(pkg, envTarget, compositeType);
50
+ })
51
+
52
+ // FOR UI and REMOTES clone metadata repositories
53
+ .then(() => {
54
+ return innerCommon.cloneMetadataRepos();
55
+ })
56
+
57
+ // PRE-RELEASE & COMMON CHECKS
58
+ .then(() => {
59
+ return innerCommon.preReleaseChecks(pkg);
60
+ })
61
+
62
+ // FETCHING COMMITS METADATA
63
+ .then(() => {
64
+ return metadataUtils.commit.getMetadata(pkg);
65
+ })
66
+ .then((metadata) => {
67
+ pkgMetadata = metadata;
68
+ })
69
+
70
+ // COMMIT METADATA CHECKS
71
+ .then(() => {
72
+ return innerCommon.commitMetadataChecks(pkg);
73
+ })
74
+ .then((metadata) => {
75
+ pkgMetadata = metadata;
76
+ })
77
+
78
+
79
+ // EXECUTING PRE BUILD SCRIPT IF AVAILABLE
80
+ .then(() => {
81
+ return innerCommon.preBuild(pkg);
82
+ })
83
+
84
+
85
+ // INSTALL dependencies by type
86
+ .then(() => {
87
+ if (pkg.remote) {
88
+ return innerRemote.install(pkg, envTarget, compositeType);
89
+
90
+ } else {
91
+ return innerUi.install(pkg, branches.isMaster);
92
+ }
93
+ })
94
+ .then((compositeDeps) => {
95
+ // storing for later use
96
+ pkgCompositeDeps = compositeDeps;
97
+ })
98
+
99
+
100
+ // BUILD PACKAGE
101
+ .then(() => {
102
+ return utils.buildPackage.build(pkg, branches.isMaster);
103
+ })
104
+
105
+
106
+ // EXECUTING SONAR ANALYSIS
107
+ .then(() => {
108
+ return utils.sonar.run(pkg, branches.isMaster);
109
+ })
110
+
111
+
112
+ // GENERATE and UPDATE new version
113
+ .then(() => {
114
+ return innerCommon.updateVersion(pkg, pkgMetadata, envTarget);
115
+ })
116
+ .then((version) => {
117
+ // storing version for later use
118
+ newVersion = version;
119
+ })
120
+
121
+
122
+ // GENERATE CHANGELOG
123
+ .then(() => {
124
+ if (!pkg.remote) {
125
+ return innerCommon.generateChangelog(pkg, newVersion, pkgMetadata);
126
+ }
127
+ })
128
+
129
+
130
+ // EXECUTING GLOBAL POST BUILD
131
+ .then(() => {
132
+ return innerCommon.postBuild(pkg, newVersion);
133
+ })
134
+
135
+
136
+ // STORING METADATA ASSETS
137
+ .then(() => {
138
+ return innerCommon.storeMetadataAssets(pkg, pkgCompositeDeps);
139
+ })
140
+
141
+
142
+ // PUBLISH PACKAGE
143
+ .then(() => {
144
+ return utils.publish.publish(pkg);
145
+ })
146
+
147
+
148
+ // EXECUTING POST PUBLISH SCRIPT IF AVAILABLE
149
+ .then(() => {
150
+ return utils.publish.postPublish(pkg);
151
+ })
152
+
153
+
154
+
155
+ // GIT OPERATIONS
156
+ .then(() => {
157
+ return innerCommon.runGitOperations(pkg, newVersion);
158
+ })
159
+
160
+ // STORING CENTRALIZED METADATA
161
+ .then(() => {
162
+ // get run duration
163
+ const duration = utils.pipeline.getTimerDuration();
164
+ return innerCommon.storeMetadata(pkg, newVersion, pkgMetadata, pkgCompositeDeps, duration, envTarget);
165
+ })
166
+
167
+ // STORING PACKAGE HISTORY
168
+ .then(() => {
169
+ if (branches.isMaster && pkg.remote) {
170
+ return innerCommon.generateDiffReport(pkg, newVersion);
171
+ }
172
+ })
173
+
174
+ // COMMITING METADATA
175
+ .then(() => {
176
+ return innerCommon.commitMetadata(pkg, newVersion);
177
+ })
178
+
179
+ // EXPORT ADDITIONAL PIPELINE VARIABLES
180
+ .then(() => {
181
+ return innerCommon.exportPipelineVariables(pkg, compositeType);
182
+ })
183
+
184
+ // SEND SUCCESS NOTIFICATION
185
+ .then(() => {
186
+ return innerCommon.sendSuccessNotification(pkg, newVersion, pkgMetadata)
187
+ .then(() => {
188
+ innerCommon.close(pkg);
189
+ });
190
+ })
191
+
192
+ .catch((e) => {
193
+ return innerCommon.sendErrorNotification(pkg, e, pkgMetadata)
194
+ .then(() => {
195
+ innerCommon.close(pkg);
196
+ process.exit(1);
197
+ });
198
+ })
199
+ }