@eui/tools 6.19.3 → 6.20.0

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.19.3
1
+ 6.20.0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## 6.20.0 (2024-08-06)
2
+
3
+ ##### New Features
4
+
5
+ * **other:**
6
+ * adapted for standalone UI package build - outside of CSDR context - EUI-9788 [EUI-9788](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-9788) ([a5722b57](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/a5722b571a3badc537be342565fe1c866962dee5))
7
+ ##### Bug Fixes
8
+
9
+ * **other:**
10
+ * typo ([8d450274](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/8d45027465fb228e83127678ae33d81ce4a926b9))
11
+
12
+ * * *
13
+ * * *
1
14
  ## 6.19.3 (2024-07-27)
2
15
 
3
16
  ##### Chores
@@ -38,6 +38,7 @@ const scriptIndex = args.findIndex(
38
38
  x === 'csdr-upgrade-deps' ||
39
39
  x === 'csdr-serve-app' ||
40
40
  x === 'release-package' ||
41
+ x === 'release-package-standalone' ||
41
42
  x === 'release-backend' ||
42
43
  x === 'release-app' ||
43
44
  x === 'release-app-group' ||
@@ -87,6 +88,7 @@ switch (script) {
87
88
  case 'csdr-upgrade-deps':
88
89
  case 'csdr-serve-app':
89
90
  case 'release-package':
91
+ case 'release-package-standalone':
90
92
  case 'release-backend':
91
93
  case 'release-app':
92
94
  case 'release-app-group':
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const releasePackage = require('../../scripts/csdr/release/package/release-package-standalone');
4
+
5
+ releasePackage.run();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.19.3",
3
+ "version": "6.20.0",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -11,7 +11,7 @@ const configUtils = require('../config/config-utils');
11
11
  const initUtils = require('../init/init-utils');
12
12
 
13
13
  // GET ARGS
14
- const { dryRun } = tools.getArgs();
14
+ const { dryRun, skipAudit } = tools.getArgs();
15
15
 
16
16
 
17
17
 
@@ -71,6 +71,11 @@ module.exports.audit = (pkg) => {
71
71
 
72
72
  let outReport;
73
73
 
74
+ if (skipAudit) {
75
+ tools.logInfo('Skipping audit...');
76
+ return Promise.resolve();
77
+ }
78
+
74
79
  return Promise.resolve()
75
80
  // extract the audit summary lines
76
81
  .then(() => {
@@ -128,7 +133,15 @@ module.exports.audit = (pkg) => {
128
133
  }
129
134
 
130
135
  // getting config options for gates defined
131
- const configOptions = configUtils.global.getConfigOptions();
136
+ let configOptions;
137
+
138
+ if (pkg.standalone) {
139
+ // TODO proceed to gates checks if needed
140
+ // configOptions = configUtils.standalone.getConfigOptions();
141
+ return;
142
+ } else {
143
+ configOptions = configUtils.global.getConfigOptions();
144
+ }
132
145
 
133
146
  // getting local csdr euiVersion
134
147
  const euiVersion = configUtils.global.getLocalEuiVersion();
@@ -38,6 +38,7 @@ const {
38
38
  angularPackageDefV13,
39
39
  angularPackageDefV14,
40
40
  angularPackageDefV15,
41
+ angularPackageDefV15Standalone,
41
42
  angularElementProjectDef,
42
43
  tsConfigDef,
43
44
  tsConfigSpecDef,
@@ -75,6 +76,14 @@ module.exports.checkConfigFiles = (isReset) => {
75
76
  }
76
77
  }
77
78
 
79
+ module.exports.checkAngularConfig = () => {
80
+ const angularConfig = path.join(process.cwd(), 'angular.json');
81
+
82
+ if (!tools.isFileExists(angularConfig)) {
83
+ tools.logInfo('Creating angular.json');
84
+ tools.writeJsonFileSync(angularConfig, angularConfigDef);
85
+ }
86
+ }
78
87
 
79
88
  module.exports.registerAngularPackage = (pkg, isReset) => {
80
89
 
@@ -98,7 +107,11 @@ module.exports.registerAngularPackage = (pkg, isReset) => {
98
107
  projectDef = JSON.stringify(angularPackageDefV14);
99
108
  }
100
109
  if (packageEuiVersionNumber >= 15) {
101
- projectDef = JSON.stringify(angularPackageDefV15);
110
+ if (pkg.standalone) {
111
+ projectDef = JSON.stringify(angularPackageDefV15Standalone);
112
+ } else {
113
+ projectDef = JSON.stringify(angularPackageDefV15);
114
+ }
102
115
  }
103
116
 
104
117
  let srcRoot = '/src', srcRootTesting = '';
@@ -1907,7 +1907,51 @@ module.exports.angularPackageDefV15 = {
1907
1907
  }
1908
1908
  };
1909
1909
 
1910
-
1910
+ module.exports.angularPackageDefV15Standalone = {
1911
+ "root": "",
1912
+ "sourceRoot": "src",
1913
+ "projectType": "library",
1914
+ "prefix": "lib",
1915
+ "architect": {
1916
+ "lint": {
1917
+ "builder": "@angular-eslint/builder:lint",
1918
+ "options": {
1919
+ "lintFilePatterns": [
1920
+ "**/*.ts",
1921
+ "**/*.html"
1922
+ ],
1923
+ "eslintConfig": ".eslintrc.json"
1924
+ }
1925
+ },
1926
+ "build": {
1927
+ "builder": "@angular-devkit/build-angular:ng-packagr",
1928
+ "options": {
1929
+ "tsConfig": "tsconfig.lib.json",
1930
+ "project": "ng-package.json"
1931
+ },
1932
+ "configurations": {
1933
+ "production": {
1934
+ "tsConfig": "tsconfig.lib.prod.json"
1935
+ }
1936
+ }
1937
+ },
1938
+ "test": {
1939
+ "builder": "@angular-devkit/build-angular:karma",
1940
+ "options": {
1941
+ "polyfills": [
1942
+ "zone.js",
1943
+ "zone.js/testing"
1944
+ ],
1945
+ "tsConfig": "tsconfig.spec.json",
1946
+ "karmaConfig": "karma.conf.js",
1947
+ "scripts": [
1948
+ "node_modules/quill/dist/quill.js",
1949
+ "node_modules/quill-better-table/dist/quill-better-table.min.js"
1950
+ ]
1951
+ }
1952
+ }
1953
+ }
1954
+ };
1911
1955
 
1912
1956
 
1913
1957
  module.exports.angularElementProjectDef = {
@@ -9,3 +9,4 @@ module.exports.init = require('./init');
9
9
  module.exports.sync = require('./sync');
10
10
  module.exports.remotes = require('./remotes');
11
11
  module.exports.register = require('./register');
12
+ module.exports.standalone = require('./standalone');
@@ -121,6 +121,10 @@ module.exports.getPackage = (pkgName, fromCsdrConfig, optional) => {
121
121
  // optional call should not do anything
122
122
  if (!pkg && optional) return;
123
123
 
124
+ // flagging as CSDR package / non-standalone package
125
+ pkg.csdr = true;
126
+ pkg.standlone = false;
127
+
124
128
  // additional pkg infos
125
129
  pkg.paths = this.getPackagePaths(pkg);
126
130
  pkg.tsConfigFileName = `${path.parse(pkg.paths.tsConfig).name}.json`;
@@ -176,9 +180,9 @@ module.exports.getPackagePaths = (pkg) => {
176
180
  const rootDirectory = process.cwd();
177
181
  const resolvePath = (relativePath) => path.resolve(rootDirectory, relativePath);
178
182
 
179
- const packagesBasePath = 'packages';
180
-
181
- const folder = pkg.folder || pkg.name;
183
+ let packagesBasePath, folder;
184
+ packagesBasePath = 'packages';
185
+ folder = pkg.folder || pkg.name;
182
186
 
183
187
  let packagesPath;
184
188
  if (pkg.child) {
@@ -228,6 +232,37 @@ module.exports.getPackagePaths = (pkg) => {
228
232
  return paths;
229
233
  };
230
234
 
235
+ module.exports.getStandalonePackage = () => {
236
+ const basePath = path.join(process.cwd());
237
+
238
+ const packageJsonPath = path.join(basePath, 'package.json');
239
+
240
+ if (!tools.isFileExists(packageJsonPath)) {
241
+ throw new Error('PACKAGE_JSON_NOT_FOUND');
242
+ }
243
+
244
+ // get package.json information (name, current version)
245
+ const packageJson = require(packageJsonPath);
246
+
247
+ const pkg = {
248
+ csdr: false,
249
+ standalone: true,
250
+ ...packageJson,
251
+ paths: {
252
+ root: basePath,
253
+ dist: path.join(basePath, 'dist'),
254
+ publish: path.join(basePath, 'dist'),
255
+ src: path.join(basePath, 'src'),
256
+ lib: path.join(basePath, 'src', 'lib'),
257
+ srcLib: path.join(basePath, 'src', 'lib'),
258
+ tsConfig: path.join(basePath, 'tsconfig.lib.json'),
259
+ }
260
+ };
261
+ pkg.tsConfigFileName = `${path.parse(pkg.paths.tsConfig).name}.json`;
262
+
263
+ return pkg;
264
+ }
265
+
231
266
  module.exports.getBuildablePackages = () => {
232
267
  return this.getPackages().filter((pkg) => {
233
268
  if (!pkg.build) {
@@ -338,6 +373,10 @@ const getPackageEuiVersion = (module.exports.getPackageEuiVersion = (pkg, log =
338
373
  version = getEuiVersionCore(pkg);
339
374
  }
340
375
 
376
+ if (!version && pkg.standalone) {
377
+ version = getEuiVersionFromPackageJson(pkg);
378
+ }
379
+
341
380
  if (log) {
342
381
  if (version) {
343
382
  tools.logInfo(`checking -->${pkg.name}<-- => version found : ${version}\n`);
@@ -39,6 +39,8 @@ module.exports.getRemote = (remoteName) => {
39
39
  const remoteRootPath = path.join(process.cwd(), 'remotes', remoteName);
40
40
 
41
41
  const remote = {
42
+ csdr: true,
43
+ standlone: false,
42
44
  name: remoteName,
43
45
  element: true,
44
46
  remote: true,
@@ -0,0 +1,108 @@
1
+ 'use strict';
2
+
3
+ module.exports.getConfigOptions = () => {
4
+ let configOptions = {
5
+ SONAR_HOST: null,
6
+ ISSUES_MANAGER_HOST: null,
7
+ NPM_REGISTRY_INSTALL: null,
8
+ NOTIFICATION_CLIENT: null,
9
+ MSTEAMS_HOST: null,
10
+ MSTEAMS_FRONTEND_CHANNEL: null,
11
+ MSTEAMS_BACKEND_CHANNEL: null,
12
+ MSTEAMS_PROJECT_CHANNEL: null,
13
+ MSTEAMS_CHANNELS_EMAILS: null,
14
+ };
15
+
16
+ const notificationConfig = {
17
+ defaultClient: 'MSTEAMS',
18
+ msteams: {
19
+ host: 'MSTEAMSHOOK_TO_REPLACE',
20
+ defaultChannel: 'pipeline-ui',
21
+ channels: {
22
+ frontend: 'pipeline-ui',
23
+ },
24
+ channelsEmails: {
25
+ 'pipeline-ui': 'EMAIL_CHANNEL_TO_REPLACE',
26
+ },
27
+ },
28
+ };
29
+
30
+ const npmConfig = {
31
+ registry: {
32
+ install: 'https://csdr-nexus.devops.tech.ec.europa.eu/repository/npm-group/',
33
+ default: 'https://csdr-nexus.devops.tech.ec.europa.eu/repository/npm-private/',
34
+ },
35
+ };
36
+
37
+ const sonarConfig = {
38
+ host: 'https://webgate.ec.europa.eu/CITnet/sonarqube/',
39
+ };
40
+
41
+ const issuesManagerConfig = {
42
+ host: "https://webgate.ec.europa.eu/CITnet/jira/browse/",
43
+ };
44
+
45
+ // getting npm registry config
46
+ const npm = npmConfig;
47
+
48
+ if (npm) {
49
+ if (npm.registry && npm.registry.install) {
50
+ configOptions.NPM_REGISTRY_INSTALL = npm.registry.install;
51
+ }
52
+ if (npm.registry && npm.registry.default) {
53
+ configOptions.NPM_REGISTRY_DEFAULT = npm.registry.default;
54
+ }
55
+ }
56
+
57
+ // getting issues manager options
58
+ const issuesManager = issuesManagerConfig;
59
+
60
+ if (issuesManager) {
61
+ if (issuesManager.host) {
62
+ configOptions.ISSUES_MANAGER_HOST = issuesManager.host;
63
+ }
64
+ }
65
+
66
+ // getting sonar options
67
+ const sonar = sonarConfig;
68
+ if (sonar) {
69
+ if (sonar.host) {
70
+ configOptions.SONAR_HOST = sonar.host;
71
+ }
72
+ }
73
+
74
+ // getting notification options (replacing slack only above)
75
+ const notification = notificationConfig;
76
+
77
+ if (notification) {
78
+ if (notification.defaultClient) {
79
+ configOptions.NOTIFICATION_CLIENT = notification.defaultClient;
80
+ }
81
+
82
+ const msteams = notification.msteams;
83
+
84
+ if (msteams) {
85
+ if (msteams.host) {
86
+ configOptions.MSTEAMS_HOST = msteams.host;
87
+ }
88
+
89
+ if (msteams.channels) {
90
+ if (msteams.channels.frontend) {
91
+ configOptions.MSTEAMS_FRONTEND_CHANNEL = msteams.channels.frontend;
92
+ }
93
+ if (msteams.channels.backend) {
94
+ configOptions.MSTEAMS_BACKEND_CHANNEL = msteams.channels.backend;
95
+ }
96
+ if (msteams.channels.project) {
97
+ configOptions.MSTEAMS_PROJECT_CHANNEL = msteams.channels.project;
98
+ }
99
+ }
100
+
101
+ if (msteams.channelsEmails) {
102
+ configOptions.MSTEAMS_CHANNELS_EMAILS = msteams.channelsEmails;
103
+ }
104
+ }
105
+ }
106
+
107
+ return configOptions;
108
+ };
@@ -72,14 +72,22 @@ module.exports.installDeps = (deps) => {
72
72
  );
73
73
  };
74
74
 
75
- const executeInstall = (module.exports.executeInstall = (cwdPath) => {
75
+ const executeInstall = (module.exports.executeInstall = (cwdPath, npmRegistry) => {
76
76
  return Promise.resolve()
77
77
  .then(() => {
78
- const installRegistry = getInstallRegistry();
78
+ let installRegistry;
79
+
80
+ if (npmRegistry) {
81
+ installRegistry = npmRegistry;
82
+ } else {
83
+ installRegistry = getInstallRegistry();
84
+ }
79
85
 
80
86
  tools.logInfo(`Install from : ${installRegistry}`);
81
87
  if (!dryRun && !skipInstall) {
82
88
  return execa.shellSync(`yarn --registry ${installRegistry}`, { cwd: cwdPath, stdio: 'inherit' });
89
+ } else {
90
+ tools.logInfo(`Skipping install - Executing command : yarn --registry ${installRegistry}`);
83
91
  }
84
92
  })
85
93
 
@@ -14,11 +14,7 @@ const configUtils = require('../../config/config-utils');
14
14
  // GLOBAL ARGS
15
15
  const { dryRun, pipelineId } = utils.tools.getArgs();
16
16
 
17
-
18
-
19
- const getBranches = module.exports.getBranches = () => {
20
- let { branch } = utils.tools.getArgs();
21
-
17
+ const getBranchDefs = (branch) => {
22
18
  if (!branch) {
23
19
  branch = 'master';
24
20
  }
@@ -48,6 +44,22 @@ const getBranches = module.exports.getBranches = () => {
48
44
  }
49
45
  }
50
46
 
47
+ const getBranches = module.exports.getBranches = () => {
48
+ let { branch } = utils.tools.getArgs();
49
+
50
+ return getBranchDefs(branch);
51
+ }
52
+
53
+ const getBranchesFromRepo = module.exports.getBranchesFromRepo = () => {
54
+ let branch = utils.git.getBranchName();
55
+
56
+ return getBranchDefs(branch);
57
+ }
58
+
59
+
60
+
61
+
62
+
51
63
  module.exports.getEnvTarget = () => {
52
64
  let { envTarget } = utils.tools.getArgs();
53
65
 
@@ -93,51 +105,61 @@ module.exports.init = (pkg, envTarget) => {
93
105
  }
94
106
  }
95
107
 
108
+ return Promise.resolve()
109
+ .then(() => {
110
+ return initMessage(pkg, branches, envTarget);
111
+ })
112
+
113
+ .catch((e) => {
114
+ throw e;
115
+ })
116
+ }
96
117
 
97
118
 
119
+ const initMessage = module.exports.initMessage = (pkg, branches, envTarget) => {
98
120
  return Promise.resolve()
99
121
 
100
- // Starting the release flow
101
- .then(() => {
102
- // initiating mail buffer
103
- utils.notification.messageStack.startStack();
122
+ // Starting the release flow
123
+ .then(() => {
124
+ // initiating mail buffer
125
+ utils.notification.messageStack.startStack();
104
126
 
105
- // run start
106
- console.log('\n\n');
107
- utils.tools.logTitle('-------------------------------------------------------------------------------');
108
- utils.tools.logTitle(`Releasing new version of package "${pkg.name}" on branch "${branches.branch}"`);
109
- utils.tools.logTitle('-------------------------------------------------------------------------------');
127
+ // run start
128
+ console.log('\n\n');
129
+ utils.tools.logTitle('-------------------------------------------------------------------------------');
130
+ utils.tools.logTitle(`Releasing new version of package "${pkg.name}" on branch "${branches.branch}"`);
131
+ utils.tools.logTitle('-------------------------------------------------------------------------------');
110
132
 
111
- console.log(pkg);
133
+ console.log(pkg);
112
134
 
113
- let launchMessage = ':arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward:';
135
+ let launchMessage = ':arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward:';
114
136
 
115
- if (pkg.remote) {
116
- launchMessage += ` Launching remote *${pkg.name}* release for ENV: *${envTarget}*`;
117
- } else {
118
- launchMessage += ` Launching *${pkg.name}* release for branch *${branches.branch}*`;
119
- }
137
+ if (pkg.remote) {
138
+ launchMessage += ` Launching remote *${pkg.name}* release for ENV: *${envTarget}*`;
139
+ } else {
140
+ launchMessage += ` Launching *${pkg.name}* release for branch *${branches.branch}*`;
141
+ }
142
+
143
+ return utils.notification.package.sendPackageMessage({
144
+ package: pkg,
145
+ text: launchMessage
146
+ });
147
+ })
148
+
149
+ .then(() => {
150
+ if (pipelineId) {
151
+ const launchMessage = `:arrow_forward: :arrow_forward: Pipeline ID : https://gitlab.ecdevops.eu/eui/cc-csdr-root/-/pipelines/${pipelineId}`;
120
152
 
121
153
  return utils.notification.package.sendPackageMessage({
122
154
  package: pkg,
123
155
  text: launchMessage
124
156
  });
125
- })
126
-
127
- .then(() => {
128
- if (pipelineId) {
129
- const launchMessage = `:arrow_forward: :arrow_forward: Pipeline ID : https://gitlab.ecdevops.eu/eui/cc-csdr-root/-/pipelines/${pipelineId}`;
130
-
131
- return utils.notification.package.sendPackageMessage({
132
- package: pkg,
133
- text: launchMessage
134
- });
135
- }
136
- })
157
+ }
158
+ })
137
159
 
138
- .catch((e) => {
139
- throw e;
140
- })
160
+ .catch((e) => {
161
+ throw e;
162
+ })
141
163
  }
142
164
 
143
165
 
@@ -183,6 +205,20 @@ module.exports.cloneMetadataLocksRepos = (pkg) => {
183
205
  }
184
206
 
185
207
 
208
+ const checkBranchValidity = module.exports.checkBranchValidity = (branches) => {
209
+ utils.tools.logTitle('Checking branch validity');
210
+
211
+ if (!branches.valid) {
212
+ utils.tools.logInfo('Branch not supported ... stopping : allowed branches are develop-master-next/-support/-hotfix/');
213
+ throw new Error('BRANCH_NOT_SUPPORTED');
214
+
215
+ } else {
216
+ utils.tools.logInfo('Branch is valid... processing');
217
+ }
218
+ }
219
+
220
+
221
+
186
222
  module.exports.preReleaseChecks = (pkg) => {
187
223
  if (dryRun) {
188
224
  return;
@@ -202,15 +238,7 @@ module.exports.preReleaseChecks = (pkg) => {
202
238
  .then(() => {
203
239
  const branches = this.getBranches();
204
240
 
205
- utils.tools.logTitle('Checking branch validity');
206
-
207
- if (!branches.valid) {
208
- utils.tools.logInfo('Branch not supported ... stopping : allowed branches are develop-master-next/-support/-hotfix/');
209
- throw new Error('BRANCH_NOT_SUPPORTED');
210
-
211
- } else {
212
- utils.tools.logInfo('Branch is valid... processing');
213
- }
241
+ checkBranchValidity(branches);
214
242
  })
215
243
 
216
244
  // CHECK eUI VERSION OF PKG VALIDITY (no v10 allowed after 5/04)
@@ -0,0 +1,211 @@
1
+ 'use strict';
2
+
3
+ // UTILS
4
+ const tools = require('../../../utils/tools');
5
+ const configUtils = require('../../config/config-utils');
6
+
7
+ // INNER MODULES
8
+ const innerReleaseUiStandalone = require('./release-ui-standalone');
9
+
10
+
11
+ 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
+ }
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+ 'use strict';
48
+
49
+ // UTILS
50
+ const utils = require('../../../utils');
51
+
52
+ // CSDR RELATED
53
+ const configUtils = require('../../config/config-utils');
54
+ const auditUtils = require('../../audit/audit-utils');
55
+ const installUtils = require('../../install/install-utils');
56
+
57
+ // INNER MODULES
58
+ const innerCommon = require('./common');
59
+
60
+
61
+ module.exports.run = () => {
62
+ // pre-requisites : package repository cloned - on gitlab script is run on the repo pipeline itself
63
+
64
+ const { dryRun } = utils.tools.getArgs();
65
+
66
+ utils.tools.logBanner('Starting UI stand-alone pipeline');
67
+
68
+ // local saved vars
69
+ let newVersion, commitsMetadata;
70
+
71
+ // getting the package information - mimics CSDR package config
72
+ const pkg = configUtils.packages.getStandalonePackage();
73
+
74
+ // get branches config
75
+ const branches = innerCommon.getBranchesFromRepo();
76
+
77
+ // get global config options
78
+ const configOptions = configUtils.standalone.getConfigOptions();
79
+
80
+ return (
81
+ Promise.resolve()
82
+
83
+ // RELEASE PACKAGE START
84
+
85
+ // Starting the release flow
86
+ .then(() => {
87
+ return innerCommon.initMessage(pkg, branches);
88
+ })
89
+
90
+ // CHECK BRANCH VALIDITY
91
+ .then(() => {
92
+ innerCommon.checkBranchValidity(branches);
93
+ })
94
+
95
+ // COMMIT METADATA CHECKS
96
+ .then(() => {
97
+ return innerCommon.commitMetadataChecks(pkg);
98
+ })
99
+ .then((metadata) => {
100
+ commitsMetadata = metadata;
101
+ })
102
+
103
+
104
+ // INIT PACKAGE CONFIG
105
+ .then(() => {
106
+ // generating angular.json config if not existing
107
+ configUtils.angular.checkAngularConfig();
108
+
109
+ // registering package angular config
110
+ configUtils.angular.registerAngularPackage(pkg);
111
+ })
112
+
113
+ // INIT ROOT FILES - yarn lock and resolution based on current eUI version of the package
114
+ // TODO - get the raw eUI version from package.json dependencies - need to test and adapt the config.global.getLocalEuiversion
115
+ // .then(() => {
116
+ // return initUtils.global.initRootFilesAndResolutions();
117
+ // })
118
+
119
+
120
+ // INSTALL dependencies by type
121
+ .then(() => {
122
+ utils.tools.logBanner('INSTALL DEPENDENCIES');
123
+
124
+ return (
125
+ Promise.resolve()
126
+ // executing install for current package - based on package.json
127
+ .then(() => {
128
+ return installUtils.common.executeInstall(process.cwd(), configOptions.NPM_REGISTRY_INSTALL);
129
+ })
130
+
131
+ // auditing dependencies
132
+ .then(() => {
133
+ return auditUtils.yarn.audit(pkg);
134
+ })
135
+ .catch((e) => {
136
+ throw e;
137
+ })
138
+ );
139
+ })
140
+
141
+ // BUILD PACKAGE
142
+ .then(() => {
143
+ return utils.buildPackage.build(pkg, branches.isMaster, false);
144
+ })
145
+
146
+ // EXECUTING SONAR ANALYSIS
147
+ .then(() => {
148
+ return utils.sonar.run(pkg, branches.isMaster);
149
+ })
150
+
151
+ // GENERATE and UPDATE new version
152
+ .then(() => {
153
+ return innerCommon.updateVersion(pkg, commitsMetadata);
154
+ })
155
+ .then((version) => {
156
+ // storing version for later use
157
+ newVersion = version;
158
+ })
159
+
160
+ // GENERATE CHANGELOG
161
+ .then(() => {
162
+ utils.tools.logTitle('generating changelog...');
163
+ return utils.changelog.generate(pkg, newVersion, commitsMetadata.commits);
164
+ })
165
+
166
+ // WRITE CHANGELOG for MASTER and SUPPORT
167
+ .then((changelogContent) => {
168
+ utils.tools.logTitle('writing changelog...');
169
+
170
+ if ((branches.isSupport || branches.isNext || branches.isMaster) && !dryRun) {
171
+ return utils.changelog.writeChangelog(changelogContent, pkg.paths.root);
172
+
173
+ } else {
174
+ utils.tools.logInfo('WRITING SKIPPED - (either DRY-RUN or snapshot release) - Actual changelog :');
175
+ console.log(changelogContent);
176
+ }
177
+ })
178
+
179
+ // PUBLISH PACKAGE
180
+ .then(() => {
181
+ return utils.publish.publish(pkg);
182
+ })
183
+
184
+ // GIT OPERATIONS
185
+ .then(() => {
186
+ return innerCommon.commitPackage(pkg, newVersion, branches);
187
+ })
188
+ .then(() => {
189
+ return innerCommon.tagAndMerge(pkg, newVersion, branches);
190
+ })
191
+
192
+ // SEND SUCCESS NOTIFICATION
193
+ .then(() => {
194
+ return innerCommon.sendSuccessNotification(pkg, newVersion, commitsMetadata, false).then(() => {
195
+ return innerCommon.close(pkg);
196
+ });
197
+ })
198
+
199
+ // SEND ERROR NOTIFICATION
200
+ .catch((e) => {
201
+ return innerCommon
202
+ .sendErrorNotification(pkg, e, commitsMetadata, false)
203
+ .then(() => {
204
+ return innerCommon.close(pkg);
205
+ })
206
+ .then(() => {
207
+ process.exit(1);
208
+ });
209
+ })
210
+ );
211
+ };
@@ -0,0 +1,165 @@
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 installUtils = require('../../install/install-utils');
10
+
11
+ // INNER MODULES
12
+ const innerCommon = require('./common');
13
+
14
+
15
+ module.exports.run = () => {
16
+ // pre-requisites : package repository cloned - on gitlab script is run on the repo pipeline itself
17
+
18
+ const { dryRun } = utils.tools.getArgs();
19
+
20
+ utils.tools.logBanner('Starting UI stand-alone pipeline');
21
+
22
+ // local saved vars
23
+ let newVersion, commitsMetadata;
24
+
25
+ // getting the package information - mimics CSDR package config
26
+ const pkg = configUtils.packages.getStandalonePackage();
27
+
28
+ // get branches config
29
+ const branches = innerCommon.getBranchesFromRepo();
30
+
31
+ // get global config options
32
+ const configOptions = configUtils.standalone.getConfigOptions();
33
+
34
+ return (
35
+ Promise.resolve()
36
+
37
+ // RELEASE PACKAGE START
38
+
39
+ // Starting the release flow
40
+ .then(() => {
41
+ return innerCommon.initMessage(pkg, branches);
42
+ })
43
+
44
+ // CHECK BRANCH VALIDITY
45
+ .then(() => {
46
+ innerCommon.checkBranchValidity(branches);
47
+ })
48
+
49
+ // COMMIT METADATA CHECKS
50
+ .then(() => {
51
+ return innerCommon.commitMetadataChecks(pkg);
52
+ })
53
+ .then((metadata) => {
54
+ commitsMetadata = metadata;
55
+ })
56
+
57
+
58
+ // INIT PACKAGE CONFIG
59
+ .then(() => {
60
+ // generating angular.json config if not existing
61
+ configUtils.angular.checkAngularConfig();
62
+
63
+ // registering package angular config
64
+ configUtils.angular.registerAngularPackage(pkg);
65
+ })
66
+
67
+ // INIT ROOT FILES - yarn lock and resolution based on current eUI version of the package
68
+ // TODO - get the raw eUI version from package.json dependencies - need to test and adapt the config.global.getLocalEuiversion
69
+ // .then(() => {
70
+ // return initUtils.global.initRootFilesAndResolutions();
71
+ // })
72
+
73
+
74
+ // INSTALL dependencies by type
75
+ .then(() => {
76
+ utils.tools.logBanner('INSTALL DEPENDENCIES');
77
+
78
+ return (
79
+ Promise.resolve()
80
+ // executing install for current package - based on package.json
81
+ .then(() => {
82
+ return installUtils.common.executeInstall(process.cwd(), configOptions.NPM_REGISTRY_INSTALL);
83
+ })
84
+
85
+ // auditing dependencies
86
+ .then(() => {
87
+ return auditUtils.yarn.audit(pkg);
88
+ })
89
+ .catch((e) => {
90
+ throw e;
91
+ })
92
+ );
93
+ })
94
+
95
+ // BUILD PACKAGE
96
+ .then(() => {
97
+ return utils.buildPackage.build(pkg, branches.isMaster, false);
98
+ })
99
+
100
+ // EXECUTING SONAR ANALYSIS
101
+ .then(() => {
102
+ return utils.sonar.run(pkg, branches.isMaster);
103
+ })
104
+
105
+ // GENERATE and UPDATE new version
106
+ .then(() => {
107
+ return innerCommon.updateVersion(pkg, commitsMetadata);
108
+ })
109
+ .then((version) => {
110
+ // storing version for later use
111
+ newVersion = version;
112
+ })
113
+
114
+ // GENERATE CHANGELOG
115
+ .then(() => {
116
+ utils.tools.logTitle('generating changelog...');
117
+ return utils.changelog.generate(pkg, newVersion, commitsMetadata.commits);
118
+ })
119
+
120
+ // WRITE CHANGELOG for MASTER and SUPPORT
121
+ .then((changelogContent) => {
122
+ utils.tools.logTitle('writing changelog...');
123
+
124
+ if ((branches.isSupport || branches.isNext || branches.isMaster) && !dryRun) {
125
+ return utils.changelog.writeChangelog(changelogContent, pkg.paths.root);
126
+
127
+ } else {
128
+ utils.tools.logInfo('WRITING SKIPPED - (either DRY-RUN or snapshot release) - Actual changelog :');
129
+ console.log(changelogContent);
130
+ }
131
+ })
132
+
133
+ // PUBLISH PACKAGE
134
+ .then(() => {
135
+ return utils.publish.publish(pkg);
136
+ })
137
+
138
+ // GIT OPERATIONS
139
+ .then(() => {
140
+ return innerCommon.commitPackage(pkg, newVersion, branches);
141
+ })
142
+ .then(() => {
143
+ return innerCommon.tagAndMerge(pkg, newVersion, branches);
144
+ })
145
+
146
+ // SEND SUCCESS NOTIFICATION
147
+ .then(() => {
148
+ return innerCommon.sendSuccessNotification(pkg, newVersion, commitsMetadata, false).then(() => {
149
+ return innerCommon.close(pkg);
150
+ });
151
+ })
152
+
153
+ // SEND ERROR NOTIFICATION
154
+ .catch((e) => {
155
+ return innerCommon
156
+ .sendErrorNotification(pkg, e, commitsMetadata, false)
157
+ .then(() => {
158
+ return innerCommon.close(pkg);
159
+ })
160
+ .then(() => {
161
+ process.exit(1);
162
+ });
163
+ })
164
+ );
165
+ };
package/scripts/index.js CHANGED
@@ -91,12 +91,15 @@ module.exports.cliPackageConstants = require('./csdr/cli/constants');
91
91
 
92
92
  // csdr - config
93
93
  module.exports.configAngular = require('./csdr/config/angular');
94
+ module.exports.configSkeletons = require('./csdr/config/config-skeletons');
94
95
  module.exports.configUtils = require('./csdr/config/config-utils');
95
96
  module.exports.configGlobal = require('./csdr/config/global');
96
97
  module.exports.configInit = require('./csdr/config/init');
97
98
  module.exports.configPackages = require('./csdr/config/packages');
98
99
  module.exports.configProjects = require('./csdr/config/projects');
99
100
  module.exports.configRegister = require('./csdr/config/register');
101
+ module.exports.configRemotes = require('./csdr/config/remotes');
102
+ module.exports.configStandalone = require('./csdr/config/standalone');
100
103
  module.exports.configSync = require('./csdr/config/sync');
101
104
 
102
105
  // csdr -init
@@ -32,18 +32,24 @@ const TYPES = {
32
32
 
33
33
  module.exports.generate = (pkg, version, commits) => {
34
34
 
35
- var content = [];
36
- var date = new Date().toJSON().slice(0, 10);
37
- var heading = '##';
35
+ let content = [];
36
+ let date = new Date().toJSON().slice(0, 10);
37
+ let heading = '##';
38
38
 
39
- var repoUrl;
39
+ let repoUrl;
40
40
 
41
41
  heading += ' ' + version + ' (' + date + ')';
42
42
 
43
43
  content.push(heading);
44
44
  content.push('');
45
45
 
46
- const iSSUES_MANAGER_HOST = configUtils.global.getConfigOptions().ISSUES_MANAGER_HOST;
46
+ let ISSUES_MANAGER_HOST;
47
+
48
+ if (pkg.standalone) {
49
+ ISSUES_MANAGER_HOST = configUtils.standalone.getConfigOptions().ISSUES_MANAGER_HOST;
50
+ } else {
51
+ ISSUES_MANAGER_HOST = configUtils.global.getConfigOptions().ISSUES_MANAGER_HOST;
52
+ }
47
53
 
48
54
  return Promise.resolve()
49
55
  .then(() => {
@@ -53,15 +59,15 @@ module.exports.generate = (pkg, version, commits) => {
53
59
  repoUrl = repoUrlFound;
54
60
  })
55
61
  .then(() => {
56
- var types = {}
62
+ let types = {}
57
63
 
58
64
  commits.forEach((commit) => {
59
- var type = TYPES[commit.type] ? commit.type : DEFAULT_TYPE;
65
+ let type = TYPES[commit.type] ? commit.type : DEFAULT_TYPE;
60
66
 
61
67
  if (commit.body && commit.body.indexOf('BREAKING CHANGE') !== -1) {
62
68
  type = 'breakingChange';
63
69
  }
64
- var category = commit.category ? commit.category : DEFAULT_CATEGORY;
70
+ let category = commit.category ? commit.category : DEFAULT_CATEGORY;
65
71
 
66
72
  types[type] = types[type] || {};
67
73
  types[type][category] = types[type][category] || [];
@@ -71,7 +77,7 @@ module.exports.generate = (pkg, version, commits) => {
71
77
  return types;
72
78
  })
73
79
  .then((rawTypes) => {
74
- var types = rawTypes;
80
+ let types = rawTypes;
75
81
 
76
82
  Object.keys(rawTypes).sort().forEach((type) => {
77
83
 
@@ -79,23 +85,22 @@ module.exports.generate = (pkg, version, commits) => {
79
85
  content.push('');
80
86
 
81
87
  Object.keys(rawTypes[type]).forEach(function (category) {
82
- var prefix = '*';
83
- var nested = types[type][category].length > 1;
84
- var categoryHeading = prefix + (category ? ' **' + category + ':**' : '');
88
+ let prefix = '*';
89
+ let categoryHeading = prefix + (category ? ' **' + category + ':**' : '');
85
90
 
86
91
  content.push(categoryHeading);
87
92
  prefix = ' *';
88
93
 
89
94
  types[type][category].forEach(function (commit) {
90
95
 
91
- var shorthash = commit.hash.substring(0, 8);
96
+ let shorthash = commit.hash.substring(0, 8);
92
97
  if (repoUrl) {
93
98
  shorthash = '[' + shorthash + '](' + repoUrl + '/commits/' + commit.hash + ')';
94
99
  }
95
100
 
96
- var issueString = '';
101
+ let issueString = '';
97
102
  if (commit.issue) {
98
- issueString += '[' + commit.issue + '](' + iSSUES_MANAGER_HOST + commit.issue + ') ';
103
+ issueString += '[' + commit.issue + '](' + ISSUES_MANAGER_HOST + commit.issue + ') ';
99
104
  }
100
105
 
101
106
  content.push(prefix + ' ' + commit.subject + ' ' + issueString + ' (' + shorthash + ')');
@@ -30,7 +30,10 @@ const getLastTag = (folder) => {
30
30
  });
31
31
  }
32
32
 
33
-
33
+ const getBranchName = (folder = process.cwd()) => {
34
+ const branchName = execa.sync('git', ['rev-parse','--abbrev-ref', 'HEAD'], { cwd: folder }).stdout;
35
+ return branchName;
36
+ }
34
37
 
35
38
  const getRepoUrl = (folder) => {
36
39
  return Promise.resolve()
@@ -425,6 +428,7 @@ module.exports.getGitHost = getGitHost;
425
428
  module.exports.getLastTag = getLastTag;
426
429
  module.exports.getTags = getTags;
427
430
  module.exports.hasCommitsSinceLastTag = hasCommitsSinceLastTag;
431
+ module.exports.getBranchName = getBranchName;
428
432
  module.exports.commitAndPush = commitAndPush;
429
433
  module.exports.tagVersion = tagVersion;
430
434
  module.exports.mergeMasterToDevelop = mergeMasterToDevelop;
@@ -10,7 +10,13 @@ const configUtils = require('../../csdr/config/config-utils');
10
10
 
11
11
  module.exports.getPackageConfig = (pkg) => {
12
12
  // Fetching global config - default if not overriden in package own config
13
- const globalConfig = configUtils.global.getConfigOptions();
13
+ let globalConfig;
14
+
15
+ if (pkg.standalone) {
16
+ globalConfig = configUtils.standalone.getConfigOptions();
17
+ } else {
18
+ globalConfig = configUtils.global.getConfigOptions();
19
+ }
14
20
 
15
21
  let slackChannel, msTeamsChannel;
16
22
 
@@ -109,7 +109,13 @@ const publishCore = module.exports.publishCore = (pkg, registry, isPublicAccess)
109
109
 
110
110
  const publishPackage = (pkg, parentPkg) => {
111
111
 
112
- const configOptions = configUtils.global.getConfigOptions();
112
+ let configOptions;
113
+
114
+ if (pkg.standalone) {
115
+ configOptions = configUtils.standalone.getConfigOptions();
116
+ } else {
117
+ configOptions = configUtils.global.getConfigOptions();
118
+ }
113
119
 
114
120
  let pkgPublicRegistry;
115
121
 
@@ -192,7 +198,15 @@ module.exports.publish = (pkg) => {
192
198
 
193
199
  } else {
194
200
  // building normal package without linked children
195
- const pkgFull = configUtils.packages.getPackage(pkg.name); // TO CHECK
201
+ let pkgFull;
202
+
203
+ if (pkg.standalone) {
204
+ pkgFull = pkg;
205
+
206
+ } else {
207
+ pkgFull = configUtils.packages.getPackage(pkg.name); // TO CHECK
208
+ }
209
+
196
210
  return publishPackage(pkgFull);
197
211
  }
198
212
 
@@ -21,9 +21,11 @@ const { branch, dryRun, sonarQubeToken } = tools.getArgs();
21
21
  const runCore = (pkg, isMaster) => {
22
22
 
23
23
  // check at metadata global flag level if enabled
24
- if (!configUtils.global.isSonarEnabled()) {
25
- tools.logInfo('Sonar scanner globally disabled');
26
- return Promise.resolve();
24
+ if (!pkg.standalone) {
25
+ if (!configUtils.global.isSonarEnabled()) {
26
+ tools.logInfo('Sonar scanner globally disabled');
27
+ return Promise.resolve();
28
+ }
27
29
  }
28
30
 
29
31
  // check at package config level if enabled
@@ -115,7 +117,14 @@ const runUI = (pkg, isMaster) => {
115
117
  .then(() => {
116
118
  if (!dryRun) {
117
119
  tools.logInfo('Calling Sonar scanner...');
118
- const SONAR_HOST = configUtils.global.getConfigOptions().SONAR_HOST;
120
+
121
+ let SONAR_HOST;
122
+ if (pkg.standalone) {
123
+ SONAR_HOST = configUtils.standalone.getConfigOptions().SONAR_HOST;
124
+ } else {
125
+ SONAR_HOST = configUtils.global.getConfigOptions().SONAR_HOST;
126
+ }
127
+
119
128
  return execa.shellSync(`sonar-scanner -Dsonar.branch.name=${branch} -Dsonar.host.url=${SONAR_HOST} -Dsonar.login=${sonarQubeToken}`, { cwd: pkg.paths.root, stdio: 'inherit' });
120
129
  }
121
130
  })