@eui/tools 6.20.10 → 6.20.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.
@@ -1 +1 @@
1
- 6.20.10
1
+ 6.20.12
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 6.20.12 (2024-08-09)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * enable build pipeline for standalone remote elements - EUI-9788 [EUI-9788](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-9788) ([f979d7be](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/f979d7be0836e9feccffb2a7fb9a7c9d63058021))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.20.11 (2024-08-07)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * adapted MSTEAMS notifications to standalone pkg build - EUI-9788 [EUI-9788](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-9788) ([945f63da](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/945f63da34d51d32b73a4a7d6cd310f5a02cc088))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 6.20.10 (2024-08-07)
2
20
 
3
21
  ##### Chores
@@ -39,6 +39,7 @@ const scriptIndex = args.findIndex(
39
39
  x === 'csdr-serve-app' ||
40
40
  x === 'release-package' ||
41
41
  x === 'release-package-standalone' ||
42
+ x === 'release-remote-standalone' ||
42
43
  x === 'release-backend' ||
43
44
  x === 'release-app' ||
44
45
  x === 'release-app-group' ||
@@ -89,6 +90,7 @@ switch (script) {
89
90
  case 'csdr-serve-app':
90
91
  case 'release-package':
91
92
  case 'release-package-standalone':
93
+ case 'release-remote-standalone':
92
94
  case 'release-backend':
93
95
  case 'release-app':
94
96
  case 'release-app-group':
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const releaseRemote = require('../../scripts/csdr/release/package/release-remote-standalone');
4
+
5
+ releaseRemote.run();
package/init.js CHANGED
@@ -8,8 +8,10 @@ console.log('Init tools package symlink...');
8
8
  console.log('----------------------------------------------');
9
9
 
10
10
  const nmSrcPath = path.join(process.cwd(), 'node_modules');
11
+
11
12
  // for testing purpose standalone mode locally
12
13
  // const nmSrcPath = path.join('d:/gitlab/zzz-test-package-ui', 'node_modules');
14
+ // const nmSrcPath = path.join('d:/gitlab/zzz-test-remote-eui18', 'node_modules');
13
15
 
14
16
  const euiNmToolsPath = path.join(nmSrcPath, '@eui', 'tools');
15
17
  const eUIToolsPath = path.join(process.cwd(), 'packages', 'eui-tools');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.20.10",
3
+ "version": "6.20.12",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -12,13 +12,19 @@ const innerGlobal = require('./global');
12
12
  const innerPackages = require('./packages');
13
13
 
14
14
 
15
- module.exports.getRemote = (remoteName) => {
15
+ module.exports.getRemote = (remoteName = null, standalone = false) => {
16
16
  // if not provided as param, we fetch them from the command line (local operations)
17
17
  if (!remoteName) {
18
18
  remoteName = tools.getArgs().root;
19
19
  }
20
20
 
21
- const configOptions = configUtils.global.getConfigOptions();
21
+ let configOptions;
22
+
23
+ if (standalone) {
24
+ configOptions = configUtils.global.getConfigOptionsStandalone();
25
+ } else {
26
+ configOptions = configUtils.global.getConfigOptions();
27
+ }
22
28
 
23
29
  let remotesConfig;
24
30
  let remotePath;
@@ -38,9 +44,18 @@ module.exports.getRemote = (remoteName) => {
38
44
 
39
45
  const remoteRootPath = path.join(process.cwd(), 'remotes', remoteName);
40
46
 
47
+ let csdrFlag, standaloneFlag;
48
+ if (standalone) {
49
+ csdrFlag = false;
50
+ standaloneFlag = true;
51
+ } else {
52
+ csdrFlag = true;
53
+ standaloneFlag = false;
54
+ }
55
+
41
56
  const remote = {
42
- csdr: true,
43
- standlone: false,
57
+ csdr: csdrFlag,
58
+ standalone: standaloneFlag,
44
59
  name: remoteName,
45
60
  element: true,
46
61
  remote: true,
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "allowSyntheticDefaultImports": true,
5
+ "emitDecoratorMetadata": true,
6
+ "outDir": "./out-tsc/app",
7
+ "target": "ES2022",
8
+ "module": "ES2022",
9
+ "skipLibCheck": true,
10
+ "esModuleInterop": true,
11
+ "declaration": false,
12
+ "experimentalDecorators": true,
13
+ "moduleResolution": "bundler",
14
+ "importHelpers": true,
15
+ "sourceMap": true,
16
+ "lib": [
17
+ "ES2022",
18
+ "dom"
19
+ ],
20
+ "types": [
21
+ "node"
22
+ ]
23
+ },
24
+ "exclude": [
25
+ "src/test.ts",
26
+ "**/*.spec.ts"
27
+ ]
28
+ }
@@ -58,8 +58,20 @@ const cloneRemotesConfig = module.exports.cloneRemotesConfig = () => {
58
58
  }
59
59
 
60
60
 
61
+ const cloneRemotesConfigStandalone = module.exports.cloneRemotesConfigStandalone = () => {
62
+ return Promise.resolve()
63
+ .then(() => {
64
+ return gitUtils.cloneRepoStandalone('csdr-config','.config');
65
+ })
66
+
67
+ .catch((e) => {
68
+ throw e;
69
+ })
70
+ }
61
71
 
62
- module.exports.generateVirtualRemote = (remoteName, cloneRemote = true) => {
72
+
73
+
74
+ module.exports.generateVirtualRemote = (remoteName, cloneRemotesConfig = true, standalone = false) => {
63
75
  tools.logTitle('Generating virtual remote');
64
76
 
65
77
  let remote, remotePath, remoteSrcPath, remoteSkeletonRootPath, remoteSkeletonPath;
@@ -72,16 +84,20 @@ module.exports.generateVirtualRemote = (remoteName, cloneRemote = true) => {
72
84
  return Promise.resolve()
73
85
  // clone remotes config if first init
74
86
  .then(() => {
75
- if (cloneRemote) {
76
- if (tools.isDirExists(path.join(process.cwd(), '.csdr'))) {
77
- return cloneRemotesConfig();
87
+ if (cloneRemotesConfig) {
88
+ if (standalone) {
89
+ return cloneRemotesConfigStandalone();
90
+ } else {
91
+ if (tools.isDirExists(path.join(process.cwd(), '.csdr'))) {
92
+ return cloneRemotesConfig();
93
+ }
78
94
  }
79
95
  }
80
96
  })
81
97
 
82
98
  // getting remote config
83
99
  .then(() => {
84
- remote = configUtils.remotes.getRemote(remoteName);
100
+ remote = configUtils.remotes.getRemote(remoteName, standalone);
85
101
 
86
102
  if (!remote) {
87
103
  throw new Error(`Remote ${remoteName} can't be found in the remotes CSDR configuration OR the remotes configs of the project`);
@@ -108,6 +124,8 @@ module.exports.generateVirtualRemote = (remoteName, cloneRemote = true) => {
108
124
  if (remote.build && remote.build.esbuild) {
109
125
  tools.logInfo('Esbuild option detected, replacing angular.json esbuild config');
110
126
  tools.move(path.join(remotePath, 'angular.esbuild.json'), path.join(remotePath, 'angular.json'));
127
+ } else {
128
+ tools.remove(path.join(remotePath, 'angular.esbuild.json'));
111
129
  }
112
130
 
113
131
  // adding the dependendies files
@@ -116,6 +134,13 @@ module.exports.generateVirtualRemote = (remoteName, cloneRemote = true) => {
116
134
  tools.writeJsonFileSync(path.join(remotePath, 'dependencies-base.json'), remote.dependencies.base);
117
135
  }
118
136
 
137
+ // standalone tsconfig replacement
138
+ if (standalone) {
139
+ tools.move(path.join(remotePath, 'tsconfig.app.standalone.json'), path.join(remotePath, 'tsconfig.app.json'));
140
+ } else {
141
+ tools.remove(path.join(remotePath, 'tsconfig.app.standalone.json'));
142
+ }
143
+
119
144
  // adding dependencies per env
120
145
  const envs = ['INT', 'ACC', 'DLT', 'TRN', 'PPD', 'PROD'];
121
146
 
@@ -13,10 +13,14 @@ const innerCommon = require('./common');
13
13
 
14
14
 
15
15
 
16
- const getDeps_DEV = (compositeDeps) => {
16
+ const getDeps_DEV = (compositeDeps, standalone = false) => {
17
17
  return Promise.resolve()
18
18
  .then(() => {
19
- return innerCommon.getResolvedCarretDeps(compositeDeps, false, true);
19
+ if (standalone) {
20
+ return innerCommon.getResolvedCarretDepsStandalone(compositeDeps, false, true);
21
+ } else {
22
+ return innerCommon.getResolvedCarretDeps(compositeDeps, false, true);
23
+ }
20
24
  })
21
25
 
22
26
  .catch((e) => {
@@ -26,11 +30,15 @@ const getDeps_DEV = (compositeDeps) => {
26
30
 
27
31
 
28
32
 
29
- const getDeps_TST = (compositeDeps) => {
33
+ const getDeps_TST = (compositeDeps, standalone = false) => {
30
34
  return Promise.resolve()
31
35
  // Re-mapping the dependencies found against their max "carret" versions found in the base dependencies defs in the project
32
- .then((metadataDeps) => {
33
- return innerCommon.getResolvedCarretDeps(compositeDeps, true, false);
36
+ .then(() => {
37
+ if (standalone) {
38
+ return innerCommon.getResolvedCarretDepsStandalone(compositeDeps, true, false);
39
+ } else {
40
+ return innerCommon.getResolvedCarretDeps(compositeDeps, true, false);
41
+ }
34
42
  })
35
43
 
36
44
  .catch((e) => {
@@ -118,17 +126,19 @@ const getCompositeDepsByEnv = (compositePath, envTarget, envsMetadata, prevEnv,
118
126
 
119
127
  module.exports.getCompositeDeps = (
120
128
  compositePath,
129
+ envsMetadata,
121
130
  envTarget = 'DEV',
122
- envsMetadata
131
+ standalone = false,
123
132
  ) => {
124
133
 
134
+ tools.logInfo('install.compositeCore.getCompositeDeps');
125
135
  tools.logInfo(`Processing installation at : ${compositePath} for env: ${envTarget}`);
126
136
 
127
137
  return Promise.resolve()
128
138
  // getting root composite - dependencies-composite.json content
129
139
  .then(() => {
130
140
  const compositeJsonFile = path.join(process.cwd(), compositePath, 'dependencies-composite.json');
131
- var compositeDeps = tools.getJsonFileContent(compositeJsonFile) || {};
141
+ const compositeDeps = tools.getJsonFileContent(compositeJsonFile) || {};
132
142
 
133
143
  if (compositeDeps.dependencies) {
134
144
  return compositeDeps.dependencies;
@@ -144,7 +154,7 @@ module.exports.getCompositeDeps = (
144
154
  * including : SNAPSHOTS & LATEST
145
155
  */
146
156
  if (envTarget === 'DEV') {
147
- return getDeps_DEV(compositeDeps);
157
+ return getDeps_DEV(compositeDeps, standalone);
148
158
  }
149
159
 
150
160
 
@@ -153,7 +163,7 @@ module.exports.getCompositeDeps = (
153
163
  * including : LATEST
154
164
  */
155
165
  if (envTarget === 'TST') {
156
- return getDeps_TST(compositeDeps);
166
+ return getDeps_TST(compositeDeps, standalone);
157
167
  }
158
168
 
159
169
 
@@ -23,8 +23,8 @@ const getDeps = (module.exports.getDeps = (prj, envTarget) => {
23
23
  .then((envsMetadata) => {
24
24
  return innerCompositeCore.getCompositeDeps(
25
25
  prj.folder,
26
+ envsMetadata,
26
27
  envTarget,
27
- envsMetadata
28
28
  );
29
29
  })
30
30
 
@@ -149,6 +149,8 @@ const pkgInstall = (pkg, envTarget) => {
149
149
 
150
150
 
151
151
  const getDeps = module.exports.getDeps = (pkg, envTarget) => {
152
+ tools.logInfo('install.remotes.getDeps');
153
+
152
154
  return Promise.resolve()
153
155
  .then(() => {
154
156
  return metadataUtils.remotePackage.getMetadataEnvs(pkg);
@@ -156,8 +158,9 @@ const getDeps = module.exports.getDeps = (pkg, envTarget) => {
156
158
  .then((envsMetadata) => {
157
159
  return innerCompositeCore.getCompositeDeps(
158
160
  pkg.paths.fromRoot,
161
+ envsMetadata,
159
162
  envTarget,
160
- envsMetadata
163
+ pkg.standalone
161
164
  );
162
165
  })
163
166
 
@@ -52,3 +52,27 @@ module.exports.cloneMetadataLocksRepo = () => {
52
52
  })
53
53
  }
54
54
  }
55
+
56
+
57
+ module.exports.cloneMetadataRepoStandalone = () => {
58
+ const configOptions = configUtils.global.getConfigOptionsStandalone();
59
+
60
+ tools.logTitle('Cloning devops metadata repo');
61
+
62
+ if (dryRun || skipClone) {
63
+ tools.logInfo('DRY-RUN: cloning skipped');
64
+ return Promise.resolve();
65
+
66
+ } else {
67
+ return Promise.resolve()
68
+ .then(() => {
69
+ return gitUtils.cloneRepoStandalone(
70
+ configOptions.DEVOPS_METADATA_REPOSITORY,
71
+ configOptions.DEVOPS_METADATA_PATH
72
+ );
73
+ })
74
+ .catch((e) => {
75
+ throw e;
76
+ })
77
+ }
78
+ }
@@ -34,7 +34,14 @@ module.exports.storeMetadata = (pkg, pkgVersion, pkgCompositeDeps, duration, env
34
34
  };
35
35
 
36
36
  module.exports.getMetadataVersions = (pkg) => {
37
- const DEVOPS_METADATA_PATH = configUtils.global.getConfigOptions().DEVOPS_METADATA_PATH;
37
+ let DEVOPS_METADATA_PATH;
38
+
39
+ if (pkg.standalone) {
40
+ DEVOPS_METADATA_PATH = configUtils.global.getConfigOptionsStandalone().DEVOPS_METADATA_PATH;
41
+ } else {
42
+ DEVOPS_METADATA_PATH = configUtils.global.getConfigOptions().DEVOPS_METADATA_PATH;
43
+ }
44
+
38
45
 
39
46
  return Promise.resolve()
40
47
  .then(() => {
@@ -55,7 +62,14 @@ const storeMetadataVersions = (pkg, pkgVersion, pkgCompositeDeps, duration, envT
55
62
  .then(() => {
56
63
  tools.logInfo('Storing package version history metadata...');
57
64
 
58
- const configOptions = configUtils.global.getConfigOptions();
65
+ let configOptions;
66
+
67
+ if (pkg.standalone) {
68
+ configOptions = configUtils.global.getConfigOptionsStandalone();
69
+ } else {
70
+ configOptions = configUtils.global.getConfigOptions();
71
+ }
72
+
59
73
 
60
74
  let generatedMetadata = {};
61
75
  let versions = [];
@@ -161,7 +175,15 @@ module.exports.storeMetadataAssets = (pkg, pkgCompositeDeps) => {
161
175
 
162
176
 
163
177
  module.exports.getMetadataEnvs = (pkg) => {
164
- const DEVOPS_METADATA_PATH = configUtils.global.getConfigOptions().DEVOPS_METADATA_PATH;
178
+ tools.logInfo('metadata.remotePackage.getMetadataEnvs');
179
+
180
+ let DEVOPS_METADATA_PATH;
181
+
182
+ if (pkg.standalone) {
183
+ DEVOPS_METADATA_PATH = configUtils.global.getConfigOptionsStandalone().DEVOPS_METADATA_PATH;
184
+ } else {
185
+ DEVOPS_METADATA_PATH = configUtils.global.getConfigOptions().DEVOPS_METADATA_PATH;
186
+ }
165
187
 
166
188
  return Promise.resolve()
167
189
  .then(() => {
@@ -181,7 +203,15 @@ module.exports.getMetadataEnvs = (pkg) => {
181
203
  const storeMetadataEnvs = (pkg, newVersion, metadata, envTarget) => {
182
204
  const releaseDate = moment(new Date()).format("DD/MM/YYYY HH:mm");
183
205
  const infos = `${newVersion} - ${releaseDate}`;
184
- const DEVOPS_METADATA_PATH = configUtils.global.getConfigOptions().DEVOPS_METADATA_PATH;
206
+
207
+ let DEVOPS_METADATA_PATH;
208
+
209
+ if (pkg.standalone) {
210
+ DEVOPS_METADATA_PATH = configUtils.global.getConfigOptionsStandalone().DEVOPS_METADATA_PATH;
211
+ } else {
212
+ DEVOPS_METADATA_PATH = configUtils.global.getConfigOptions().DEVOPS_METADATA_PATH;
213
+ }
214
+
185
215
 
186
216
  return Promise.resolve()
187
217
  .then(() => {
@@ -523,7 +523,7 @@ module.exports.runGitOperations = (pkg, version) => {
523
523
 
524
524
  // authenticate for standalone pkg
525
525
  if (pkg.standalone) {
526
- utils.git.authenticate(pkg, pkg.paths.root);
526
+ utils.git.setRepoUrlStandalone(pkg, pkg.paths.root);
527
527
  }
528
528
 
529
529
  if (pkg.remote && pkg.build && pkg.build.envTargetActive) {
@@ -557,7 +557,14 @@ module.exports.runGitOperations = (pkg, version) => {
557
557
 
558
558
  module.exports.commitMetadata = (pkg, version) => {
559
559
 
560
- const configOptions = configUtils.global.getConfigOptions();
560
+ let configOptions;
561
+
562
+ if (pkg.standalone) {
563
+ configOptions = configUtils.global.getConfigOptionsStandalone();
564
+ } else{
565
+ configOptions = configUtils.global.getConfigOptions();
566
+ }
567
+
561
568
 
562
569
  return Promise.resolve()
563
570
  .then(() => {
@@ -1,24 +1,172 @@
1
1
  'use strict';
2
2
 
3
3
  // UTILS
4
- const tools = require('../../../utils/tools');
4
+ const utils = require('../../../utils');
5
+
6
+ // CSDR RELATED
5
7
  const configUtils = require('../../config/config-utils');
8
+ const auditUtils = require('../../audit/audit-utils');
9
+ const initUtils = require('../../init/init-utils');
10
+ const installUtils = require('../../install/install-utils');
6
11
 
7
12
  // INNER MODULES
8
- const innerReleaseUiStandalone = require('./release-ui-standalone');
13
+ const innerCommon = require('./common');
14
+
15
+
16
+ // LOCAL TEST :
17
+ // - symlink eUI tools sources to node_modules of standalone pkg folder node_modules to test
18
+ // - execute this command on the standalone pkg folder :
19
+ // npx @eui/tools release-package-standalone --dryRun --pkgName zzz-test-package-ui --branch develop --debug --debugNotification --skipCommitsCheck --skipPublish --skipGitUpdates --skipLint --skipTest
9
20
 
10
21
 
11
22
  module.exports.run = () => {
12
- return Promise.resolve()
13
- .then(() => {
14
- tools.logVersion();
15
- })
16
-
17
- .then(() => {
18
- return innerReleaseUiStandalone.run();
19
- })
20
-
21
- .catch((e) => {
22
- throw e;
23
- })
24
- }
23
+ const { dryRun } = utils.tools.getArgs();
24
+
25
+ utils.tools.logBanner('Starting UI package stand-alone pipeline');
26
+
27
+ // utils.tools.logTitle('Provided arguments : ');
28
+ // console.log(utils.tools.getArgs());
29
+
30
+ // local saved vars
31
+ let newVersion, commitsMetadata;
32
+
33
+ // getting the package information - mimics CSDR package config
34
+ const pkg = configUtils.packages.getStandalonePackage();
35
+
36
+ // get branches config
37
+ const branches = innerCommon.getBranches();
38
+
39
+ return (
40
+ Promise.resolve()
41
+ // RELEASE PACKAGE START
42
+
43
+ .then(() => {
44
+ utils.tools.logVersion();
45
+ })
46
+
47
+ // Starting the release flow
48
+ .then(() => {
49
+ return innerCommon.initMessage(pkg, branches);
50
+ })
51
+
52
+ // CHECK BRANCH VALIDITY
53
+ .then(() => {
54
+ innerCommon.checkBranchValidity(branches);
55
+ })
56
+
57
+ // COMMIT METADATA CHECKS
58
+ .then(() => {
59
+ return innerCommon.commitMetadataChecks(pkg);
60
+ })
61
+ .then((metadata) => {
62
+ commitsMetadata = metadata;
63
+ })
64
+
65
+ // SPECIFIC INJECTION FOR STANDALONE PKG ROOT FILES
66
+ .then(() => {
67
+ return initUtils.packages.injectStandaloneResources(pkg);
68
+ })
69
+
70
+ // INIT PACKAGE CONFIG
71
+ .then(() => {
72
+ // generating angular.json config if not existing
73
+ configUtils.angular.checkAngularConfig();
74
+
75
+ // registering package angular config
76
+ configUtils.angular.registerAngularPackage(pkg);
77
+ })
78
+
79
+ // INIT ROOT FILES - yarn lock and resolution based on current eUI version of the package
80
+ .then(() => {
81
+ const euiVersion = configUtils.packages.getPackageEuiVersion(pkg);
82
+ return initUtils.global.initRootFilesAndResolutions(euiVersion);
83
+ })
84
+
85
+ // INSTALL dependencies by type
86
+ .then(() => {
87
+ utils.tools.logBanner('INSTALL DEPENDENCIES');
88
+
89
+ return (
90
+ Promise.resolve()
91
+ .then(() => {
92
+ return installUtils.packages.installDepsStandalone(pkg, branches.isMaster);
93
+ })
94
+
95
+ // auditing dependencies
96
+ .then(() => {
97
+ return auditUtils.yarn.audit(pkg);
98
+ })
99
+ .catch((e) => {
100
+ throw e;
101
+ })
102
+ );
103
+ })
104
+
105
+ // BUILD PACKAGE
106
+ .then(() => {
107
+ return utils.buildPackage.build(pkg, branches.isMaster, false);
108
+ })
109
+
110
+ // EXECUTING SONAR ANALYSIS
111
+ // .then(() => {
112
+ // return utils.sonar.run(pkg, branches.isMaster);
113
+ // })
114
+
115
+ // GENERATE and UPDATE new version
116
+ .then(() => {
117
+ return innerCommon.updateVersion(pkg, commitsMetadata);
118
+ })
119
+ .then((version) => {
120
+ // storing version for later use
121
+ newVersion = version;
122
+ })
123
+
124
+ // GENERATE CHANGELOG
125
+ .then(() => {
126
+ utils.tools.logTitle('generating changelog...');
127
+ return utils.changelog.generate(pkg, newVersion, commitsMetadata.commits);
128
+ })
129
+
130
+ // WRITE CHANGELOG for MASTER and SUPPORT
131
+ .then((changelogContent) => {
132
+ utils.tools.logTitle('writing changelog...');
133
+
134
+ if ((branches.isSupport || branches.isNext || branches.isMaster) && !dryRun) {
135
+ return utils.changelog.writeChangelog(changelogContent, pkg.paths.root);
136
+
137
+ } else {
138
+ utils.tools.logInfo('WRITING SKIPPED - (either DRY-RUN or snapshot release) - Actual changelog :');
139
+ console.log(changelogContent);
140
+ }
141
+ })
142
+
143
+ // PUBLISH PACKAGE
144
+ .then(() => {
145
+ return utils.publish.publish(pkg);
146
+ })
147
+
148
+ // GIT OPERATIONS
149
+ .then(() => {
150
+ return innerCommon.runGitOperations(pkg, newVersion);
151
+ })
152
+
153
+ // SEND SUCCESS NOTIFICATION
154
+ .then(() => {
155
+ return innerCommon.sendSuccessNotification(pkg, newVersion, commitsMetadata, false).then(() => {
156
+ return innerCommon.close(pkg);
157
+ });
158
+ })
159
+
160
+ // SEND ERROR NOTIFICATION
161
+ .catch((e) => {
162
+ return innerCommon
163
+ .sendErrorNotification(pkg, e, commitsMetadata, false)
164
+ .then(() => {
165
+ return innerCommon.close(pkg);
166
+ })
167
+ .then(() => {
168
+ process.exit(1);
169
+ });
170
+ })
171
+ );
172
+ };
@@ -0,0 +1,197 @@
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 initUtils = require('../../init/init-utils');
11
+ const configUtils = require('../../config/config-utils');
12
+ const metadataUtils = require('../../metadata/metadata-utils');
13
+ const installUtils = require('../../install/install-utils');
14
+ const versionUtils = require('../../version/version-utils');
15
+
16
+
17
+ // INNER MODULES
18
+ const innerCommon = require('./common');
19
+
20
+ // LOCAL TEST :
21
+ // - symlink eUI tools sources to node_modules of standalone pkg folder node_modules to test
22
+ // - execute this command on the standalone pkg folder :
23
+ // npx @eui/tools release-remote-standalone --remoteName zzz-test-remote-eui18 --dryRun --debug --debugNotification
24
+
25
+
26
+
27
+ module.exports.run = () => {
28
+ utils.tools.logBanner('Starting standalone virtual remote pipeline');
29
+
30
+ const { remoteName, envTarget } = utils.tools.getArgs();
31
+
32
+ if (!remoteName) {
33
+ throw new Error('remoteName not provided as pipeline argument');
34
+ }
35
+
36
+ if (!envTarget) {
37
+ throw new Error('envTarget not provided as pipeline argument');
38
+ }
39
+
40
+
41
+ // get branches config
42
+ const branches = innerCommon.getBranches();
43
+
44
+ // local saved vars
45
+ let pkg, newVersion, pkgCompositeDeps;
46
+
47
+ return Promise.resolve()
48
+ // START PIPELINE
49
+ .then(() => {
50
+ utils.tools.logVersion();
51
+ })
52
+
53
+ // CLONE CONFIG REPOSITORY - for gathering central remotes config
54
+ .then(() => {
55
+ return initUtils.remotes.cloneRemotesConfigStandalone();
56
+ })
57
+
58
+ // GET REMOTE OBJECT
59
+ .then(() => {
60
+ pkg = configUtils.remotes.getRemote(remoteName, true);
61
+ })
62
+
63
+ // GENERATE THE VURTUAL REMOTE
64
+ .then(() => {
65
+ return initUtils.remotes.generateVirtualRemote(remoteName, false, true);
66
+ })
67
+
68
+ // INITIATE MESSAGE STACK
69
+ .then(() => {
70
+ return innerCommon.initMessage(pkg, branches, envTarget);
71
+ })
72
+
73
+ // CLONE METADATA FOR remote build history
74
+ .then(() => {
75
+ return metadataUtils.common.cloneMetadataRepoStandalone();
76
+ })
77
+
78
+ // INSTALL dependencies by type
79
+ .then(() => {
80
+ return installUtils.buildPackage.installRemote(pkg, envTarget);
81
+ })
82
+ .then((compositeDeps) => {
83
+ // storing for later use
84
+ pkgCompositeDeps = compositeDeps;
85
+ })
86
+
87
+ // BUILD THE REMOTE
88
+ .then(() => {
89
+ return utils.buildPackage.build(pkg, true);
90
+ })
91
+
92
+ // UPDATE VERSION
93
+ .then(() => {
94
+ return innerCommon.updateVersion(pkg, null, envTarget);
95
+ })
96
+ .then((version) => {
97
+ // storing version for later use
98
+ newVersion = version;
99
+ })
100
+
101
+ .then(() => {
102
+ return innerCommon.postBuild(pkg, newVersion);
103
+ })
104
+
105
+
106
+ // STORING METADATA ASSETS
107
+ .then(() => {
108
+ return innerCommon.storeMetadataAssets(pkg, pkgCompositeDeps);
109
+ })
110
+
111
+
112
+ // PUBLISH PACKAGE
113
+ .then(() => {
114
+ return utils.publish.publish(pkg);
115
+ })
116
+
117
+
118
+ // EXECUTING POST PUBLISH SCRIPT IF AVAILABLE
119
+ .then(() => {
120
+ return utils.publish.postPublish(pkg);
121
+ })
122
+
123
+
124
+ // STORING CENTRALIZED METADATA
125
+ .then(() => {
126
+ // get run duration
127
+ const duration = utils.pipeline.getTimerDuration();
128
+
129
+ // store envs + versions for virtual remotes
130
+ return metadataUtils.remotePackage.storeMetadata(pkg, newVersion, pkgCompositeDeps, duration, envTarget);
131
+ })
132
+
133
+
134
+ // // GENERATE DIFF REPORT
135
+ // .then(() => {
136
+ // let metadata;
137
+
138
+ // if (envTarget !== 'DEV') {
139
+ // return Promise.resolve()
140
+ // .then(() => {
141
+ // return metadataUtils.remoteHistory.generateDiffCommitsMetadataReport(pkg, envTarget);
142
+ // })
143
+ // .then((output) => {
144
+ // metadata = output;
145
+ // })
146
+ // .then(() => {
147
+ // return utils.notification.package.sendPackageDiffReportMessage(
148
+ // pkg,
149
+ // metadata.diffsMetadata
150
+ // );
151
+ // })
152
+ // .then(() => {
153
+ // return metadataUtils.remoteHistory.storeMetadataHistory(pkg, metadata, newVersion);
154
+ // })
155
+ // .then(() => {
156
+ // if (metadata.commitsMetadata && metadata.commitsMetadata.issues) {
157
+ // return metadataUtils.remoteHistory.generatePipelineIssuesList(metadata.commitsMetadata.issues);
158
+ // }
159
+ // })
160
+ // .catch((e) => {
161
+ // utils.tools.logError('Error generating diffs report for current remote processed :');
162
+ // console.log(e);
163
+ // })
164
+ // }
165
+ // })
166
+
167
+
168
+ // COMMITING METADATA
169
+ .then(() => {
170
+ return innerCommon.commitMetadata(pkg, newVersion);
171
+ })
172
+
173
+
174
+ // EXPORT ADDITIONAL PIPELINE VARIABLES
175
+ .then(() => {
176
+ return innerCommon.exportPipelineVariables(pkg);
177
+ })
178
+
179
+ // SEND SUCCESS NOTIFICATION
180
+ .then(() => {
181
+ return innerCommon.sendSuccessNotification(pkg, newVersion)
182
+ .then(() => {
183
+ return innerCommon.close(pkg);
184
+ });
185
+ })
186
+
187
+ // SEND ERROR NOTIFICATION
188
+ .catch((e) => {
189
+ return innerCommon.sendErrorNotification(pkg, e)
190
+ .then(() => {
191
+ return innerCommon.close(pkg);
192
+ })
193
+ .then(() => {
194
+ process.exit(1);
195
+ })
196
+ })
197
+ }
package/scripts/index.js CHANGED
@@ -150,6 +150,8 @@ module.exports.realeaseApp = require('./csdr/release/app/release-app');
150
150
  module.exports.realeaseAppGroup = require('./csdr/release/app/release-app-group');
151
151
  module.exports.releasePackageCommon = require('./csdr/release/package/common');
152
152
  module.exports.releasePackage = require('./csdr/release/package/release-package');
153
+ module.exports.releasePackageStandalone = require('./csdr/release/package/release-package-standalone');
154
+ module.exports.releaseRemoteeStandalone = require('./csdr/release/package/release-remote-standalone');
153
155
  module.exports.releaseBackend = require('./csdr/release/package/release-backend');
154
156
  module.exports.releaseUi = require('./csdr/release/package/release-ui');
155
157
  module.exports.releaseOldRemote = require('./csdr/release/package/release-old-remote');
@@ -19,7 +19,7 @@ module.exports.build = (pkg, isMaster) => {
19
19
  const remoteEuiVersion = configUtils.packages.getPackageEuiVersion(pkg, true);
20
20
  const pkgName = pkg.name;
21
21
 
22
- tools.logTitle(`Building element : ${pkgName}...`);
22
+ tools.logTitle(`Building remote element : ${pkgName}...`);
23
23
 
24
24
  return Promise.resolve()
25
25
  .then(() => {
@@ -2,18 +2,16 @@
2
2
 
3
3
  // GLOBAL
4
4
  const execa = require('execa');
5
+ const path = require('path');
5
6
  const semver = require('semver');
6
7
 
7
8
  // LOCAL
8
9
  const tools = require('./tools');
9
10
  const configUtils = require('../csdr/config/config-utils');
10
- const { getPackageConfig } = require('./notification/config');
11
- // const versionUtils = require('./version-utils');
12
11
 
13
12
  // FETCH ARGS
14
13
  const { dryRun, git, debug, debugGitUpdates, build, skipGitUpdates } = tools.getArgs();
15
14
 
16
-
17
15
  const getLastTag = (folder) => {
18
16
  return Promise.resolve()
19
17
  .then(() => {
@@ -272,8 +270,8 @@ const getGitHost = (externalRepo) => {
272
270
  return '';
273
271
  }
274
272
 
275
- const authenticate = (pkg, folder) => {
276
- tools.logTitle('GIT authentication');
273
+ const setRepoUrlStandalone = (pkg, folder) => {
274
+ tools.logTitle('Set remote url stanadlone repo');
277
275
 
278
276
  const auth = process.env.gituser && process.env.gitpassword ? `${process.env.gituser}:${process.env.gitpassword}@` : '';
279
277
  const gitHost = configUtils.global.getConfigOptionsStandalone().GIT_HOST_REMOTE;
@@ -287,6 +285,31 @@ const authenticate = (pkg, folder) => {
287
285
  }
288
286
 
289
287
 
288
+ const cloneRepoStandalone = (repoName, destinationFolder) => {
289
+ tools.logTitle('Cloning standalone repo');
290
+
291
+ const folder = process.cwd();
292
+ const auth = process.env.gituser && process.env.gitpassword ? `${process.env.gituser}:${process.env.gitpassword}@` : '';
293
+ const gitHost = configUtils.global.getConfigOptionsStandalone().GIT_HOST_REMOTE;
294
+
295
+ if (!tools.isDirExists(destinationFolder)) {
296
+ tools.logInfo(`executing : for host: ${gitHost} - repoName: ${repoName}`);
297
+
298
+ if (skipGitUpdates) {
299
+ tools.logInfo('DRY RUN - skipping');
300
+ } else {
301
+ execa.sync('git', ['clone', `https://${auth}${gitHost}${repoName}.git`, destinationFolder], { cwd: folder, stdio: 'inherit'});
302
+ }
303
+ }
304
+
305
+ const pullFolder = path.join(folder, destinationFolder);
306
+
307
+ execa.shellSync(`git pull`, { cwd: pullFolder, stdio: 'inherit' });
308
+ }
309
+
310
+
311
+
312
+
290
313
 
291
314
  const cloneRepo = (repoUri, folder, forced = false, shallow = false, externalRepo = false) => {
292
315
  if (!repoUri) {
@@ -332,6 +355,7 @@ const cloneRepo = (repoUri, folder, forced = false, shallow = false, externalRep
332
355
  }
333
356
 
334
357
 
358
+
335
359
  const checkout = (branch, folder, shallow = false) => {
336
360
  tools.logInfo(`Checking out branch ${branch} in folder "${folder}"...`)
337
361
 
@@ -451,7 +475,8 @@ module.exports.tagVersion = tagVersion;
451
475
  module.exports.mergeMasterToDevelop = mergeMasterToDevelop;
452
476
  module.exports.mergeSupportToSupportDevelop = mergeSupportToSupportDevelop;
453
477
  module.exports.cloneRepo = cloneRepo;
454
- module.exports.authenticate = authenticate;
478
+ module.exports.setRepoUrlStandalone = setRepoUrlStandalone;
479
+ module.exports.cloneRepoStandalone = cloneRepoStandalone;
455
480
  module.exports.checkout = checkout;
456
481
  module.exports.cloneAndCheckout = cloneAndCheckout;
457
482
  module.exports.getLastCommitAuthor = getLastCommitAuthor;
@@ -44,7 +44,7 @@ module.exports.pushMessage = (message) => {
44
44
  }
45
45
 
46
46
 
47
- const sendMessage = (config) => {
47
+ const sendMessage = (config, standalone = false) => {
48
48
  if (config.CLIENT === 'SLACK') {
49
49
  return Promise.resolve();
50
50
  }
@@ -52,7 +52,7 @@ const sendMessage = (config) => {
52
52
  return Promise.resolve()
53
53
  .then(() => {
54
54
  if (config.CLIENT === 'MSTEAMS') {
55
- return innerTeamsUtils.sendMessage(config, messageContent);
55
+ return innerTeamsUtils.sendMessage(config, messageContent, standalone);
56
56
  }
57
57
  })
58
58
  .catch((e) => {
@@ -71,7 +71,7 @@ module.exports.sendPackageMessage = (pkg) => {
71
71
 
72
72
  return Promise.resolve()
73
73
  .then(() => {
74
- return sendMessage(config);
74
+ return sendMessage(config, pkg.standalone);
75
75
  })
76
76
  .catch((e) => {
77
77
  throw e;
@@ -180,7 +180,7 @@ const createPayload = (messageContent) => {
180
180
  }
181
181
 
182
182
 
183
- module.exports.sendMessage = (config, messageContent) => {
183
+ module.exports.sendMessage = (config, messageContent, standalone = false) => {
184
184
  tools.logTitle('Sending MS teams message');
185
185
 
186
186
  const channelHook = getChannelHook(config.MSTEAMS_CHANNEL);
@@ -198,7 +198,13 @@ module.exports.sendMessage = (config, messageContent) => {
198
198
 
199
199
  return Promise.resolve()
200
200
  .then(() => {
201
- const host = configUtils.global.getConfigOptions().MSTEAMS_HOST;
201
+ let host;
202
+
203
+ if (standalone) {
204
+ host = configUtils.global.getConfigOptionsStandalone().MSTEAMS_HOST;
205
+ } else {
206
+ host = configUtils.global.getConfigOptions().MSTEAMS_HOST;
207
+ }
202
208
 
203
209
  return apiUtils.post(host, channelHook, JSON.parse(JSON.stringify(payload, null, 2)));
204
210
  })
@@ -12,11 +12,11 @@ const initUtils = require('../../csdr/init/init-utils');
12
12
  module.exports.preBuild = (pkg, build = false) => {
13
13
  return Promise.resolve()
14
14
  .then(() => {
15
- tools.logTitle('PRE-BUILD : preparing the element...')
15
+ tools.logTitle('PRE-BUILD : preparing the remote element...')
16
16
  })
17
17
 
18
18
  .then(() => {
19
- if (pkg.virtual) {
19
+ if (pkg.virtual && !pkg.standalone) {
20
20
  return initUtils.remotes.generateVirtualRemote(pkg.name, false);
21
21
  }
22
22
  })
@@ -1,169 +0,0 @@
1
- 'use strict';
2
-
3
- // UTILS
4
- const utils = require('../../../utils');
5
-
6
- // CSDR RELATED
7
- const configUtils = require('../../config/config-utils');
8
- const auditUtils = require('../../audit/audit-utils');
9
- const initUtils = require('../../init/init-utils');
10
- const installUtils = require('../../install/install-utils');
11
-
12
- // INNER MODULES
13
- const innerCommon = require('./common');
14
-
15
-
16
- // LOCAL TEST :
17
- // - symlink eUI tools sources to node_modules of standalone pkg folder node_modules to test
18
- // - execute this command on the standalone pkg folder :
19
- // npx @eui/tools release-package-standalone --dryRun --pkgName zzz-test-package-ui --branch develop --debug --debugNotification --skipCommitsCheck --skipPublish --skipGitUpdates --skipLint --skipTest
20
-
21
-
22
- module.exports.run = () => {
23
- const { dryRun } = utils.tools.getArgs();
24
-
25
- utils.tools.logBanner('Starting UI stand-alone pipeline');
26
-
27
- // utils.tools.logTitle('Provided arguments : ');
28
- // console.log(utils.tools.getArgs());
29
-
30
- // local saved vars
31
- let newVersion, commitsMetadata;
32
-
33
- // getting the package information - mimics CSDR package config
34
- const pkg = configUtils.packages.getStandalonePackage();
35
-
36
- // get branches config
37
- const branches = innerCommon.getBranches();
38
-
39
- return (
40
- Promise.resolve()
41
-
42
- // RELEASE PACKAGE START
43
-
44
- // Starting the release flow
45
- .then(() => {
46
- return innerCommon.initMessage(pkg, branches);
47
- })
48
-
49
- // CHECK BRANCH VALIDITY
50
- .then(() => {
51
- innerCommon.checkBranchValidity(branches);
52
- })
53
-
54
- // COMMIT METADATA CHECKS
55
- .then(() => {
56
- return innerCommon.commitMetadataChecks(pkg);
57
- })
58
- .then((metadata) => {
59
- commitsMetadata = metadata;
60
- })
61
-
62
- // SPECIFIC INJECTION FOR STANDALONE PKG ROOT FILES
63
- .then(() => {
64
- return initUtils.packages.injectStandaloneResources(pkg);
65
- })
66
-
67
- // INIT PACKAGE CONFIG
68
- .then(() => {
69
- // generating angular.json config if not existing
70
- configUtils.angular.checkAngularConfig();
71
-
72
- // registering package angular config
73
- configUtils.angular.registerAngularPackage(pkg);
74
- })
75
-
76
- // INIT ROOT FILES - yarn lock and resolution based on current eUI version of the package
77
- .then(() => {
78
- const euiVersion = configUtils.packages.getPackageEuiVersion(pkg);
79
- return initUtils.global.initRootFilesAndResolutions(euiVersion);
80
- })
81
-
82
- // INSTALL dependencies by type
83
- .then(() => {
84
- utils.tools.logBanner('INSTALL DEPENDENCIES');
85
-
86
- return (
87
- Promise.resolve()
88
- .then(() => {
89
- return installUtils.packages.installDepsStandalone(pkg, branches.isMaster);
90
- })
91
-
92
- // auditing dependencies
93
- .then(() => {
94
- return auditUtils.yarn.audit(pkg);
95
- })
96
- .catch((e) => {
97
- throw e;
98
- })
99
- );
100
- })
101
-
102
- // BUILD PACKAGE
103
- .then(() => {
104
- return utils.buildPackage.build(pkg, branches.isMaster, false);
105
- })
106
-
107
- // EXECUTING SONAR ANALYSIS
108
- // .then(() => {
109
- // return utils.sonar.run(pkg, branches.isMaster);
110
- // })
111
-
112
- // GENERATE and UPDATE new version
113
- .then(() => {
114
- return innerCommon.updateVersion(pkg, commitsMetadata);
115
- })
116
- .then((version) => {
117
- // storing version for later use
118
- newVersion = version;
119
- })
120
-
121
- // GENERATE CHANGELOG
122
- .then(() => {
123
- utils.tools.logTitle('generating changelog...');
124
- return utils.changelog.generate(pkg, newVersion, commitsMetadata.commits);
125
- })
126
-
127
- // WRITE CHANGELOG for MASTER and SUPPORT
128
- .then((changelogContent) => {
129
- utils.tools.logTitle('writing changelog...');
130
-
131
- if ((branches.isSupport || branches.isNext || branches.isMaster) && !dryRun) {
132
- return utils.changelog.writeChangelog(changelogContent, pkg.paths.root);
133
-
134
- } else {
135
- utils.tools.logInfo('WRITING SKIPPED - (either DRY-RUN or snapshot release) - Actual changelog :');
136
- console.log(changelogContent);
137
- }
138
- })
139
-
140
- // PUBLISH PACKAGE
141
- .then(() => {
142
- return utils.publish.publish(pkg);
143
- })
144
-
145
- // GIT OPERATIONS
146
- .then(() => {
147
- return innerCommon.runGitOperations(pkg, newVersion);
148
- })
149
-
150
- // SEND SUCCESS NOTIFICATION
151
- .then(() => {
152
- return innerCommon.sendSuccessNotification(pkg, newVersion, commitsMetadata, false).then(() => {
153
- return innerCommon.close(pkg);
154
- });
155
- })
156
-
157
- // SEND ERROR NOTIFICATION
158
- .catch((e) => {
159
- return innerCommon
160
- .sendErrorNotification(pkg, e, commitsMetadata, false)
161
- .then(() => {
162
- return innerCommon.close(pkg);
163
- })
164
- .then(() => {
165
- process.exit(1);
166
- });
167
- })
168
- );
169
- };