@eui/tools 6.9.3 → 6.9.5
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/.prettierrc.json +1 -1
- package/.version.properties +1 -1
- package/CHANGELOG.md +19 -0
- package/package.json +1 -1
- package/sandbox.js +14 -3
- package/scripts/csdr/audit/yarn.js +0 -2
- package/scripts/csdr/cli/skeletons/package/frontend/15.x/default/dependencies-composite.json +2 -1
- package/scripts/csdr/cli/skeletons/package/frontend/15.x/default/src/lib/components/main.component.html +1 -16
- package/scripts/csdr/cli/skeletons/package/frontend/15.x/default/src/lib/module.ts +6 -5
- package/scripts/csdr/config/packages.js +9 -0
- package/scripts/csdr/config/remotes.js +10 -0
- package/scripts/csdr/init/init.js +6 -7
- package/scripts/csdr/metadata/package.js +6 -1
- package/scripts/csdr/release/package/build-pr-scan.js +1 -1
- package/scripts/csdr/release/package/common.js +29 -10
- package/scripts/csdr/release/package/release-package.js +6 -6
- package/scripts/csdr/release/package/release-ui.js +31 -7
- package/scripts/csdr/release/package/release-virtual-remote.js +1 -1
- package/scripts/csdr/release/package/ui.js +0 -38
- package/scripts/utils/build/package/angular.js +27 -4
- package/scripts/utils/git-utils.js +13 -7
- package/scripts/utils/notification/common.js +12 -3
- package/scripts/utils/notification/package.js +2 -2
- package/scripts/utils/notification/project.js +2 -2
- package/scripts/utils/notification/slack-utils.js +4 -4
- package/scripts/utils/notification/teams-utils.js +62 -22
- package/scripts/utils/tools.js +9 -0
- package/scripts/csdr/init/init-old.js +0 -210
package/.prettierrc.json
CHANGED
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.9.
|
|
1
|
+
6.9.5
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## 6.9.5 (2023-03-20)
|
|
2
|
+
|
|
3
|
+
##### Chores
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* check internally for virtual remotes pkg type build - added skipLock for progressively remove locking of build pkg - MWP-9204 [MWP-9204](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9204) ([be418e4a](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/be418e4acd732c8b251f93423cbf837d62b2ec80))
|
|
7
|
+
|
|
8
|
+
* * *
|
|
9
|
+
* * *
|
|
10
|
+
## 6.9.4 (2023-03-16)
|
|
11
|
+
|
|
12
|
+
##### Chores
|
|
13
|
+
|
|
14
|
+
* **other:**
|
|
15
|
+
* adapted default frontend package skeleton sources - MWP-9204 [MWP-9204](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9204) ([19ca8394](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/19ca839438396da824803dd7538fbedd71279784))
|
|
16
|
+
* adapted ms-teams notifications payload and format - EUI-7146 [EUI-7146](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7146) ([c99a6094](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/c99a6094414366a4ef098c9841780618d2956331))
|
|
17
|
+
|
|
18
|
+
* * *
|
|
19
|
+
* * *
|
|
1
20
|
## 6.9.3 (2023-03-15)
|
|
2
21
|
|
|
3
22
|
##### Bug Fixes
|
package/package.json
CHANGED
package/sandbox.js
CHANGED
|
@@ -1212,11 +1212,22 @@ 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
|
+
// })
|
|
1224
|
+
|
|
1215
1225
|
Promise.resolve()
|
|
1216
1226
|
.then(() => {
|
|
1217
|
-
const
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1227
|
+
const pkgName = 'ppgms-core-eui10-remote-el-ui-not';
|
|
1228
|
+
const remote = configUtils.remotes.isVirtualRemote(pkgName);
|
|
1229
|
+
|
|
1230
|
+
console.log(remote);
|
|
1220
1231
|
})
|
|
1221
1232
|
.catch((e) => {
|
|
1222
1233
|
console.log(e);
|
|
@@ -26,22 +26,7 @@
|
|
|
26
26
|
</eui-page-column-body>
|
|
27
27
|
</eui-page-column>
|
|
28
28
|
|
|
29
|
-
<eui-page-column>
|
|
30
|
-
|
|
31
|
-
<eui-page-column-header-left-content>
|
|
32
|
-
<div class="eui-page-column__header-left-content-label">{{ '@module.scope-name@.SEARCH_RESULT' | translate }}</div>
|
|
33
|
-
</eui-page-column-header-left-content>
|
|
34
|
-
|
|
35
|
-
<eui-page-column-header-right-content>
|
|
36
|
-
<div class="eui-u-flex">
|
|
37
|
-
<button
|
|
38
|
-
euiButton
|
|
39
|
-
euiSecondary>
|
|
40
|
-
<span euiIcon iconClass="eui-icon-refresh"></span>
|
|
41
|
-
<span euiLabel>{{ '@module.scope-name@.CREATE_DOSSIER' | translate }}</span>
|
|
42
|
-
</button>
|
|
43
|
-
</div>
|
|
44
|
-
</eui-page-column-header-right-content>
|
|
29
|
+
<eui-page-column label="{{ '@module.scope-name@.SEARCH_RESULT' | translate }}">
|
|
45
30
|
|
|
46
31
|
<eui-page-column-header-body>
|
|
47
32
|
</eui-page-column-header-body>
|
|
@@ -8,7 +8,11 @@ import { TranslateModule } from '@ngx-translate/core';
|
|
|
8
8
|
import { EuiButtonModule } from '@eui/components/eui-button';
|
|
9
9
|
import { EuiPageModule } from '@eui/components/eui-page';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// -- eUI module imports specific (recommended for treeshakability)
|
|
12
|
+
const EUI_MODULES = [
|
|
13
|
+
EuiButtonModule,
|
|
14
|
+
EuiPageModule,
|
|
15
|
+
];
|
|
12
16
|
|
|
13
17
|
// -- Components --
|
|
14
18
|
import { @module.class.name@Component } from './components/main.component';
|
|
@@ -48,10 +52,7 @@ import { RoutingModule } from './routing-module';
|
|
|
48
52
|
// EffectsModule.forFeature(EFFECTS),
|
|
49
53
|
TranslateModule,
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
EuiPageModule,
|
|
53
|
-
|
|
54
|
-
CcSharedModule,
|
|
55
|
+
...EUI_MODULES,
|
|
55
56
|
],
|
|
56
57
|
declarations: [
|
|
57
58
|
...COMPONENTS,
|
|
@@ -133,6 +133,15 @@ module.exports.getPackage = (pkgName, fromCsdrConfig, optional) => {
|
|
|
133
133
|
pkg.npmPkgName = pkg.npmPkg.substr(pkg.npmPkg.indexOf('/') + 1);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
// check notification method
|
|
137
|
+
if (pkg.notification) {
|
|
138
|
+
if (pkg.notification.client === 'MSTEAMS') {
|
|
139
|
+
pkg.msteamsActive = true;
|
|
140
|
+
} else {
|
|
141
|
+
pkg.msteamsActive = false;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
136
145
|
return pkg;
|
|
137
146
|
}
|
|
138
147
|
|
|
@@ -58,6 +58,16 @@ module.exports.getRemote = (remoteName) => {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
|
|
61
|
+
module.exports.isVirtualRemote = (remoteName) => {
|
|
62
|
+
const remotesConfig = require(path.join(process.cwd(), '.csdr', '.euirc-csdr-remotes.json'));
|
|
63
|
+
const remoteConfig = remotesConfig[remoteName];
|
|
64
|
+
|
|
65
|
+
return remoteConfig !== undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
61
71
|
module.exports.getCsdrRemotes = (hostName, euiVersion) => {
|
|
62
72
|
|
|
63
73
|
const hostNameFilterFn = (r) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const tools = require('../../utils/tools');
|
|
4
|
+
const configUtils = require('../../csdr/config/config-utils');
|
|
4
5
|
|
|
5
6
|
// inner modules
|
|
6
7
|
const innerInitProject = require('./init-project');
|
|
@@ -12,7 +13,7 @@ const innerInitCustom = require('./init-custom');
|
|
|
12
13
|
// Getting arguments if they are provided for the CI/CD pipeline
|
|
13
14
|
const {
|
|
14
15
|
project, team, pkg, branch, configOnly, skipClone, skipInstall, reset, pkgOnly, prjOnly,
|
|
15
|
-
build, containerOnly, skipAppContainers, remote, euiVersion, remoteOnly,
|
|
16
|
+
build, containerOnly, skipAppContainers, remote, euiVersion, remoteOnly, virtual, custom
|
|
16
17
|
} = tools.getArgs();
|
|
17
18
|
|
|
18
19
|
|
|
@@ -23,7 +24,6 @@ module.exports.init = () => {
|
|
|
23
24
|
team: team || 'all',
|
|
24
25
|
pkg: pkg || null,
|
|
25
26
|
remote: remote || null,
|
|
26
|
-
remoteBuild: remoteBuild || false,
|
|
27
27
|
virtual: virtual || false,
|
|
28
28
|
euiVersion: euiVersion || null,
|
|
29
29
|
branch: branch || 'develop',
|
|
@@ -42,18 +42,17 @@ module.exports.init = () => {
|
|
|
42
42
|
// converting inputs args
|
|
43
43
|
initialResponse.branch = tools.convertStringArg(initialResponse.branch, 'develop');
|
|
44
44
|
initialResponse.euiVersion = tools.convertStringArg(initialResponse.euiVersion);
|
|
45
|
-
initialResponse.remoteBuild = tools.convertBooleanArg(initialResponse.remoteBuild);
|
|
46
|
-
initialResponse.virtual = tools.convertBooleanArg(initialResponse.virtual);
|
|
47
|
-
|
|
48
45
|
|
|
49
46
|
// setting project to null if forced to NONE
|
|
50
47
|
if (initialResponse.project === 'NONE') {
|
|
51
48
|
initialResponse.project = null;
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
//
|
|
55
|
-
|
|
51
|
+
// checking if provided PKG (from gitlab) is a virtual remote (new remote kind as of v15 (and sedia v10))
|
|
52
|
+
const isVirtualRemote = configUtils.remotes.isVirtualRemote(initialResponse.pkg);
|
|
53
|
+
if (isVirtualRemote) {
|
|
56
54
|
initialResponse.remote = initialResponse.pkg;
|
|
55
|
+
initialResponse.virtual = true;
|
|
57
56
|
initialResponse.pkg = null;
|
|
58
57
|
}
|
|
59
58
|
|
|
@@ -83,7 +83,12 @@ const storeBuildMetadata = (pkg, pkgVersion, pkgMetadata, envTarget) => {
|
|
|
83
83
|
generatedMetadata.versions = versions;
|
|
84
84
|
|
|
85
85
|
tools.logInfo(`Write metadata on ${pkgMetadataFile}`);
|
|
86
|
-
|
|
86
|
+
if (dryRun) {
|
|
87
|
+
tools.logInfo('DRY-RUN...');
|
|
88
|
+
console.log(generatedMetadata);
|
|
89
|
+
} else {
|
|
90
|
+
tools.writeJsonFileSync(pkgMetadataFile, generatedMetadata);
|
|
91
|
+
}
|
|
87
92
|
})
|
|
88
93
|
|
|
89
94
|
.catch((e) => {
|
|
@@ -134,7 +134,7 @@ module.exports.init = (pkg, envTarget, compositeType) => {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
|
|
137
|
-
module.exports.cloneMetadataRepos = () => {
|
|
137
|
+
module.exports.cloneMetadataRepos = (pkg) => {
|
|
138
138
|
utils.tools.logBanner('CLONE METADATA REPOS');
|
|
139
139
|
|
|
140
140
|
return Promise.resolve()
|
|
@@ -144,7 +144,12 @@ module.exports.cloneMetadataRepos = () => {
|
|
|
144
144
|
})
|
|
145
145
|
// CLONE METADATA LOCKS REPO
|
|
146
146
|
.then(() => {
|
|
147
|
-
|
|
147
|
+
if (pkg.build && pkg.build.skipLock) {
|
|
148
|
+
utils.tools.logInfo('Package has lock de-activated...skipping cloning of devops-metadata-locks repository');
|
|
149
|
+
|
|
150
|
+
} else {
|
|
151
|
+
return metadataUtils.common.cloneMetadataLocksRepo();
|
|
152
|
+
}
|
|
148
153
|
})
|
|
149
154
|
.catch((e) => {
|
|
150
155
|
throw e;
|
|
@@ -182,14 +187,20 @@ module.exports.preReleaseChecks = (pkg) => {
|
|
|
182
187
|
if (!pkg.backend) {
|
|
183
188
|
utils.tools.logTitle('Checking package lock state');
|
|
184
189
|
|
|
185
|
-
// if package is locked, exception is thrown, check this specific exception handling in the global catch
|
|
186
|
-
if (metadataUtils.package.isPackageLocked(pkg)) {
|
|
187
|
-
utils.tools.logInfo('Package is locked ==> throwing exception');
|
|
188
|
-
throw 'PACKAGE_LOCKED';
|
|
189
190
|
|
|
190
|
-
|
|
191
|
+
if (pkg.build && pkg.build.skipLock) {
|
|
192
|
+
utils.tools.logInfo('lock package de-activated...skipping');
|
|
193
|
+
|
|
191
194
|
} else {
|
|
192
|
-
|
|
195
|
+
// if package is locked, exception is thrown, check this specific exception handling in the global catch
|
|
196
|
+
if (metadataUtils.package.isPackageLocked(pkg)) {
|
|
197
|
+
utils.tools.logInfo('Package is locked ==> throwing exception');
|
|
198
|
+
throw 'PACKAGE_LOCKED';
|
|
199
|
+
|
|
200
|
+
// if package is not locked, we lock it
|
|
201
|
+
} else {
|
|
202
|
+
return metadataUtils.package.lockPackage(pkg);
|
|
203
|
+
}
|
|
193
204
|
}
|
|
194
205
|
}
|
|
195
206
|
})
|
|
@@ -656,7 +667,11 @@ module.exports.sendSuccessNotification = (pkg, version, pkgMetadata) => {
|
|
|
656
667
|
if (!pkg.backend) {
|
|
657
668
|
return Promise.resolve()
|
|
658
669
|
.then(() => {
|
|
659
|
-
|
|
670
|
+
if (pkg.build && pkg.build.skipLock) {
|
|
671
|
+
utils.tools.logInfo('lock package de-activated...skipping');
|
|
672
|
+
} else {
|
|
673
|
+
return metadataUtils.package.unlockPackage(pkg);
|
|
674
|
+
}
|
|
660
675
|
})
|
|
661
676
|
.catch((e) => {
|
|
662
677
|
utils.tools.logError('ERROR UNLOCKING PACKAGE');
|
|
@@ -695,7 +710,11 @@ module.exports.sendErrorNotification = (pkg, exception, pkgMetadata) => {
|
|
|
695
710
|
if (exception !== 'PACKAGE_LOCKED') {
|
|
696
711
|
return Promise.resolve()
|
|
697
712
|
.then(() => {
|
|
698
|
-
|
|
713
|
+
if (pkg.build && pkg.build.skipLock) {
|
|
714
|
+
utils.tools.logInfo('lock package de-activated...skipping');
|
|
715
|
+
} else {
|
|
716
|
+
return metadataUtils.package.unlockPackage(pkg);
|
|
717
|
+
}
|
|
699
718
|
})
|
|
700
719
|
.catch((e) => {
|
|
701
720
|
utils.tools.logError('ERROR UNLOCKING PACKAGE');
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// UTILS
|
|
4
4
|
const tools = require('../../../utils/tools');
|
|
5
|
+
const configUtils = require('../../config/config-utils');
|
|
5
6
|
|
|
6
7
|
// INNER MODULES
|
|
7
8
|
const innerReleaseVirtualRemote = require('./release-virtual-remote');
|
|
@@ -12,10 +13,10 @@ module.exports.run = () => {
|
|
|
12
13
|
|
|
13
14
|
// TESTING a release pipeline in DRY-RUN mode :
|
|
14
15
|
// virtual remotes
|
|
15
|
-
// npm run pkg:release mywp-dashboard-eui15-remote-el-ui -- --dryRun --branch master --
|
|
16
|
+
// npm run pkg:release mywp-dashboard-eui15-remote-el-ui -- --dryRun --branch master --envTarget DEV --skipInstall
|
|
16
17
|
|
|
17
18
|
// normal UI package / old style remote
|
|
18
|
-
// npm run pkg:release eui-tools -- --dryRun --branch develop --
|
|
19
|
+
// npm run pkg:release eui-tools -- --dryRun --branch develop --skipLint --skipInstall --skipTest --skipDoc --skipClone --debug --build
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
return Promise.resolve()
|
|
@@ -26,11 +27,10 @@ module.exports.run = () => {
|
|
|
26
27
|
|
|
27
28
|
// CHECKING if release is for virtual remote or normal UI package (including normal remote)
|
|
28
29
|
.then(() => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
virtual = tools.convertBooleanArg(virtual);
|
|
30
|
+
const pkgName = tools.getArgs().root;
|
|
31
|
+
const isVirtualRemote = configUtils.remotes.isVirtualRemote(pkgName);
|
|
32
32
|
|
|
33
|
-
if (
|
|
33
|
+
if (isVirtualRemote) {
|
|
34
34
|
return innerReleaseVirtualRemote.run();
|
|
35
35
|
} else {
|
|
36
36
|
return innerReleaseUi.run();
|
|
@@ -9,6 +9,7 @@ const utils = require('../../../utils');
|
|
|
9
9
|
// CSDR RELATED
|
|
10
10
|
const configUtils = require('../../config/config-utils');
|
|
11
11
|
const metadataUtils = require('../../metadata/metadata-utils');
|
|
12
|
+
const auditUtils = require('../../audit/audit-utils');
|
|
12
13
|
|
|
13
14
|
// INNER MODULES
|
|
14
15
|
const innerCommon = require('./common');
|
|
@@ -51,7 +52,7 @@ module.exports.run = () => {
|
|
|
51
52
|
|
|
52
53
|
// FOR UI and REMOTES clone metadata repositories
|
|
53
54
|
.then(() => {
|
|
54
|
-
return innerCommon.cloneMetadataRepos();
|
|
55
|
+
return innerCommon.cloneMetadataRepos(pkg);
|
|
55
56
|
})
|
|
56
57
|
|
|
57
58
|
// PRE-RELEASE & COMMON CHECKS
|
|
@@ -85,16 +86,39 @@ module.exports.run = () => {
|
|
|
85
86
|
// INSTALL dependencies by type
|
|
86
87
|
.then(() => {
|
|
87
88
|
if (pkg.remote) {
|
|
88
|
-
return
|
|
89
|
+
return Promise.resolve()
|
|
90
|
+
.then(() => {
|
|
91
|
+
return innerRemote.install(pkg, envTarget, compositeType);
|
|
92
|
+
})
|
|
93
|
+
.then((compositeDeps) => {
|
|
94
|
+
// storing for later use
|
|
95
|
+
pkgCompositeDeps = compositeDeps;
|
|
96
|
+
})
|
|
97
|
+
.catch((e) => {
|
|
98
|
+
throw e;
|
|
99
|
+
})
|
|
89
100
|
|
|
90
101
|
} else {
|
|
91
|
-
return
|
|
102
|
+
return Promise.resolve()
|
|
103
|
+
.then(() => {
|
|
104
|
+
return innerUi.install(pkg, branches.isMaster);
|
|
105
|
+
})
|
|
106
|
+
// CHECK STYLES USAGE
|
|
107
|
+
.then(() => {
|
|
108
|
+
if (!pkg.build || (pkg.build && !pkg.build.skipAudit)) {
|
|
109
|
+
return auditUtils.styles.audit(pkg);
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
// AUDIT DEPENDENCIES
|
|
114
|
+
.then(() => {
|
|
115
|
+
return auditUtils.yarn.audit(pkg);
|
|
116
|
+
})
|
|
117
|
+
.catch((e) => {
|
|
118
|
+
throw e;
|
|
119
|
+
})
|
|
92
120
|
}
|
|
93
121
|
})
|
|
94
|
-
.then((compositeDeps) => {
|
|
95
|
-
// storing for later use
|
|
96
|
-
pkgCompositeDeps = compositeDeps;
|
|
97
|
-
})
|
|
98
122
|
|
|
99
123
|
|
|
100
124
|
// BUILD PACKAGE
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// GLOBAL
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const glob = require('glob');
|
|
6
|
-
|
|
7
3
|
// LOCAL
|
|
8
4
|
const installUtils = require('../../install/install-utils');
|
|
9
5
|
const configUtils = require('../../config/config-utils');
|
|
10
|
-
const auditUtils = require('../../audit/audit-utils');
|
|
11
6
|
const tools = require('../../../utils/tools');
|
|
12
7
|
|
|
13
8
|
// ARGS
|
|
@@ -32,39 +27,6 @@ module.exports.install = (pkg, isMaster) => {
|
|
|
32
27
|
return installUtils.buildPackage.installPackage(prj, pkg, isMaster);
|
|
33
28
|
})
|
|
34
29
|
|
|
35
|
-
// CHECK STYLES USAGE
|
|
36
|
-
.then(() => {
|
|
37
|
-
if (!pkg.build || (pkg.build && !pkg.build.skipAudit)) {
|
|
38
|
-
return auditUtils.styles.audit(pkg);
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
// AUDIT DEPENDENCIES
|
|
43
|
-
.then(() => {
|
|
44
|
-
return auditUtils.yarn.audit(pkg);
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
.catch((e) => {
|
|
49
|
-
throw e;
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
module.exports.installOnly = (pkg) => {
|
|
55
|
-
tools.logBanner('INSTALL');
|
|
56
|
-
|
|
57
|
-
return Promise.resolve()
|
|
58
|
-
|
|
59
|
-
// FETCHING CURRENT PACKAGES & INSTALL
|
|
60
|
-
.then(() => {
|
|
61
|
-
// fetch related project if passed as arguments
|
|
62
|
-
const prj = configUtils.projects.getProject();
|
|
63
|
-
|
|
64
|
-
// install the dependencies for current package build
|
|
65
|
-
return installUtils.buildPackage.installPackage(prj, pkg, false);
|
|
66
|
-
})
|
|
67
|
-
|
|
68
30
|
.catch((e) => {
|
|
69
31
|
throw e;
|
|
70
32
|
})
|
|
@@ -16,7 +16,7 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
16
16
|
const ng = path.resolve(process.cwd(), 'node_modules', '@angular', 'cli', 'bin', 'ng');
|
|
17
17
|
|
|
18
18
|
// FETCH ARGS
|
|
19
|
-
let { deps, skipClean, skipLint, skipTest, skipCompile, skipDoc } = pkg.build? {...pkg.build, ...tools.getArgs()} : tools.getArgs();
|
|
19
|
+
let { deps, skipClean, skipLint, skipTest, skipCompile, skipDoc, build } = pkg.build? {...pkg.build, ...tools.getArgs()} : tools.getArgs();
|
|
20
20
|
|
|
21
21
|
return Promise.resolve()
|
|
22
22
|
.then(() => {
|
|
@@ -34,6 +34,7 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
34
34
|
.then(() => {
|
|
35
35
|
if (!skipLint) {
|
|
36
36
|
tools.logInfo('Linting...');
|
|
37
|
+
|
|
37
38
|
const tsLintPath = path.join(pkg.paths.root, 'tslint.json');
|
|
38
39
|
const esLintPath = path.join(pkg.paths.root, '.eslintrc.json');
|
|
39
40
|
|
|
@@ -43,10 +44,19 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
43
44
|
const script = `tslint -c ${tsLintPath} -p ${pkg.paths.tsConfig} -t verbose`
|
|
44
45
|
tools.logInfo(`running ${script}`);
|
|
45
46
|
return tools.runScript(script);
|
|
47
|
+
|
|
46
48
|
} else if(tools.isFileExists(esLintPath)) {
|
|
47
49
|
// the project path information are located inside the .eslintrc.json
|
|
48
50
|
tools.logInfo(`running ng lint ${pkg.name}`);
|
|
49
|
-
|
|
51
|
+
|
|
52
|
+
if (build && pkg.msteamsActive) {
|
|
53
|
+
let args = ['--max_old_space_size=8096', ng, 'lint', pkg.name];
|
|
54
|
+
return tools.runNodeScriptProcessOutput(args, pkg.paths.root);
|
|
55
|
+
|
|
56
|
+
} else {
|
|
57
|
+
return tools.runScript(`ng lint ${pkg.name}`);
|
|
58
|
+
}
|
|
59
|
+
|
|
50
60
|
} else {
|
|
51
61
|
tools.logError(`No ESLint or TSLint configuration found for the project`);
|
|
52
62
|
}
|
|
@@ -59,10 +69,17 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
59
69
|
|
|
60
70
|
if (!skipTest) {
|
|
61
71
|
tools.logInfo('Testing...');
|
|
72
|
+
|
|
62
73
|
let args = ['--max_old_space_size=8096', ng, 'test', pkg.name];
|
|
63
74
|
args.push('--code-coverage');
|
|
64
75
|
tools.logInfo(`running ng test : with args: ${args} on folder : ${pkg.paths.root}`);
|
|
65
|
-
|
|
76
|
+
|
|
77
|
+
if (build && pkg.msteamsActive) {
|
|
78
|
+
return tools.runNodeScriptProcessOutput(args, pkg.paths.root);
|
|
79
|
+
|
|
80
|
+
} else {
|
|
81
|
+
return execa('node', args, { cwd: pkg.paths.root, stdio: 'inherit' });
|
|
82
|
+
}
|
|
66
83
|
}
|
|
67
84
|
})
|
|
68
85
|
.then(() => {
|
|
@@ -74,7 +91,13 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
74
91
|
let args = ['--max_old_space_size=8096', ng, 'build', pkg.name];
|
|
75
92
|
|
|
76
93
|
tools.logInfo(`running ng build : with args: ${args} on folder : ${pkg.paths.root}`);
|
|
77
|
-
|
|
94
|
+
|
|
95
|
+
if (build && pkg.msteamsActive) {
|
|
96
|
+
return tools.runNodeScriptProcessOutput(args, pkg.paths.root);
|
|
97
|
+
|
|
98
|
+
} else {
|
|
99
|
+
return execa('node', args, { cwd: pkg.paths.root, stdio: 'inherit' });
|
|
100
|
+
}
|
|
78
101
|
}
|
|
79
102
|
})
|
|
80
103
|
.then(() => {
|
|
@@ -11,7 +11,7 @@ const { getPackageConfig } = require('./notification/config');
|
|
|
11
11
|
// const versionUtils = require('./version-utils');
|
|
12
12
|
|
|
13
13
|
// FETCH ARGS
|
|
14
|
-
const { dryRun, git, debug } = tools.getArgs();
|
|
14
|
+
const { dryRun, git, debug, build } = tools.getArgs();
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
const getLastTag = (folder) => {
|
|
@@ -105,9 +105,9 @@ const commitAndPush = (branch, message, folder) => {
|
|
|
105
105
|
} catch (e2) {
|
|
106
106
|
tools.logError('ERROR');
|
|
107
107
|
console.log('ERROR!!!');
|
|
108
|
-
if (debug) {
|
|
109
|
-
|
|
110
|
-
}
|
|
108
|
+
// if (debug) {
|
|
109
|
+
// console.log(e2);
|
|
110
|
+
// }
|
|
111
111
|
|
|
112
112
|
try {
|
|
113
113
|
tools.logInfo('Commit and push - second try - retrying pull & push');
|
|
@@ -115,9 +115,9 @@ const commitAndPush = (branch, message, folder) => {
|
|
|
115
115
|
execa.sync('git', ['push', 'origin', branch], { cwd: folder });
|
|
116
116
|
|
|
117
117
|
} catch (e3) {
|
|
118
|
-
if (debug) {
|
|
119
|
-
|
|
120
|
-
}
|
|
118
|
+
// if (debug) {
|
|
119
|
+
// console.log(e3);
|
|
120
|
+
// }
|
|
121
121
|
throw new Error(`Failed to push ${message} to ${folder}`);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -298,6 +298,9 @@ const cloneRepo = (repoUri, folder, forced = false, shallow = false, externalRep
|
|
|
298
298
|
tools.logSuccess();
|
|
299
299
|
})
|
|
300
300
|
.catch((e) => {
|
|
301
|
+
if (!build) {
|
|
302
|
+
console.log(e);
|
|
303
|
+
}
|
|
301
304
|
throw new Error(`Error trying to clone ${repoUri} into ${folder}`);
|
|
302
305
|
})
|
|
303
306
|
}
|
|
@@ -334,6 +337,9 @@ const checkout = (branch, folder, shallow = false) => {
|
|
|
334
337
|
});
|
|
335
338
|
})
|
|
336
339
|
.catch((e) => {
|
|
340
|
+
if (!build) {
|
|
341
|
+
console.log(e);
|
|
342
|
+
}
|
|
337
343
|
throw new Error(`Error trying to checkout ${branch} on ${folder}`);
|
|
338
344
|
})
|
|
339
345
|
}
|
|
@@ -89,9 +89,18 @@ module.exports.getMessage = (options) => {
|
|
|
89
89
|
|
|
90
90
|
default:
|
|
91
91
|
message.detailTitle = 'GENERAL ERROR!';
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
if (options.exception.stderr) {
|
|
93
|
+
try {
|
|
94
|
+
message.detailTextArray = options.exception.stderr.split('\n');
|
|
95
|
+
if (options.exception.stdout) {
|
|
96
|
+
message.detailTextArray = [...message.detailTextArray, ...options.exception.stdout.split('\n')];
|
|
97
|
+
}
|
|
98
|
+
} catch (e) {}
|
|
99
|
+
} else {
|
|
100
|
+
try {
|
|
101
|
+
message.detailTextArray = options.exception.stack.split('\n');
|
|
102
|
+
} catch (e) {};
|
|
103
|
+
}
|
|
95
104
|
};
|
|
96
105
|
|
|
97
106
|
message.detailText = message.detailTextArray.join('\n');
|
|
@@ -12,7 +12,7 @@ const innerConfig = require('./config');
|
|
|
12
12
|
const innerMessageStack = require('./message-stack');
|
|
13
13
|
|
|
14
14
|
// ARGS
|
|
15
|
-
const { debug } = tools.getArgs();
|
|
15
|
+
const { debug, debugNotification} = tools.getArgs();
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
module.exports.sendPackageMessage = (options) => {
|
|
@@ -20,7 +20,7 @@ module.exports.sendPackageMessage = (options) => {
|
|
|
20
20
|
|
|
21
21
|
const message = innerCommon.getMessage(options);
|
|
22
22
|
|
|
23
|
-
if (debug) {
|
|
23
|
+
if (debug && debugNotification) {
|
|
24
24
|
tools.logInfo('Message content :');
|
|
25
25
|
console.log(message);
|
|
26
26
|
}
|
|
@@ -12,7 +12,7 @@ const innerConfig = require('./config');
|
|
|
12
12
|
const innerMessageStack = require('./message-stack');
|
|
13
13
|
|
|
14
14
|
// ARGS
|
|
15
|
-
const { debug } = tools.getArgs();
|
|
15
|
+
const { debug, debugNotification } = tools.getArgs();
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
module.exports.sendProjectMessage = (options) => {
|
|
@@ -21,7 +21,7 @@ module.exports.sendProjectMessage = (options) => {
|
|
|
21
21
|
|
|
22
22
|
const message = innerCommon.getMessage(options);
|
|
23
23
|
|
|
24
|
-
if (debug) {
|
|
24
|
+
if (debug && debugNotification) {
|
|
25
25
|
tools.logInfo('Message content :');
|
|
26
26
|
console.log(message);
|
|
27
27
|
}
|
|
@@ -9,7 +9,7 @@ const HttpsProxyAgent = require('https-proxy-agent');
|
|
|
9
9
|
const tools = require('../tools');
|
|
10
10
|
|
|
11
11
|
// FETCH COMMAND-LINE ARGS
|
|
12
|
-
let { dryRun, slackFeedback, debug } = tools.getArgs();
|
|
12
|
+
let { dryRun, slackFeedback, debug, debugNotification } = tools.getArgs();
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
const PROXY = process.env.http_proxy;
|
|
@@ -46,7 +46,7 @@ const sendMessageCore = (hook, channel, attachments, text = null) => {
|
|
|
46
46
|
if (dryRun || !slackFeedback) {
|
|
47
47
|
tools.logInfo('No notifications config found...skipping');
|
|
48
48
|
|
|
49
|
-
if (debug) {
|
|
49
|
+
if (debug && debugNotification) {
|
|
50
50
|
console.log(JSON.stringify(payload, null, 4));
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -57,7 +57,7 @@ const sendMessageCore = (hook, channel, attachments, text = null) => {
|
|
|
57
57
|
tools.logInfo(`Slack hook: ${hook}`);
|
|
58
58
|
tools.logInfo(`Slack channel: ${channel}`);
|
|
59
59
|
|
|
60
|
-
if (debug) {
|
|
60
|
+
if (debug && debugNotification) {
|
|
61
61
|
console.log(JSON.stringify(payload, null, 4));
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -71,7 +71,7 @@ const sendMessageCore = (hook, channel, attachments, text = null) => {
|
|
|
71
71
|
tools.logInfo('statusCode: ' + res.statusCode);
|
|
72
72
|
tools.logInfo('statusMessage: ' + res.statusMessage);
|
|
73
73
|
|
|
74
|
-
if (debug) {
|
|
74
|
+
if (debug && debugNotification) {
|
|
75
75
|
console.log(util.inspect(res));
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -6,7 +6,7 @@ const apiUtils = require('../api-utils');
|
|
|
6
6
|
const configUtils = require('../../csdr/config/config-utils');
|
|
7
7
|
|
|
8
8
|
// ARGS
|
|
9
|
-
const { dryRun, debug} = tools.getArgs();
|
|
9
|
+
const { dryRun, debug, debugNotification } = tools.getArgs();
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
const getChannelHook = module.exports.getChannelHook = (channelName) => {
|
|
@@ -31,8 +31,9 @@ const getChannelHook = module.exports.getChannelHook = (channelName) => {
|
|
|
31
31
|
const createPayload = (messageContent) => {
|
|
32
32
|
const emojis = {
|
|
33
33
|
rocket: "🚀",
|
|
34
|
+
warning: "⚠",
|
|
34
35
|
sucess: "✅",
|
|
35
|
-
failure: "❌"
|
|
36
|
+
failure: "❌",
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
const statuses = {
|
|
@@ -70,37 +71,76 @@ const createPayload = (messageContent) => {
|
|
|
70
71
|
|
|
71
72
|
// set release sections
|
|
72
73
|
const publications = messageContent.buffer.filter(m => m.text !== null && m.text.indexOf(':rocket:') > -1);
|
|
74
|
+
const stylesReport = messageContent.buffer.filter(m => m.text !== null && m.text.indexOf('STYLES AUDIT REPORT') > -1)[0];
|
|
75
|
+
const dependenciesReport = messageContent.buffer.filter(m => m.text !== null && m.text.indexOf('Dependencies audit') > -1)[0];
|
|
73
76
|
|
|
74
|
-
let sections =
|
|
75
|
-
return {
|
|
76
|
-
"activityTitle": version,
|
|
77
|
-
"facts": [],
|
|
78
|
-
"activityText": p.text.replace(':rocket:', emojis.rocket).replace('- *VERSION*', '')
|
|
79
|
-
}
|
|
80
|
-
});
|
|
77
|
+
let sections = [];
|
|
81
78
|
|
|
82
|
-
if (
|
|
79
|
+
if (status === statuses.success) {
|
|
83
80
|
sections.push({
|
|
84
81
|
"startGroup": true,
|
|
85
|
-
"activityTitle":
|
|
82
|
+
"activityTitle": `${emojis.sucess} PACKAGE BUILD SUCCESS !! ${emojis.sucess}`
|
|
86
83
|
});
|
|
87
|
-
|
|
84
|
+
|
|
85
|
+
publications.forEach((p) => {
|
|
88
86
|
sections.push({
|
|
89
|
-
"
|
|
87
|
+
"activityTitle": `package published : ${version}`,
|
|
88
|
+
"facts": [],
|
|
89
|
+
"activityText": p.text.replace(':rocket:', emojis.rocket).replace('- *VERSION*', '')
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
|
-
}
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
if (dependenciesReport && dependenciesReport.text) {
|
|
94
|
+
sections.push({
|
|
95
|
+
"startGroup": true,
|
|
96
|
+
"activityTitle": "Dependencies vulnerabilities audit",
|
|
97
|
+
"activityText": dependenciesReport.text.replace('"Dependencies audit detected vulnerabilities :', ''),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (stylesReport && stylesReport.text) {
|
|
102
|
+
let stylesReportCleanup;
|
|
103
|
+
stylesReportCleanup = tools.replaceAll(stylesReport.text, ':no_entry:', `${emojis.failure} - INVALID : `);
|
|
104
|
+
stylesReportCleanup = tools.replaceAll(stylesReportCleanup, ':large_green_circle:', `${emojis.sucess} - OK : `);
|
|
105
|
+
stylesReportCleanup = tools.replaceAll(stylesReportCleanup, ':warning:', `${emojis.warning} - WARNING : `);
|
|
106
|
+
stylesReportCleanup = tools.replaceAll(stylesReportCleanup, '\n', '\n\n');
|
|
107
|
+
|
|
100
108
|
sections.push({
|
|
101
|
-
"
|
|
109
|
+
"startGroup": true,
|
|
110
|
+
"activityTitle": "Styles report",
|
|
111
|
+
"activityText": stylesReportCleanup
|
|
102
112
|
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (commitHistory.length > 0) {
|
|
116
|
+
sections.push({
|
|
117
|
+
"activityTitle": "Commit history since last release tag",
|
|
118
|
+
"activityText": commitHistory.slice(0, 25).join(' --- ').substr(0, 7500)
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
} else {
|
|
125
|
+
sections.push({
|
|
126
|
+
"startGroup": true,
|
|
127
|
+
"activityTitle": `${emojis.failure} PACKAGE BUILD ERROR !! ${emojis.failure}`,
|
|
103
128
|
});
|
|
129
|
+
|
|
130
|
+
if (exceptionDetails.length > 0) {
|
|
131
|
+
if (finalMessage.detailText) {
|
|
132
|
+
let exceptionCleanup;
|
|
133
|
+
exceptionCleanup = tools.replaceAll(finalMessage.detailText.substr(0, 7500), '\r', '');
|
|
134
|
+
exceptionCleanup = tools.replaceAll(exceptionCleanup, '\n', ' ---- ');
|
|
135
|
+
exceptionCleanup = tools.replaceAll(exceptionCleanup, '~', '');
|
|
136
|
+
exceptionCleanup = tools.replaceAll(exceptionCleanup, '--', '');
|
|
137
|
+
|
|
138
|
+
sections.push({
|
|
139
|
+
"activityTitle": `${finalMessage.detailTitle}`,
|
|
140
|
+
"activityText": exceptionCleanup,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
104
144
|
}
|
|
105
145
|
|
|
106
146
|
sections.push({
|
|
@@ -136,7 +176,7 @@ module.exports.sendMessage = (config, messageContent) => {
|
|
|
136
176
|
|
|
137
177
|
const payload = createPayload(messageContent);
|
|
138
178
|
|
|
139
|
-
if (debug) {
|
|
179
|
+
if (debug && debugNotification) {
|
|
140
180
|
console.log(JSON.stringify(messageContent, null, 2));
|
|
141
181
|
console.log(JSON.parse(JSON.stringify(payload, null, 2)));
|
|
142
182
|
}
|
package/scripts/utils/tools.js
CHANGED
|
@@ -39,6 +39,14 @@ function runScript(_args, cwdFolder) {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
async function runNodeScriptProcessOutput(_args, cwdFolder) {
|
|
43
|
+
const { error, stdout, stderr } = await execa('node', _args, { cwd: cwdFolder });
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
error, stdout, stderr
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
42
50
|
function getPackages(rootFolder) {
|
|
43
51
|
if (!rootFolder) {
|
|
44
52
|
rootFolder = 'src/packages';
|
|
@@ -817,6 +825,7 @@ module.exports.remove = remove;
|
|
|
817
825
|
module.exports.move = move;
|
|
818
826
|
module.exports.getPackages = getPackages;
|
|
819
827
|
module.exports.runScript = runScript;
|
|
828
|
+
module.exports.runNodeScriptProcessOutput = runNodeScriptProcessOutput;
|
|
820
829
|
module.exports.writeJsonFile = writeJsonFile;
|
|
821
830
|
module.exports.writeJsonFileSync = writeJsonFileSync;
|
|
822
831
|
module.exports.getJsonFileContent = getJsonFileContent;
|
|
@@ -1,210 +0,0 @@
|
|
|
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
|
-
}
|