@eui/tools 4.15.8 → 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 (117) hide show
  1. package/.version.properties +1 -1
  2. package/CHANGELOG.md +41 -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/package.js +41 -5
  10. package/scripts/csdr/cli/skeletons/app-showcase-eui13/angular-config.json +33 -0
  11. package/scripts/csdr/cli/skeletons/app-showcase-eui13/dependencies-composite.json +5 -0
  12. package/scripts/csdr/cli/skeletons/app-showcase-eui13/gitignore_TO_REPLACE +50 -0
  13. package/scripts/csdr/cli/skeletons/app-showcase-eui13/package.json +6 -0
  14. package/scripts/csdr/cli/skeletons/app-showcase-eui13/scripts.json +3 -0
  15. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/app-routing.module.ts +21 -0
  16. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/app.component.html +26 -0
  17. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/app.component.ts +19 -0
  18. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/app.routes.ts +7 -0
  19. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/features/_home/home-routing.module.ts +15 -0
  20. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/features/_home/home.component.html +7 -0
  21. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/features/_home/home.component.ts +8 -0
  22. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/features/_home/home.module.ts +17 -0
  23. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/app/features/shared/shared.module.ts +15 -0
  24. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/assets/app-metadata.json +8 -0
  25. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/assets/config/env-json-config.json +41 -0
  26. package/scripts/csdr/cli/skeletons/app-showcase-eui13/src/index.html +22 -0
  27. package/scripts/csdr/cli/skeletons/package/frontend-eui10/assets/i18n/en.json +3 -0
  28. package/scripts/csdr/cli/skeletons/package/frontend-eui10/assets/i18n/fr.json +3 -0
  29. package/scripts/csdr/cli/skeletons/package/frontend-eui10/gitignore_TO_REPLACE +46 -0
  30. package/scripts/csdr/cli/skeletons/package/frontend-eui10/karma.conf.js +7 -0
  31. package/scripts/csdr/cli/skeletons/package/frontend-eui10/ng-package.json +7 -0
  32. package/scripts/csdr/cli/skeletons/package/frontend-eui10/package.json +4 -0
  33. package/scripts/csdr/cli/skeletons/package/frontend-eui10/src/index.ts +1 -0
  34. package/scripts/csdr/cli/skeletons/package/frontend-eui10/src/lib/module.ts +11 -0
  35. package/scripts/csdr/cli/skeletons/package/frontend-eui10/src/test.ts.TO_REPLACE +21 -0
  36. package/scripts/csdr/cli/skeletons/package/frontend-eui10/tsconfig.lib.json +32 -0
  37. package/scripts/csdr/cli/skeletons/package/frontend-eui10/tsconfig.spec.json +17 -0
  38. package/scripts/csdr/cli/skeletons/package/frontend-eui10/tslint.json +17 -0
  39. package/scripts/csdr/cli/skeletons/package/frontend-remote/angular.json +3 -3
  40. package/scripts/csdr/cli/skeletons/package/frontend-remote/dependencies-composite.json +1 -0
  41. package/scripts/csdr/cli/skeletons/package/frontend-remote/src/app/dummy.scss +3 -0
  42. package/scripts/csdr/cli/skeletons/package/frontend-remote/src/app/dummy.spec.ts +6 -0
  43. package/scripts/csdr/cli/skeletons/package/frontend-remote/src/app/module.component.ts +62 -28
  44. package/scripts/csdr/cli/skeletons/package/frontend-remote/src/app/module.ts +33 -33
  45. package/scripts/csdr/cli/skeletons/package/frontend-remote/src/app/routing.module.ts +22 -10
  46. package/scripts/csdr/cli/skeletons/package/frontend-remote/src/assets/i18n-compiled/en.json +1 -0
  47. package/scripts/csdr/cli/skeletons/package/frontend-remote/src/assets/i18n-compiled/fr.json +1 -0
  48. package/scripts/csdr/cli/skeletons/package/frontend-remote/src/config/global.ts +8 -5
  49. package/scripts/csdr/cli/skeletons/package/frontend-remote/src/index.html +1 -1
  50. package/scripts/csdr/cli/skeletons/package/frontend-remote/tsconfig.app.json +3 -1
  51. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/angular.json +90 -0
  52. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/browserslist +10 -0
  53. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/dependencies-base.json +2 -0
  54. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/dependencies-composite.json +7 -0
  55. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/gitignore_TO_REPLACE +64 -0
  56. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/karma.conf.js +7 -0
  57. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/package.json_TO_REPLACE +8 -0
  58. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/app/dummy.scss +3 -0
  59. package/scripts/csdr/cli/skeletons/package/{frontend-remote/src/app/dummy.spec.ts.TO_REPLACE → frontend-remote-eui10/src/app/dummy.spec.ts} +0 -0
  60. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/app/module.component.ts +71 -0
  61. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/app/module.ts +165 -0
  62. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/app/reducers/custom-route-serializer.ts +28 -0
  63. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/app/reducers/index.ts +42 -0
  64. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/app/routing.module.ts +51 -0
  65. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/assets/.gitkeep +0 -0
  66. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/config/global.ts +31 -0
  67. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/config/index.ts +20 -0
  68. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/config/modules.ts +3 -0
  69. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/environments/environment.prod.ts +3 -0
  70. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/environments/environment.ts +15 -0
  71. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/favicon.ico +0 -0
  72. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/index.html +10 -0
  73. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/main.ts +12 -0
  74. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/polyfills.ts +86 -0
  75. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/test.ts.TO_REPLACE +20 -0
  76. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/tsconfig.app.json +20 -0
  77. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/tsconfig.spec.json +18 -0
  78. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/tslint-remote.json +7 -0
  79. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/tslint.json +17 -0
  80. package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/webpack.extra.js +15 -0
  81. package/scripts/csdr/config/angular.js +220 -10
  82. package/scripts/csdr/config/global.js +16 -0
  83. package/scripts/csdr/install/common.js +26 -8
  84. package/scripts/csdr/jira/jira-utils.js +168 -168
  85. package/scripts/csdr/jira/update.js +150 -150
  86. package/scripts/csdr/metadata/app-envs.js +34 -33
  87. package/scripts/csdr/metadata/app-history.js +62 -61
  88. package/scripts/csdr/metadata/common.js +44 -41
  89. package/scripts/csdr/metadata/package-history.js +0 -1
  90. package/scripts/csdr/release/package/remote.js +3 -3
  91. package/scripts/csdr/release/package/ui.js +3 -3
  92. package/scripts/csdr/sync/sync-utils.js +6 -2
  93. package/scripts/utils/build/package/build-package-utils.js +45 -0
  94. package/scripts/utils/build/package/styles.js +106 -7
  95. package/scripts/utils/confluence-utils.js +126 -126
  96. package/scripts/utils/index.js +2 -2
  97. package/scripts/utils/pre-build/injection/app-sources-full-skeleton/src/_generated/favicon.ico +0 -0
  98. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/app/app.module.ts +52 -0
  99. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/app/core/reducers/index.ts +40 -0
  100. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/config/global.ts +4 -0
  101. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/config/index.ts +8 -0
  102. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/config/modules.ts +4 -0
  103. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/environments/environment.dev.ts +9 -0
  104. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/environments/environment.prod.ts +9 -0
  105. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/environments/environment.ts +21 -0
  106. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/favicon.ico +0 -0
  107. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/karma.conf.js +7 -0
  108. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/main.ts +21 -0
  109. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/polyfills.ts +86 -0
  110. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/src/_generated/tst.ts +33 -0
  111. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/tsconfig.app.json +19 -0
  112. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/tsconfig.spec.json +9 -0
  113. package/scripts/utils/pre-build/injection/app-sources-full-skeleton-eui13/tslint.json +17 -0
  114. package/scripts/utils/pre-build/injection/skeletons.js +6 -2
  115. package/scripts/utils/pre-build/projects.js +5 -1
  116. package/scripts/utils/tools.js +13 -0
  117. package/scripts/csdr/cli/skeletons/package/frontend-remote/webpack.extra.js +0 -7
