@eui/tools 4.15.11 → 4.15.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.
Files changed (59) hide show
  1. package/.version.properties +1 -1
  2. package/CHANGELOG.md +10 -0
  3. package/bin/eui-scripts.js +2 -0
  4. package/bin/scripts/build-package-sub.js +20 -0
  5. package/global.test.js +3 -3
  6. package/package.json +12 -16
  7. package/sandbox.js +3 -2
  8. package/scripts/csdr/cli/app.js +30 -3
  9. package/scripts/csdr/cli/skeletons/app-showcase-eui13/angular-config.json +33 -0
  10. package/scripts/csdr/cli/skeletons/app-showcase-eui13/dependencies-composite.json +5 -0
  11. package/scripts/csdr/cli/skeletons/app-showcase-eui13/gitignore_TO_REPLACE +50 -0
  12. package/scripts/csdr/cli/skeletons/app-showcase-eui13/package.json +6 -0
  13. package/scripts/csdr/cli/skeletons/app-showcase-eui13/scripts.json +3 -0
  14. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/app-routing.module.ts +21 -0
  15. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/app.component.html +26 -0
  16. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/app.component.ts +19 -0
  17. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/app.routes.ts +7 -0
  18. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/features/_home/home-routing.module.ts +15 -0
  19. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/features/_home/home.component.html +7 -0
  20. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/features/_home/home.component.ts +8 -0
  21. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/features/_home/home.module.ts +17 -0
  22. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/features/shared/shared.module.ts +15 -0
  23. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/assets/app-metadata.json +8 -0
  24. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/assets/config/env-json-config.json +41 -0
  25. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/index.html +22 -0
  26. package/scripts/csdr/config/angular.js +213 -3
  27. package/scripts/csdr/config/global.js +16 -0
  28. package/scripts/csdr/install/common.js +26 -8
  29. package/scripts/csdr/jira/jira-utils.js +168 -168
  30. package/scripts/csdr/jira/update.js +150 -150
  31. package/scripts/csdr/metadata/app-envs.js +34 -33
  32. package/scripts/csdr/metadata/app-history.js +62 -61
  33. package/scripts/csdr/metadata/common.js +2 -2
  34. package/scripts/csdr/metadata/package-history.js +0 -1
  35. package/scripts/csdr/sync/sync-utils.js +6 -2
  36. package/scripts/utils/build/package/build-package-utils.js +45 -0
  37. package/scripts/utils/build/package/styles.js +106 -7
  38. package/scripts/utils/confluence-utils.js +126 -126
  39. package/scripts/utils/index.js +2 -2
  40. package/scripts/utils/pre-build/injection/app-sources-full-skeleton/src/_generated/favicon.ico +0 -0
  41. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/app/app.module.ts +52 -0
  42. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/app/core/reducers/index.ts +40 -0
  43. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/config/global.ts +4 -0
  44. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/config/index.ts +8 -0
  45. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/config/modules.ts +4 -0
  46. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/environments/environment.dev.ts +9 -0
  47. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/environments/environment.prod.ts +9 -0
  48. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/environments/environment.ts +21 -0
  49. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/favicon.ico +0 -0
  50. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/karma.conf.js +7 -0
  51. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/main.ts +21 -0
  52. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/polyfills.ts +86 -0
  53. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/tst.ts +33 -0
  54. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/tsconfig.app.json +19 -0
  55. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/tsconfig.spec.json +9 -0
  56. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/tslint.json +17 -0
  57. package/scripts/utils/pre-build/injection/skeletons.js +6 -2
  58. package/scripts/utils/pre-build/projects.js +5 -1
  59. package/scripts/utils/tools.js +13 -0
@@ -326,6 +326,130 @@ const angularProjectDefFullSkeleton = {
326
326
  }
327
327
  };
328
328
 
