@eui/tools 6.19.2 → 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.
Files changed (88) hide show
  1. package/.version.properties +1 -1
  2. package/CHANGELOG.md +22 -0
  3. package/bin/eui-scripts.js +2 -0
  4. package/bin/scripts/release-package-standalone.js +5 -0
  5. package/package.json +1 -1
  6. package/scripts/csdr/audit/yarn.js +15 -2
  7. package/scripts/csdr/cli/constants.js +3 -0
  8. package/scripts/csdr/cli/package-build-frontend.js +10 -0
  9. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/.eslintrc.json +43 -0
  10. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/assets/i18n/en.json +3 -0
  11. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/assets/i18n/fr.json +3 -0
  12. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/dependencies-base.json +2 -0
  13. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/dependencies-composite.json +4 -0
  14. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/gitignore_TO_REPLACE +46 -0
  15. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/karma.conf.js +7 -0
  16. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/ng-package.json +7 -0
  17. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/package.json +4 -0
  18. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/src/dummy.spec.ts.TO_REPLACE +5 -0
  19. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/src/index.ts +1 -0
  20. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/src/lib/components/main.component.html +10 -0
  21. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/src/lib/components/main.component.ts +17 -0
  22. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/src/lib/module.ts +26 -0
  23. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/src/test.ts.TO_REPLACE +21 -0
  24. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/tsconfig.lib.json +33 -0
  25. package/scripts/csdr/cli/skeletons/package/frontend/18.x/default/tsconfig.spec.json +17 -0
  26. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/.eslintrc.json +43 -0
  27. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/assets/i18n/en.json +6 -0
  28. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/assets/i18n/fr.json +6 -0
  29. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/dependencies-base.json +2 -0
  30. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/dependencies-composite.json +4 -0
  31. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/gitignore_TO_REPLACE +46 -0
  32. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/karma.conf.js +7 -0
  33. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/ng-package.json +7 -0
  34. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/package.json +4 -0
  35. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/src/dummy.spec.ts.TO_REPLACE +5 -0
  36. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/src/index.ts +2 -0
  37. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/src/lib/components/participant/participant.component.html +1 -0
  38. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/src/lib/components/participant/participant.component.ts +19 -0
  39. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/src/lib/module.ts +24 -0
  40. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/src/test.ts.TO_REPLACE +21 -0
  41. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/tsconfig.lib.json +33 -0
  42. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-default/tsconfig.spec.json +17 -0
  43. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/.eslintrc.json +79 -0
  44. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/assets/i18n/en.json +6 -0
  45. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/assets/i18n/fr.json +6 -0
  46. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/dependencies-base.json +2 -0
  47. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/dependencies-composite.json +3 -0
  48. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/gitignore_TO_REPLACE +46 -0
  49. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/karma.conf.js +7 -0
  50. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/ng-package.json +7 -0
  51. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/package.json +4 -0
  52. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/dummy.spec.ts.TO_REPLACE +5 -0
  53. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/index.ts +4 -0
  54. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/blocks/sample/components/sample.component.html +1 -0
  55. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/blocks/sample/components/sample.component.ts +14 -0
  56. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/blocks/sample/containers/container.component.ts +36 -0
  57. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/blocks/sample/models/block.model.ts +5 -0
  58. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/blocks/sample/models/index.ts +1 -0
  59. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/blocks/sample/module.ts +37 -0
  60. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/main/components/sample.component.html +1 -0
  61. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/main/components/sample.component.ts +11 -0
  62. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/main/containers/block-store.service.ts +26 -0
  63. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/main/containers/container.component.ts +42 -0
  64. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/main/models/block.model.ts +4 -0
  65. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/main/models/index.ts +1 -0
  66. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/main/module.ts +56 -0
  67. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/main/store/block.actions.ts +11 -0
  68. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/main/store/block.feature.ts +48 -0
  69. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/lib/module.ts +17 -0
  70. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/src/test.ts.TO_REPLACE +21 -0
  71. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/tsconfig.lib.json +33 -0
  72. package/scripts/csdr/cli/skeletons/package/frontend/18.x/participant-ngrx/tsconfig.spec.json +17 -0
  73. package/scripts/csdr/config/angular.js +14 -1
  74. package/scripts/csdr/config/config-skeletons.js +45 -1
  75. package/scripts/csdr/config/config-utils.js +1 -0
  76. package/scripts/csdr/config/packages.js +42 -3
  77. package/scripts/csdr/config/remotes.js +2 -0
  78. package/scripts/csdr/config/standalone.js +108 -0
  79. package/scripts/csdr/install/common.js +10 -2
  80. package/scripts/csdr/release/package/common.js +73 -45
  81. package/scripts/csdr/release/package/release-package-standalone.js +211 -0
  82. package/scripts/csdr/release/package/release-ui-standalone.js +165 -0
  83. package/scripts/index.js +3 -0
  84. package/scripts/utils/changelog-utils.js +20 -15
  85. package/scripts/utils/git-utils.js +5 -1
  86. package/scripts/utils/notification/config.js +7 -1
  87. package/scripts/utils/publish/npm.js +16 -2
  88. package/scripts/utils/sonar/sonar-utils.js +13 -4
@@ -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
+ };