@@ -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
 
@@ -1,153 +1,153 @@
1
1
  'use strict';
2
2
 
3
- const jiraUtils = require('./jira-utils');
4
- const metadataUtils = require('../metadata/metadata-utils');
5
-
6
- const tools = require('../../utils/tools');
7
- const configUtils = require('../config/config-utils');
8
-
9
- const { project, appVersion } = tools.getArgs();
10
-
11
-
12
- module.exports.update = () => {
13
-
14
- tools.logTitle('Starting jira update');
15
-
16
- if (!appVersion || !project) {
17
- throw new Error('project and appVersion arguments expected');
18
- }
19
-
20
- var validIssues;
21
-
22
- return Promise.resolve()
23
- // cloning metadata repository
24
- .then(() => {
25
- return metadataUtils.common.cloneMetadataRepo();
26
- })
27
-
28
- // retrieving build history for version
29
- .then(() => {
30
- tools.logInfo(`Retrieving project infos for ${project}`);
31
-
32
- const prj = configUtils.projects.getCsdrProject(project);
33
- console.log(prj);
34
- return metadataUtils.appHistory.getMetadata(prj);
35
- })
36
-
37
- // getting specific version metadata history
38
- .then((metadata) => {
39
- if (!metadata) {
40
- tools.logInfo('No metadata found for project... skipping');
41
- process.exit(0);
42
- }
43
-
44
- tools.logInfo(`Fetching metadata history for version : ${appVersion}`);
45
-
46
- // getting the version history for the appVersion provided
47
- const versionHistory = metadata.versions.filter((v) => {
48
- return v.name === appVersion
49
- })[0];
50
-
51
- // checking if it contains diffs metadata
52
- if (!versionHistory || versionHistory.diffs.length === 0) {
53
- tools.logInfo('No history detected for this version ... skipping');
54
- process.exit(0);
55
-
56
- // proceed to extraction
57
- } else {
58
- var jiraIssues = [];
59
-
60
- versionHistory.diffs.forEach((diffSet) => {
61
- diffSet.gitMetadata.forEach((commits) => {
62
- commits.forEach((commit) => {
63
- if (commit.issue !== '') {
64
- jiraIssues.push(commit.issue);
65
- }
66
- })
67
- })
68
- })
69
-
70
- // remove duplicates
71
- jiraIssues = jiraIssues.filter((elem, pos, arr) => {
72
- return arr.indexOf(elem) == pos;
73
- });
74
-
75
- return jiraIssues
76
- }
77
- })
78
-
79
- .then((issues) => {
80
- tools.logSuccess('Issues found : ');
81
- console.log(issues);
82
-
83
- var checkedIssues = [];
84
-
85
- return Promise.resolve()
86
- .then(() => {
87
- return issues.reduce((promise, issue) => {
88
- return promise
89
- .then(() => jiraUtils.getIssue(issue))
90
- .then((response) => {
91
- checkedIssues.push({ key: issue, status: 'OK' });
92
- tools.logSuccess(`Issue: ${issue} / status OK`);
93
- })
94
- .catch((e) => {
95
- checkedIssues.push({ key: issue, status: e.response.status === 404 ? 'NOT_FOUND' : e.response.status.toString() });
96
- tools.logWarning(`Issue: ${issue} / status ${e.response.status}`);
97
- console.log(e.response);
98
- });
99
- }, Promise.resolve());
100
- })
101
-
102
- // filter existing issues only
103
- .then(() => {
104
- return checkedIssues.filter((i) => {
105
- return i.status === 'OK';
106
- });
107
- })
108
-
109
- .catch((e) => {
110
- throw e;
111
- })
112
- })
113
-
114
- // storing for later use
115
- .then((issues) => {
116
- tools.logInfo('Valid issues found : ');
117
-
118
- if (issues.length > 0) {
119
- validIssues = issues
120
- console.log(validIssues);
121
-
122
- } else {
123
- console.log('NO valid issues found...skipping');
124
- process.exit(0);
125
- }
126
- })
127
-
128
- // create / fetch version
129
- // .then(() => {
130
- // return jiraUtils.createVersion('MWP', appVersion);
131
- // })
132
-
133
- // // update issues version
134
- // .then(() => {
135
- // return validIssues.reduce((promise, issue) => {
136
- // return promise
137
- // .then(() => jiraUtils.updateIssueVersion(issue.key, appVersion))
138
- // .then((response) => {
139
- // tools.logSuccess(`${issue} updated with version ${appVersion} => ${response.status}`);
140
- // })
141
- // .catch((e) => {
142
- // tools.logError(`Error updating issue ${issue.key} => ${e.response.status}`);
143
- // console.log(e);
144
- // });
145
- // }, Promise.resolve());
146
- // })
147
-
148
- .catch((e) => {
149
- console.log(e);
150
- process.exit(1);
151
- })
152
- }
3
+ // const jiraUtils = require('./jira-utils');
4
+ // const metadataUtils = require('../metadata/metadata-utils');
5
+
6
+ // const tools = require('../../utils/tools');
7
+ // const configUtils = require('../config/config-utils');
8
+
9
+ // const { project, appVersion } = tools.getArgs();
10
+
11
+
12
+ // module.exports.update = () => {
13
+
14
+ // tools.logTitle('Starting jira update');
15
+
16
+ // if (!appVersion || !project) {
17
+ // throw new Error('project and appVersion arguments expected');
18
+ // }
19
+
20
+ // var validIssues;
21
+
22
+ // return Promise.resolve()
23
+ // // cloning metadata repository
24
+ // .then(() => {
25
+ // return metadataUtils.common.cloneMetadataRepo();
26
+ // })
27
+
28
+ // // retrieving build history for version
29
+ // .then(() => {
30
+ // tools.logInfo(`Retrieving project infos for ${project}`);
31
+
32
+ // const prj = configUtils.projects.getCsdrProject(project);
33
+ // console.log(prj);
34
+ // return metadataUtils.appHistory.getMetadata(prj);
35
+ // })
36
+
37
+ // // getting specific version metadata history
38
+ // .then((metadata) => {
39
+ // if (!metadata) {
40
+ // tools.logInfo('No metadata found for project... skipping');
41
+ // process.exit(0);
42
+ // }
43
+
44
+ // tools.logInfo(`Fetching metadata history for version : ${appVersion}`);
45
+
46
+ // // getting the version history for the appVersion provided
47
+ // const versionHistory = metadata.versions.filter((v) => {
48
+ // return v.name === appVersion
49
+ // })[0];
50
+
51
+ // // checking if it contains diffs metadata
52
+ // if (!versionHistory || versionHistory.diffs.length === 0) {
53
+ // tools.logInfo('No history detected for this version ... skipping');
54
+ // process.exit(0);
55
+
56
+ // // proceed to extraction
57
+ // } else {
58
+ // var jiraIssues = [];
59
+
60
+ // versionHistory.diffs.forEach((diffSet) => {
61
+ // diffSet.gitMetadata.forEach((commits) => {
62
+ // commits.forEach((commit) => {
63
+ // if (commit.issue !== '') {
64
+ // jiraIssues.push(commit.issue);
65
+ // }
66
+ // })
67
+ // })
68
+ // })
69
+
70
+ // // remove duplicates
71
+ // jiraIssues = jiraIssues.filter((elem, pos, arr) => {
72
+ // return arr.indexOf(elem) == pos;
73
+ // });
74
+
75
+ // return jiraIssues
76
+ // }
77
+ // })
78
+
79
+ // .then((issues) => {
80
+ // tools.logSuccess('Issues found : ');
81
+ // console.log(issues);
82
+
83
+ // var checkedIssues = [];
84
+
85
+ // return Promise.resolve()
86
+ // .then(() => {
87
+ // return issues.reduce((promise, issue) => {
88
+ // return promise
89
+ // .then(() => jiraUtils.getIssue(issue))
90
+ // .then((response) => {
91
+ // checkedIssues.push({ key: issue, status: 'OK' });
92
+ // tools.logSuccess(`Issue: ${issue} / status OK`);
93
+ // })
94
+ // .catch((e) => {
95
+ // checkedIssues.push({ key: issue, status: e.response.status === 404 ? 'NOT_FOUND' : e.response.status.toString() });
96
+ // tools.logWarning(`Issue: ${issue} / status ${e.response.status}`);
97
+ // console.log(e.response);
98
+ // });
99
+ // }, Promise.resolve());
100
+ // })
101
+
102
+ // // filter existing issues only
103
+ // .then(() => {
104
+ // return checkedIssues.filter((i) => {
105
+ // return i.status === 'OK';
106
+ // });
107
+ // })
108
+
109
+ // .catch((e) => {
110
+ // throw e;
111
+ // })
112
+ // })
113
+
114
+ // // storing for later use
115
+ // .then((issues) => {
116
+ // tools.logInfo('Valid issues found : ');
117
+
118
+ // if (issues.length > 0) {
119
+ // validIssues = issues
120
+ // console.log(validIssues);
121
+
122
+ // } else {
123
+ // console.log('NO valid issues found...skipping');
124
+ // process.exit(0);
125
+ // }
126
+ // })
127
+
128
+ // // create / fetch version
129
+ // // .then(() => {
130
+ // // return jiraUtils.createVersion('MWP', appVersion);
131
+ // // })
132
+
133
+ // // // update issues version
134
+ // // .then(() => {
135
+ // // return validIssues.reduce((promise, issue) => {
136
+ // // return promise
137
+ // // .then(() => jiraUtils.updateIssueVersion(issue.key, appVersion))
138
+ // // .then((response) => {
139
+ // // tools.logSuccess(`${issue} updated with version ${appVersion} => ${response.status}`);
140
+ // // })
141
+ // // .catch((e) => {
142
+ // // tools.logError(`Error updating issue ${issue.key} => ${e.response.status}`);
143
+ // // console.log(e);
144
+ // // });
145
+ // // }, Promise.resolve());
146
+ // // })
147
+
148
+ // .catch((e) => {
149
+ // console.log(e);
150
+ // process.exit(1);
151
+ // })
152
+ // }
153
153