329
+
330
+ const angularProjectDefFullSkeletonV13 = {
331
+ "root": "",
332
+ "sourceRoot": "apps/@project.name@/src",
333
+ "projectType": "application",
334
+ "prefix": "app",
335
+ "schematics": {
336
+ "@schematics/angular:component": {
337
+ "style": "scss"
338
+ },
339
+ "@schematics/angular:application": {
340
+ "strict": true
341
+ }
342
+ },
343
+ "architect": {
344
+ "build": {
345
+ "builder": "@angular-devkit/build-angular:browser",
346
+ "options": {
347
+ "outputPath": "apps/@project.name@/dist",
348
+ "index": "apps/@project.name@/src/index.html",
349
+ "main": "apps/@project.name@/src/_generated/main.ts",
350
+ "polyfills": "apps/@project.name@/src/_generated/polyfills.ts",
351
+ "tsConfig": "apps/@project.name@/tsconfig.app.json",
352
+ "assets": [
353
+ "apps/@project.name@/src/favicon.ico",
354
+ "apps/@project.name@/src/assets",
355
+ {
356
+ "glob": "**/*",
357
+ "input": "node_modules/@eui/core/assets/",
358
+ "output": "./assets"
359
+ }
360
+ ],
361
+ "styles": [
362
+ ]
363
+ },
364
+ "configurations": {
365
+ "production": {
366
+ "fileReplacements": [
367
+ {
368
+ "replace": "apps/@project.name@/src/_generated/environments/environment.ts",
369
+ "with": "apps/@project.name@/src/_generated/environments/environment.prod.ts"
370
+ }
371
+ ],
372
+ "optimization": false,
373
+ "outputHashing": "all",
374
+ "sourceMap": false,
375
+ "namedChunks": true,
376
+ "aot": true,
377
+ "extractLicenses": true,
378
+ "vendorChunk": false,
379
+ "buildOptimizer": false,
380
+ "budgets": [
381
+ {
382
+ "type": "initial",
383
+ "maximumWarning": "2mb",
384
+ "maximumError": "6mb"
385
+ }
386
+ ]
387
+ },
388
+ "production-optimized-no-openid": {
389
+ "fileReplacements": [
390
+ {
391
+ "replace": "apps/@project.name@/src/_generated/environments/environment.ts",
392
+ "with": "apps/@project.name@/src/_generated/environments/environment.prod.ts"
393
+ }
394
+ ],
395
+ "optimization": {
396
+ "scripts": true,
397
+ "styles": {
398
+ "minify": false,
399
+ "inlineCritical": true
400
+ },
401
+ "fonts": true
402
+ },
403
+ "outputHashing": "all",
404
+ "sourceMap": false,
405
+ "namedChunks": true,
406
+ "aot": true,
407
+ "extractLicenses": true,
408
+ "vendorChunk": false,
409
+ "buildOptimizer": true,
410
+ "budgets": [
411
+ {
412
+ "type": "initial",
413
+ "maximumWarning": "2mb",
414
+ "maximumError": "6mb"
415
+ }
416
+ ]
417
+ },
418
+ "development": {
419
+ "buildOptimizer": false,
420
+ "optimization": false,
421
+ "vendorChunk": true,
422
+ "extractLicenses": false,
423
+ "sourceMap": true,
424
+ "namedChunks": true
425
+ }
426
+ },
427
+ "defaultConfiguration": "production"
428
+ },
429
+ "serve": {
430
+ "builder": "@angular-devkit/build-angular:dev-server",
431
+ "options": {
432
+ "browserTarget": "@project.name@:build"
433
+ },
434
+ "configurations": {
435
+ "proxy-mock": {
436
+ "browserTarget": "@project.name@:build",
437
+ "proxyConfig": "apps/@project.name@/proxy-mock.conf.json"
438
+ },
439
+ "production": {
440
+ "browserTarget": "@project.name@:build:production"
441
+ },
442
+ "development": {
443
+ "browserTarget": "@project.name@:build:development"
444
+ }
445
+ },
446
+ "defaultConfiguration": "development"
447
+ }
448
+ }
449
+ };
450
+
451
+
452
+
329
453
  const angularProjectDefConfiguration = {
330
454
  "fileReplacements": [
331
455
  {
@@ -422,6 +546,58 @@ const angularPackageDef = {
422
546
  }
423
547
  };
424
548
 
549
+ const angularPackageSubEntryDef = {
550
+ "root": "packages/eui/packages/components/@subEntry.path@",
551
+ "sourceRoot": "packages/eui/packages/components/@subEntry.path@",
552
+ "projectType": "library",
553
+ "prefix": "lib",
554
+ "architect": {
555
+ "build": {
556
+ "builder": "@angular-devkit/build-angular:ng-packagr",
557
+ "options": {
558
+ "tsConfig": "packages/eui/packages/components/tsconfig.lib.json",
559
+ "project": "packages/eui/packages/components/@subEntry.path@/package.json"
560
+ },
561
+ "configurations": {
562
+ "production": {
563
+ "tsConfig": "packages/eui/packages/components/tsconfig.lib.json"
564
+ }
565
+ }
566
+ }
567
+ }
568
+ };
569
+
570
+
571
+ const angularPackageDefV13 = {
572
+ "root": "@path@/@module.name@",
573
+ "sourceRoot": "@path@/@module.name@@srcRoot@",
574
+ "projectType": "library",
575
+ "prefix": "lib",
576
+ "architect": {
577
+ "build": {
578
+ "builder": "@angular-devkit/build-angular:ng-packagr",
579
+ "options": {
580
+ "tsConfig": "@path@/@module.name@/tsconfig.lib.json",
581
+ "project": "@path@/@module.name@/ng-package.json"
582
+ },
583
+ "configurations": {
584
+ "production": {
585
+ "tsConfig": "@path@/@module.name@/tsconfig.lib.prod.json"
586
+ }
587
+ }
588
+ },
589
+ "test": {
590
+ "builder": "@angular-devkit/build-angular:karma",
591
+ "options": {
592
+ "main": "@path@/@module.name@@srcRoot@@srcRootTesting@/test.ts",
593
+ "tsConfig": "@path@/@module.name@/tsconfig.spec.json",
594
+ "karmaConfig": "@path@/@module.name@/karma.conf.js"
595
+ }
596
+ }
597
+ }
598
+ };
599
+
600
+
425
601
  const angularElementProjectDef = {
426
602
  "root": "@module.name@/",
427
603
  "sourceRoot": "@module.name@/src",
@@ -560,11 +736,40 @@ module.exports.registerAngularPackage = (pkg, isReset) => {
560
736
  pathBase = 'packages/' + pkg.parentPkg + '/packages';
561
737
  }
562
738
 
563
- const projectDef = JSON.stringify(angularPackageDef);
739
+ let projectDef = JSON.stringify(angularPackageDef);
740
+
741
+ if (pkg.build && pkg.build.euiVersion === '13.x') {
742
+ projectDef = JSON.stringify(angularPackageDefV13);
743
+ }
744
+
745
+ let srcRoot = '/src', srcRootTesting = '';
746
+ if (pkg.build && typeof pkg.build.srcRootDefault === 'boolean' && pkg.build.srcRootDefault === false) {
747
+ srcRoot = '';
748
+ srcRootTesting = '/testing'
749
+ }
750
+
564
751
  const replaceModule = tools.replaceAll(projectDef, '@module.name@', pkg.folder || pkg.name);
565
752
  const replacePath = tools.replaceAll(replaceModule, '@path@', pathBase);
753
+ const replaceSrcRoot = tools.replaceAll(replacePath, '@srcRoot@', srcRoot);
754
+ const replaceSrcRootTesting = tools.replaceAll(replaceSrcRoot, '@srcRootTesting@', srcRootTesting);
755
+
756
+ jsonFile['projects'][pkg.name] = JSON.parse(replaceSrcRootTesting);
757
+
758
+ tools.writeJsonFileSync(file, jsonFile);
759
+ }
566
760
 
567
- jsonFile['projects'][pkg.name] = JSON.parse(replacePath);
761
+
762
+ module.exports.registerAngularPackageSubEntry = (subEntryName, subEntryPath) => {
763
+ const file = path.join(process.cwd(), 'angular.json');
764
+ const jsonFile = require(file);
765
+
766
+ let projectDef = JSON.stringify(angularPackageSubEntryDef);
767
+
768
+ const replacePath = tools.replaceAll(projectDef, '@subEntry.path@', subEntryPath);
769
+
770
+ jsonFile['projects'][subEntryName] = JSON.parse(replacePath);
771
+
772
+ console.log(jsonFile['projects'][subEntryName]);
568
773
 
569
774
  tools.writeJsonFileSync(file, jsonFile);
570
775
  }
@@ -626,7 +831,12 @@ module.exports.registerAngularProjectDef = (project, build = false) => {
626
831
  tools.logInfo('Processing angular config...');
627
832
  let projectDef;
628
833
  if (project.csdrFullSkeleton) {
629
- projectDef = JSON.stringify(angularProjectDefFullSkeleton);
834
+ if (project.build && project.build.euiVersion === '13.x') {
835
+ projectDef = JSON.stringify(angularProjectDefFullSkeletonV13);
836
+ } else {
837
+ projectDef = JSON.stringify(angularProjectDefFullSkeleton);
838
+ }
839
+
630
840
  } else {
631
841
  projectDef = JSON.stringify(angularProjectDef);
632
842
  }
@@ -20,6 +20,14 @@ module.exports.getCsdrConfig = (full = true) => {
20
20
 
21
21
  Object.keys(appsConfig).forEach((p) => {
22
22
  config.projects[p] = appsConfig[p];
23
+
24
+ // checking if package has config override in its own folder
25
+ const prjCsdrConfig = path.join(process.cwd(), 'apps', p, '.csdr-config.json');
26
+
27
+ if (tools.isFileExists(prjCsdrConfig)) {
28
+ const prjCsdrConfigJson = require(prjCsdrConfig);
29
+ config.projects[p] = prjCsdrConfigJson;
30
+ }
23
31
  })
24
32
 
25
33
  Object.keys(packagesConfig).forEach((p) => {
@@ -96,6 +104,14 @@ const getGeneratedConfig = (euircBaseFile) => {
96
104
  // remapping projects against csdr projects config
97
105
  configContent.projects.forEach((p) => {
98
106
  genConfig.projects[p] = globalConfig.projects[p];
107
+
108
+ // checking if project has config override in its own folder
109
+ const prjCsdrConfig = path.join(process.cwd(), 'apps', p, '.csdr-config.json');
110
+
111
+ if (tools.isFileExists(prjCsdrConfig)) {
112
+ const prjCsdrConfigJson = require(prjCsdrConfig);
113
+ genConfig.projects[p] = prjCsdrConfigJson;
114
+ }
99
115
  })
100
116
 
101
117
  // remapping projects against csdr packages config
@@ -199,7 +199,9 @@ const getLocalPackagesDeps = () => {
199
199
  const pdeps = Object.keys(pkgDeps)
200
200
  .reduce((acc, k) => {
201
201
  if (k.indexOf('@eui') !== -1 ) {
202
- if (k.indexOf('@eui/ecl') !== -1) {
202
+ if (k.indexOf('@eui/ecl') !== -1 ||
203
+ k.indexOf('@eui/styles-base') !== -1
204
+ ) {
203
205
  acc[k] = pkgDeps[k];
204
206
  }
205
207
  } else {
@@ -215,17 +217,33 @@ const getLocalPackagesDeps = () => {
215
217
  }
216
218
 
217
219
 
220
+ // const getLocalPackageCompositeDeps = (pkg) => {
221
+ // let pkgJsonFile;
222
+
223
+ // if (pkg.parent) {
224
+ // return {};
225
+ // } else {
226
+ // if (pkg.child) {
227
+ // pkgJsonFile = path.join(process.cwd(), 'packages', pkg.parentPkg, 'packages', pkg.folder || pkg.name, 'dependencies-composite.json');
228
+ // } else {
229
+ // pkgJsonFile = path.join(process.cwd(), 'packages', pkg.name, 'dependencies-composite.json');
230
+ // }
231
+ // }
232
+
233
+ // return tools.getJsonFileContent(pkgJsonFile) || {};
234
+ // }
235
+
218
236
  const getLocalPackageCompositeDeps = (pkg) => {
219
237
  let pkgJsonFile;
220
238
 
221
- if (pkg.parent) {
222
- return {};
239
+ if (pkg.child) {
240
+ pkgJsonFile = path.join(process.cwd(), 'packages', pkg.parentPkg, 'packages', pkg.folder || pkg.name, 'dependencies-composite.json');
223
241
  } else {
224
- if (pkg.child) {
225
- pkgJsonFile = path.join(process.cwd(), 'packages', pkg.parentPkg, 'packages', pkg.folder || pkg.name, 'dependencies-composite.json');
226
- } else {
227
- pkgJsonFile = path.join(process.cwd(), 'packages', pkg.name, 'dependencies-composite.json');
228
- }
242
+ pkgJsonFile = path.join(process.cwd(), 'packages', pkg.name, 'dependencies-composite.json');
243
+ }
244
+
245
+ if (tools.isFileExists(pkgJsonFile)) {
246
+ console.log(`found ${pkgJsonFile}, parsing...`);
229
247
  }
230
248
 
231
249
  return tools.getJsonFileContent(pkgJsonFile) || {};
@@ -1,169 +1,169 @@
1
- 'use strict';
2
-
3
- // GLOBAL
4
- const execa = require('execa');
5
- const moment = require('moment');
6
- const axios = require('axios');
7
-
8
- // LOCAL
9
- const tools = require('../../utils/tools');
10
-
11
-
12
- const getProject = (projectKey) => {
13
- return Promise.resolve()
14
- .then(() => {
15
- return doCall({ method: 'GET', url: `/project/${projectKey}` });
16
- })
17
- .then((response) => {
18
- tools.logSuccess(`OK ${response.status}`);
19
- return response.data;
20
- })
21
- .catch((e) => {
22
- tools.logError(`ERROR ${e.response.status}`);
23
- throw e;
24
- })
25
- }
26
-
27
- const getIssue = (issueKey) => {
28
- return Promise.resolve()
29
- .then(() => {
30
- return doCall({ method: 'GET', url: `/issue/${issueKey}` });
31
- })
32
- .then((response) => {
33
- tools.logSuccess(`OK ${response.status}`);
34
- return response.data;
35
- })
36
- .catch((e) => {
37
- tools.logError(`ERROR ${e.response.status}`);
38
- throw e;
39
- })
40
- }
41
-
42
-
43
- const updateIssueVersion = (issueKey, version) => {
44
- tools.logInfo(`Updating issue: ${issueKey} with version: ${version}`);
45
-
46
- return Promise.resolve()
47
- .then(() => {
48
-
49
- const postData = JSON.stringify({
50
- "update": {
51
- "fixVersions": [
52
- {
53
- "add": {
54
- "name": version
55
- }
56
- }
57
- ]
58
- }
59
- });
60
-
61
- return doCall({ method: 'PUT', url: `/issue/${issueKey}`, data: postData });
62
- })
63
- .then((response) => {
64
- tools.logSuccess(`OK ${response.status}`);
65
- return response.data;
66
- })
67
- .catch((e) => {
68
- tools.logError(`ERROR ${e.response.status}`);
69
- throw e;
70
- })
71
- }
72
-
73
-
74
-
75
-
76
- const createVersion = (projectKey = 'MWP', version = 'PI9.IT1') => {
77
- return Promise.resolve()
78
-
79
- // get project from key
80
- .then(() => {
81
- return getProject(projectKey);
82
- })
83
-
84
- // check if version exists in the fetch project versions, if not create it
85
- .then((project) => {
86
- const versionFound = project.versions.filter((v) => {
87
- return v.name === version;
88
- })[0];
89
-
90
- if (versionFound) {
91
- // output the version found if exists
92
- tools.logInfo(`Version ${version} exist ==> id: ${versionFound.id}`);
93
- return versionFound;
94
-
95
- } else {
96
-
97
- // creating the version if not
98
- return Promise.resolve()
99
- .then(() => {
100
- tools.logInfo(`Version does not exist...creating`);
101
-
102
- const postData = JSON.stringify({
103
- project: projectKey,
104
- name: version,
105
- released: false,
106
- archived: false,
107
- description: 'Version created from CSDR',
108
- releaseDate: moment().format('YYYY-MM-DD')
109
- });
110
-
111
- return doCall({ method: 'POST', url: `version`, data: postData });
112
- })
113
- .then((response) => {
114
- tools.logSuccess(`OK ${response.status}`);
115
- return response;
116
- })
117
- .catch((e) => {
118
- tools.logError(`ERROR ${e.response.status}`);
119
- throw e;
120
- })
121
- }
122
- })
123
-
124
- .catch((e) => {
125
- throw e;
126
- });
127
- }
128
-
129
-
130
-
131
-
132
-
133
-
134
- const doCall = (options) => {
135
- const JIRA_BASE_URL = 'https://webgate.ec.europa.eu/CITnet/jira/rest/api/2/';
136
- const { jiraUser, jiraPassword } = tools.getArgs();
137
-
138
- axios.defaults.headers.post['Content-Type'] = 'application/json';
139
- axios.defaults.headers.put['Content-Type'] = 'application/json';
140
-
141
- return Promise.resolve()
142
- .then(() => {
143
- return axios({
144
- baseURL: JIRA_BASE_URL,
145
- url: options.url,
146
- method: options.method,
147
- data: options.data || {},
148
- auth: {
149
- username: jiraUser,
150
- password: jiraPassword
151
- }
152
- })
153
- .then((response) => {
154
- return response;
155
- })
156
- .catch((e) => {
157
- throw e;
158
- });
159
- })
160
- }
161
-
162
-
163
- module.exports = {
164
- getProject,
165
- getIssue,
166
- updateIssueVersion,
167
- createVersion,
168
- }
1
+ // 'use strict';
2
+
3
+ // // GLOBAL
4
+ // const execa = require('execa');
5
+ // const moment = require('moment');
6
+ // const axios = require('axios');
7
+
8
+ // // LOCAL
9
+ // const tools = require('../../utils/tools');
10
+
11
+
12
+ // const getProject = (projectKey) => {
13
+ // return Promise.resolve()
14
+ // .then(() => {
15
+ // return doCall({ method: 'GET', url: `/project/${projectKey}` });
16
+ // })
17
+ // .then((response) => {
18
+ // tools.logSuccess(`OK ${response.status}`);
19
+ // return response.data;
20
+ // })
21
+ // .catch((e) => {
22
+ // tools.logError(`ERROR ${e.response.status}`);
23
+ // throw e;
24
+ // })
25
+ // }
26
+
27
+ // const getIssue = (issueKey) => {
28
+ // return Promise.resolve()
29
+ // .then(() => {
30
+ // return doCall({ method: 'GET', url: `/issue/${issueKey}` });
31
+ // })
32
+ // .then((response) => {
33
+ // tools.logSuccess(`OK ${response.status}`);
34
+ // return response.data;
35
+ // })
36
+ // .catch((e) => {
37
+ // tools.logError(`ERROR ${e.response.status}`);
38
+ // throw e;
39
+ // })
40
+ // }
41
+
42
+
43
+ // const updateIssueVersion = (issueKey, version) => {
44
+ // tools.logInfo(`Updating issue: ${issueKey} with version: ${version}`);
45
+
46
+ // return Promise.resolve()
47
+ // .then(() => {
48
+
49
+ // const postData = JSON.stringify({
50
+ // "update": {
51
+ // "fixVersions": [
52
+ // {
53
+ // "add": {
54
+ // "name": version
55
+ // }
56
+ // }
57
+ // ]
58
+ // }
59
+ // });
60
+
61
+ // return doCall({ method: 'PUT', url: `/issue/${issueKey}`, data: postData });
62
+ // })
63
+ // .then((response) => {
64
+ // tools.logSuccess(`OK ${response.status}`);
65
+ // return response.data;
66
+ // })
67
+ // .catch((e) => {
68
+ // tools.logError(`ERROR ${e.response.status}`);
69
+ // throw e;
70
+ // })
71
+ // }
72
+
73
+
74
+
75
+
76
+ // const createVersion = (projectKey = 'MWP', version = 'PI9.IT1') => {
77
+ // return Promise.resolve()
78
+
79
+ // // get project from key
80
+ // .then(() => {
81
+ // return getProject(projectKey);
82
+ // })
83
+
84
+ // // check if version exists in the fetch project versions, if not create it
85
+ // .then((project) => {
86
+ // const versionFound = project.versions.filter((v) => {
87
+ // return v.name === version;
88
+ // })[0];
89
+
90
+ // if (versionFound) {
91
+ // // output the version found if exists
92
+ // tools.logInfo(`Version ${version} exist ==> id: ${versionFound.id}`);
93
+ // return versionFound;
94
+
95
+ // } else {
96
+
97
+ // // creating the version if not
98
+ // return Promise.resolve()
99
+ // .then(() => {
100
+ // tools.logInfo(`Version does not exist...creating`);
101
+
102
+ // const postData = JSON.stringify({
103
+ // project: projectKey,
104
+ // name: version,
105
+ // released: false,
106
+ // archived: false,
107
+ // description: 'Version created from CSDR',
108
+ // releaseDate: moment().format('YYYY-MM-DD')
109
+ // });
110
+
111
+ // return doCall({ method: 'POST', url: `version`, data: postData });
112
+ // })
113
+ // .then((response) => {
114
+ // tools.logSuccess(`OK ${response.status}`);
115
+ // return response;
116
+ // })
117
+ // .catch((e) => {
118
+ // tools.logError(`ERROR ${e.response.status}`);
119
+ // throw e;
120
+ // })
121
+ // }
122
+ // })
123
+
124
+ // .catch((e) => {
125
+ // throw e;
126
+ // });
127
+ // }
128
+
129
+
130
+
131
+
132
+
133
+
134
+ // const doCall = (options) => {
135
+ // const JIRA_BASE_URL = 'https://webgate.ec.europa.eu/CITnet/jira/rest/api/2/';
136
+ // const { jiraUser, jiraPassword } = tools.getArgs();
137
+
138
+ // axios.defaults.headers.post['Content-Type'] = 'application/json';
139
+ // axios.defaults.headers.put['Content-Type'] = 'application/json';
140
+
141
+ // return Promise.resolve()
142
+ // .then(() => {
143
+ // return axios({
144
+ // baseURL: JIRA_BASE_URL,
145
+ // url: options.url,
146
+ // method: options.method,
147
+ // data: options.data || {},
148
+ // auth: {
149
+ // username: jiraUser,
150
+ // password: jiraPassword
151
+ // }
152
+ // })
153
+ // .then((response) => {
154
+ // return response;
155
+ // })
156
+ // .catch((e) => {
157
+ // throw e;
158
+ // });
159
+ // })
160
+ // }
161
+
162
+
163
+ // module.exports = {
164
+ // getProject,
165
+ // getIssue,
166
+ // updateIssueVersion,
167
+ // createVersion,
168
+ // }
169
169