@clickview/ship-it 0.0.49 → 0.0.51

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 (66) hide show
  1. package/config.json +7 -1
  2. package/lib/config.json +7 -1
  3. package/lib/src/api-clients/git-lab/GitLabApiClient.js +30 -1
  4. package/lib/src/api-clients/index.js +1 -0
  5. package/lib/src/api-clients/slack/SlackApiClient.js +27 -25
  6. package/lib/src/api-clients/team-city/TeamCityApiClient.js +1 -1
  7. package/lib/src/api-clients/trello/TrelloApiClient.js +1 -1
  8. package/lib/src/commands/BumpPackagesCommand.js +1 -1
  9. package/lib/src/commands/CheckReleaseReadyCommand.js +1 -1
  10. package/lib/src/commands/ConfigureProjectsCommand.js +1 -1
  11. package/lib/src/commands/CreateBranchCommand.js +1 -1
  12. package/lib/src/commands/CreateHotfixCommand.js +1 -1
  13. package/lib/src/commands/CreateMergeRequestCommand.js +1 -1
  14. package/lib/src/commands/CreateNotesAuditCommand.js +1 -1
  15. package/lib/src/commands/CreateReleaseNotesCommand.js +1 -1
  16. package/lib/src/commands/CreateTrelloCardsCommand.js +1 -1
  17. package/lib/src/commands/InstallPackagesCommand.js +1 -1
  18. package/lib/src/commands/JiraTicketsStatusCommand.js +1 -41
  19. package/lib/src/commands/ListProjectsCommand.js +1 -1
  20. package/lib/src/commands/ReleaseCommand.js +1 -1
  21. package/lib/src/commands/StartProjectBuildsCommand.js +1 -1
  22. package/lib/src/commands/StatusCommand.js +1 -1
  23. package/lib/src/commands/TagMasterCommand.js +1 -1
  24. package/lib/src/commands/ToolingReleaseCommand.js +1 -1
  25. package/lib/src/commands/UpdateDescriptionCommand.js +1 -1
  26. package/lib/src/commands/ValidateMergeRequestCommand.js +1 -1
  27. package/lib/src/commands/VersionCommand.js +1 -1
  28. package/lib/src/commands/index.js +2 -0
  29. package/lib/src/constants/CommandTypeMapping.js +2 -0
  30. package/lib/src/inversify.config.js +7 -0
  31. package/lib/src/services/GitLabService.js +12 -4
  32. package/lib/src/services/SlackService.js +3 -7
  33. package/lib/src/services/TrelloService.js +1 -1
  34. package/lib/src/services/index.js +1 -0
  35. package/lib/src/startup/AddMilestoneCommand.js +1 -1
  36. package/lib/src/startup/GetAction.js +1 -1
  37. package/lib/src/startup/SetupCommands.js +3 -1
  38. package/lib/src/tasks/BumpPackagesTask.js +1 -1
  39. package/lib/src/tasks/BumpVersionTxtTask.js +1 -1
  40. package/lib/src/tasks/ChangeMilestoneTask.js +1 -1
  41. package/lib/src/tasks/CheckReleaseReadyTask.js +29 -17
  42. package/lib/src/tasks/CreateBranchTask.js +1 -1
  43. package/lib/src/tasks/CreateHotfixTask.js +1 -1
  44. package/lib/src/tasks/CreateMergeRequestTask.js +1 -1
  45. package/lib/src/tasks/CreateNotesAuditTask.js +40 -16
  46. package/lib/src/tasks/CreateReleaseNotesTask.js +1 -1
  47. package/lib/src/tasks/InstallPackagesTask.js +1 -1
  48. package/lib/src/tasks/ListProjectsTask.js +1 -1
  49. package/lib/src/tasks/PopulateTrelloBoardTask.js +1 -1
  50. package/lib/src/tasks/StartMonorepoBuildTask.js +20 -26
  51. package/lib/src/tasks/StartProjectBuildsTask.js +1 -1
  52. package/lib/src/tasks/TagMasterTask.js +1 -1
  53. package/lib/src/tasks/UpdateMergeRequestDescriptionTask.js +1 -1
  54. package/lib/src/tasks/ValidateCommitsTask.js +1 -1
  55. package/lib/src/tasks/ValidateDescriptionsTask.js +1 -1
  56. package/lib/src/tasks/ValidateMergeRequestTask.js +1 -1
  57. package/lib/src/tasks/ValidateTask.js +23 -20
  58. package/lib/src/tasks/VersionTask.js +1 -1
  59. package/lib/src/tasks/configure-projects/AddApprovalRulesTask.js +1 -1
  60. package/lib/src/tasks/configure-projects/CreateToolingBranchTask.js +1 -1
  61. package/lib/src/tasks/configure-projects/EnsureApprovalRulesTask.js +1 -1
  62. package/lib/src/tasks/configure-projects/primitives/BaseConfigureProjectsTask.js +2 -2
  63. package/lib/src/tasks/index.js +2 -0
  64. package/lib/src/types.js +7 -0
  65. package/lib/src/utils/Descriptions.js +38 -10
  66. package/package.json +6 -5
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  function verb(n) { return function (v) { return step([n, v]); }; }
38
38
  function step(op) {
39
39
  if (f) throw new TypeError("Generator is already executing.");
40
- while (_) try {
40
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
41
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
42
  if (y = 0, t) op = [op[0] & 2, t.value];
43
43
  switch (op[0]) {
@@ -216,9 +216,9 @@ var ValidateTask = /** @class */ (function () {
216
216
  };
217
217
  ValidateTask.prototype.notReadyMrsLog = function (projects, milestone, slackNotifier, nextMilestone) {
218
218
  return __awaiter(this, void 0, void 0, function () {
219
- var allNotReadyMrs, emailListNotReadyMrs, _i, projects_2, project, notReadyMrs, groupedByUser, logMessageSlack, _a, _b, _c, key, name, authorEmail, _d, _e, mr, updated, threadLabel, statusCleanMessage;
220
- return __generator(this, function (_f) {
221
- switch (_f.label) {
219
+ var allNotReadyMrs, emailListNotReadyMrs, _i, projects_2, project, notReadyMrs, groupedByUser, logMessageSlack, _a, _b, _c, _d, key, name, authorEmail, _e, _f, mr, updated, threadLabel, statusCleanMessage;
220
+ return __generator(this, function (_g) {
221
+ switch (_g.label) {
222
222
  case 0:
223
223
  allNotReadyMrs = [];
224
224
  emailListNotReadyMrs = [];
@@ -230,14 +230,17 @@ var ValidateTask = /** @class */ (function () {
230
230
  }
231
231
  groupedByUser = lodash_1.default.groupBy(allNotReadyMrs, function (mr) { return mr.author; });
232
232
  logMessageSlack = '';
233
- _a = [];
234
- for (_b in groupedByUser)
235
- _a.push(_b);
236
- _c = 0;
237
- _f.label = 1;
233
+ _a = groupedByUser;
234
+ _b = [];
235
+ for (_c in _a)
236
+ _b.push(_c);
237
+ _d = 0;
238
+ _g.label = 1;
238
239
  case 1:
239
- if (!(_c < _a.length)) return [3 /*break*/, 6];
240
- key = _a[_c];
240
+ if (!(_d < _b.length)) return [3 /*break*/, 6];
241
+ _c = _b[_d];
242
+ if (!(_c in _a)) return [3 /*break*/, 5];
243
+ key = _c;
241
244
  name = key;
242
245
  // Pretty sure this can't happen now 😅
243
246
  if (!name || name === 'undefined')
@@ -246,29 +249,29 @@ var ValidateTask = /** @class */ (function () {
246
249
  emailListNotReadyMrs.push(authorEmail);
247
250
  utils_1.Logger.logMessage(name);
248
251
  logMessageSlack += "".concat(name, ":\n");
249
- _d = 0, _e = groupedByUser[key];
250
- _f.label = 2;
252
+ _e = 0, _f = groupedByUser[key];
253
+ _g.label = 2;
251
254
  case 2:
252
- if (!(_d < _e.length)) return [3 /*break*/, 5];
253
- mr = _e[_d];
255
+ if (!(_e < _f.length)) return [3 /*break*/, 5];
256
+ mr = _f[_e];
254
257
  utils_1.Logger.logMessage("- ".concat(mr.url));
255
258
  logMessageSlack += "- ".concat(mr.url, "\n");
256
259
  if (!nextMilestone) return [3 /*break*/, 4];
257
260
  return [4 /*yield*/, this.updateMrMilestone(nextMilestone.id, milestone, mr)];
258
261
  case 3:
259
- updated = _f.sent();
262
+ updated = _g.sent();
260
263
  if (updated) {
261
264
  logMessageSlack += " -> MR has been rolled over from '".concat(milestone, "' to '").concat(nextMilestone.name, "' successfully\n");
262
265
  }
263
266
  else {
264
267
  logMessageSlack += " -> Failed to roll over milestone for this MR. Check logs for error.\n";
265
268
  }
266
- _f.label = 4;
269
+ _g.label = 4;
267
270
  case 4:
268
- _d++;
271
+ _e++;
269
272
  return [3 /*break*/, 2];
270
273
  case 5:
271
- _c++;
274
+ _d++;
272
275
  return [3 /*break*/, 1];
273
276
  case 6:
274
277
  if (!slackNotifier)
@@ -288,7 +291,7 @@ var ValidateTask = /** @class */ (function () {
288
291
  })];
289
292
  case 7:
290
293
  // Send formated status update in slack
291
- _f.sent();
294
+ _g.sent();
292
295
  return [2 /*return*/];
293
296
  }
294
297
  });
@@ -26,7 +26,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
26
26
  function verb(n) { return function (v) { return step([n, v]); }; }
27
27
  function step(op) {
28
28
  if (f) throw new TypeError("Generator is already executing.");
29
- while (_) try {
29
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
30
30
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
31
  if (y = 0, t) op = [op[0] & 2, t.value];
32
32
  switch (op[0]) {
@@ -46,7 +46,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
46
46
  function verb(n) { return function (v) { return step([n, v]); }; }
47
47
  function step(op) {
48
48
  if (f) throw new TypeError("Generator is already executing.");
49
- while (_) try {
49
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
50
50
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
51
51
  if (y = 0, t) op = [op[0] & 2, t.value];
52
52
  switch (op[0]) {
@@ -35,7 +35,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  function verb(n) { return function (v) { return step([n, v]); }; }
36
36
  function step(op) {
37
37
  if (f) throw new TypeError("Generator is already executing.");
38
- while (_) try {
38
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
39
39
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
40
40
  if (y = 0, t) op = [op[0] & 2, t.value];
41
41
  switch (op[0]) {
@@ -26,7 +26,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
26
26
  function verb(n) { return function (v) { return step([n, v]); }; }
27
27
  function step(op) {
28
28
  if (f) throw new TypeError("Generator is already executing.");
29
- while (_) try {
29
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
30
30
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
31
  if (y = 0, t) op = [op[0] & 2, t.value];
32
32
  switch (op[0]) {
@@ -26,7 +26,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
26
26
  function verb(n) { return function (v) { return step([n, v]); }; }
27
27
  function step(op) {
28
28
  if (f) throw new TypeError("Generator is already executing.");
29
- while (_) try {
29
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
30
30
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
31
  if (y = 0, t) op = [op[0] & 2, t.value];
32
32
  switch (op[0]) {
@@ -54,7 +54,7 @@ var inversify_1 = require("inversify");
54
54
  var types_1 = require("../../../types");
55
55
  var services_1 = require("../../../services");
56
56
  var GROUP_IDS = [
57
- '1091',
57
+ '1091', // ClickView / front-end
58
58
  '1092' // ClickView / back-end
59
59
  ];
60
60
  var BaseConfigureProjectsTask = /** @class */ (function () {
@@ -21,6 +21,7 @@ __exportStar(require("./CreateBranchTask"), exports);
21
21
  __exportStar(require("./CreateMergeRequestTask"), exports);
22
22
  __exportStar(require("./CreateReleaseNotesTask"), exports);
23
23
  __exportStar(require("./CreateNotesAuditTask"), exports);
24
+ __exportStar(require("./JiraTicketsStatusTask"), exports);
24
25
  __exportStar(require("./InstallPackagesTask"), exports);
25
26
  __exportStar(require("./StartProjectBuildsTask"), exports);
26
27
  __exportStar(require("./StartMonorepoBuildTask"), exports);
@@ -32,5 +33,6 @@ __exportStar(require("./ValidateMergeRequestTask"), exports);
32
33
  __exportStar(require("./ValidateTask"), exports);
33
34
  __exportStar(require("./VersionTask"), exports);
34
35
  __exportStar(require("./PopulateTrelloBoardTask"), exports);
36
+ __exportStar(require("./CheckReleaseReadyTask"), exports);
35
37
  __exportStar(require("./CreateHotfixTask"), exports);
36
38
  __exportStar(require("./UpdateMergeRequestDescriptionTask"), exports);
package/lib/src/types.js CHANGED
@@ -3,18 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.COMMANDS = exports.TASKS = exports.SERVICES = exports.API_CLIENTS = exports.MISC = void 0;
4
4
  exports.MISC = {
5
5
  GitLabConfig: Symbol.for('GitLabConfig'),
6
+ JiraConfig: Symbol.for('JiraConfig'),
6
7
  TeamCityConfig: Symbol.for('TeamCityConfig'),
7
8
  TrelloConfig: Symbol.for('TrelloConfig'),
8
9
  SlackConfig: Symbol.for('SlackConfig')
9
10
  };
10
11
  exports.API_CLIENTS = {
11
12
  GitLabApiClient: Symbol.for('GitLabApiClient'),
13
+ JiraApiClient: Symbol.for('JiraApiClient'),
12
14
  TeamCityApiClient: Symbol.for('TeamCityApiClient'),
13
15
  TrelloApiClient: Symbol.for('TrelloApiClient'),
14
16
  SlackApiClient: Symbol.for('SlackApiClient')
15
17
  };
16
18
  exports.SERVICES = {
17
19
  GitLabService: Symbol.for('GitLabService'),
20
+ JiraService: Symbol.for('JiraService'),
18
21
  TeamCityService: Symbol.for('TeamCityService'),
19
22
  TrelloService: Symbol.for('TrelloService'),
20
23
  SlackService: Symbol.for('SlackService')
@@ -29,6 +32,7 @@ exports.TASKS = {
29
32
  ValidateDescriptionsTask: Symbol.for('ValidateDescriptionsTask'),
30
33
  CreateReleaseNotesTask: Symbol.for('CreateReleaseNotesTask'),
31
34
  CreateNotesAuditTask: Symbol.for('CreateNotesAuditTask'),
35
+ JiraTicketsStatusTask: Symbol.for('JiraTicketsStatusTask'),
32
36
  InstallPackagesTask: Symbol.for('InstallPackagesTask'),
33
37
  BumpPackagesTask: Symbol.for('BumpPackagesTask'),
34
38
  ValidateMergeRequestTask: Symbol.for('ValidateMergeRequestTask'),
@@ -40,6 +44,7 @@ exports.TASKS = {
40
44
  AddApprovalRulesTask: Symbol.for('AddApprovalRulesTask'),
41
45
  CreateToolingBranchTask: Symbol.for('CreateToolingBranchTask'),
42
46
  EnsureApprovalRulesTask: Symbol.for('EnsureApprovalRulesTask'),
47
+ CheckReleaseReadyTask: Symbol.for('CheckReleaseReadyTask'),
43
48
  CreateHotfixTask: Symbol.for('CreateHotfixTask'),
44
49
  ChangeMilestoneTask: Symbol.for('ChangeMilestoneTask'),
45
50
  UpdateMergeRequestDescriptionTask: Symbol.for('UpdateMergeRequestDescriptionTask')
@@ -53,6 +58,7 @@ exports.COMMANDS = {
53
58
  CreateMergeRequestCommand: Symbol.for('CreateMergeRequestCommand'),
54
59
  CreateReleaseNotesCommand: Symbol.for('CreateReleaseNotesCommand'),
55
60
  CreateNotesAuditCommand: Symbol.for('CreateNotesAuditCommand'),
61
+ JiraTicketsStatusCommand: Symbol.for('JiraTicketsStatusCommand'),
56
62
  InstallPackagesCommand: Symbol.for('InstallPackagesCommand'),
57
63
  BumpPackagesCommand: Symbol.for('BumpPackagesCommand'),
58
64
  ValidateMergeRequestCommand: Symbol.for('ValidateMergeRequestCommand'),
@@ -61,6 +67,7 @@ exports.COMMANDS = {
61
67
  ListProjectsCommand: Symbol.for('ListProjectsCommand'),
62
68
  CreateTrelloCardsCommand: Symbol.for('CreateTrelloCardsCommand'),
63
69
  ConfigureProjectsCommand: Symbol.for('ConfigureProjectsCommand'),
70
+ CheckReleaseReadyCommand: Symbol.for('CheckReleaseReadyCommand'),
64
71
  CreateHotfixCommand: Symbol.for('CreateHotfixCommand'),
65
72
  UpdateDescriptionCommand: Symbol.for('UpdateDescriptionCommand')
66
73
  };
@@ -35,7 +35,7 @@ var HEADING_ORDER = [
35
35
  Headings.AfterRelease,
36
36
  Headings.CustomerChanges,
37
37
  Headings.CodeChanges,
38
- '*',
38
+ '*', // This wildcard is where all the other headings will go
39
39
  Headings.Testing,
40
40
  Headings.Notes,
41
41
  ];
@@ -237,15 +237,43 @@ exports.Descriptions = {
237
237
  description += MERGE_REQUEST_CHECKLIST;
238
238
  return description;
239
239
  },
240
- getDescriptionSection: function (heading, mergeRequest) {
241
- var descriptionObj = toObject(mergeRequest.description.split('\n'), '#');
242
- var obj = {};
243
- Object.keys(descriptionObj).forEach(function (key) {
244
- if (!obj[key])
245
- obj[key] = '';
246
- obj[key] += descriptionObj[key] + '\n';
247
- });
248
- return obj[Headings[heading]];
240
+ // eslint-disable-next-line max-len
241
+ getDescriptionSection: function (heading, mergeRequest, subHeading) {
242
+ if (!subHeading) {
243
+ var descriptionObj_1 = toObject(mergeRequest.description.split('\n'), '#');
244
+ var obj_1 = {};
245
+ Object.keys(descriptionObj_1).forEach(function (key) {
246
+ if (!obj_1[key])
247
+ obj_1[key] = '';
248
+ obj_1[key] += descriptionObj_1[key] + '\n';
249
+ });
250
+ return obj_1[Headings[heading]];
251
+ }
252
+ var descriptionLines = mergeRequest.description.split('\n');
253
+ var mainHeadingText = "# ".concat(Headings[heading]);
254
+ var subHeadingText = "## ".concat(Headings[subHeading]);
255
+ var inMainSection = false;
256
+ var inSubSection = false;
257
+ var collectedLines = [];
258
+ for (var _i = 0, descriptionLines_1 = descriptionLines; _i < descriptionLines_1.length; _i++) {
259
+ var line = descriptionLines_1[_i];
260
+ if (line.trim() === mainHeadingText) {
261
+ inMainSection = true;
262
+ inSubSection = false;
263
+ continue;
264
+ }
265
+ if (inMainSection && line.startsWith('# ') && line.trim() !== mainHeadingText)
266
+ break;
267
+ if (inMainSection && line.trim() === subHeadingText) {
268
+ inSubSection = true;
269
+ continue;
270
+ }
271
+ if (inSubSection && line.startsWith('## ') && line.trim() !== subHeadingText)
272
+ break;
273
+ if (inSubSection)
274
+ collectedLines.push(line);
275
+ }
276
+ return collectedLines.length > 0 ? collectedLines.join('\n').trim() : '';
249
277
  },
250
278
  // TODO: This isn't readable, it needs to be refactored
251
279
  getMonorepoCombinedDescription: function (mergeRequests) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickview/ship-it",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "description": "Release Manager",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -19,13 +19,14 @@
19
19
  "license": "ISC",
20
20
  "dependencies": {
21
21
  "@gitbeaker/node": "35.6.0",
22
+ "@slack/web-api": "6.11.2",
22
23
  "@slack/webhook": "7.0.2",
23
- "@slack/web-api":"6.11.2",
24
24
  "chalk": "4.1.2",
25
25
  "commander": "9.1.0",
26
26
  "fast-csv": "4.3.6",
27
27
  "fs-extra": "10.0.1",
28
28
  "inversify": "6.0.1",
29
+ "jira.js": "5.3.1",
29
30
  "lodash": "4.17.21",
30
31
  "reflect-metadata": "0.1.13",
31
32
  "semver": "7.3.5",
@@ -38,13 +39,13 @@
38
39
  "@types/lodash": "4.14.181",
39
40
  "@types/node": "17.0.23",
40
41
  "@types/semver": "7.3.9",
41
- "@typescript-eslint/eslint-plugin": "5.17.0",
42
- "@typescript-eslint/parser": "5.17.0",
42
+ "@typescript-eslint/eslint-plugin": "6.21.0",
43
+ "@typescript-eslint/parser": "6.21.0",
43
44
  "eslint": "8.12.0",
44
45
  "eslint-plugin-react-hooks": "4.4.0",
45
46
  "ts-node": "10.7.0",
46
47
  "tsc-alias": "1.6.6",
47
48
  "tsconfig-paths": "3.14.1",
48
- "typescript": "4.6.3"
49
+ "typescript": "5.3.3"
49
50
  }
50
51
  }