@clickview/ship-it 0.0.2 → 0.0.4-dev.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 (69) hide show
  1. package/config.json +5 -0
  2. package/lib/config.json +5 -0
  3. package/lib/src/api-clients/GitLabApiClient.js +1 -1
  4. package/lib/src/api-clients/git-lab/GitLabApiClient.js +341 -0
  5. package/lib/src/api-clients/git-lab/GitLabMapper.js +61 -0
  6. package/lib/src/api-clients/index.js +2 -1
  7. package/lib/src/api-clients/team-city/TeamCityApiClient.js +85 -0
  8. package/lib/src/commands/BumpPackagesCommand.js +12 -6
  9. package/lib/src/commands/CommitPackageVersionsCommand.js +78 -0
  10. package/lib/src/commands/CreateBranchCommand.js +12 -14
  11. package/lib/src/commands/CreateMergeRequestCommand.js +16 -18
  12. package/lib/src/commands/CreateReleaseNotesCommand.js +6 -8
  13. package/lib/src/commands/InstallPackagesCommand.js +76 -0
  14. package/lib/src/commands/ReleaseCommand.js +31 -24
  15. package/lib/src/commands/StartConsumingProjectBuildsCommand.js +76 -0
  16. package/lib/src/commands/StatusCommand.js +3 -5
  17. package/lib/src/commands/ValidateMergeRequestCommand.js +76 -0
  18. package/lib/src/commands/VersionCommand.js +3 -5
  19. package/lib/src/commands/index.js +3 -0
  20. package/lib/src/constants/CommandTypeMapping.js +16 -0
  21. package/lib/src/constants/MonorepoPackageJsonFiles.js +13 -0
  22. package/lib/src/constants/TeamCityBuildIDs.js +13 -0
  23. package/lib/src/constants/index.js +18 -0
  24. package/lib/src/errors/ShipItError.js +32 -0
  25. package/lib/src/errors/index.js +17 -0
  26. package/lib/src/index.js +2 -85
  27. package/lib/src/interfaces/VersionType.js +2 -0
  28. package/lib/src/interfaces/command-cli-options/MilestoneCommandCliOptions.js +2 -0
  29. package/lib/src/interfaces/command-cli-options/ReleaseCommandCliOptions.js +2 -0
  30. package/lib/src/interfaces/command-cli-options/index.js +18 -0
  31. package/lib/src/interfaces/command-options/BumpPackagesCommandOptions.js +2 -0
  32. package/lib/src/interfaces/command-options/CommitPackageVersionsCommandOptions.js +2 -0
  33. package/lib/src/interfaces/command-options/DockerMilestoneCommandOptions.js +2 -0
  34. package/lib/src/interfaces/command-options/InstallPackagesCommandOptions.js +2 -0
  35. package/lib/src/interfaces/command-options/MilestoneCommandOptions.js +2 -0
  36. package/lib/src/interfaces/command-options/ReleaseCommandOptions.js +2 -0
  37. package/lib/src/interfaces/command-options/ValidateMRCommandOptions.js +2 -0
  38. package/lib/src/interfaces/command-options/index.js +21 -0
  39. package/lib/src/interfaces/index.js +3 -1
  40. package/lib/src/interfaces/models/Milestone.js +2 -0
  41. package/lib/src/interfaces/models/index.js +1 -0
  42. package/lib/src/inversify.config.js +13 -0
  43. package/lib/src/services/GitLabService.js +128 -34
  44. package/lib/src/services/TeamCityService.js +34 -0
  45. package/lib/src/services/index.js +1 -0
  46. package/lib/src/startup/AddMilestoneCommand.js +81 -0
  47. package/lib/src/startup/GetAction.js +68 -0
  48. package/lib/src/startup/SetupCommands.js +114 -0
  49. package/lib/src/tasks/BumpPackagesTask.js +114 -238
  50. package/lib/src/tasks/BumpVersionTxtTask.js +13 -26
  51. package/lib/src/tasks/CommitLocalPackagesTask.js +137 -0
  52. package/lib/src/tasks/CommitPackageVersionsTask.js +105 -0
  53. package/lib/src/tasks/CreateBranchTask.js +35 -32
  54. package/lib/src/tasks/CreateMergeRequestTask.js +22 -37
  55. package/lib/src/tasks/CreateReleaseNotesTask.js +2 -6
  56. package/lib/src/tasks/InstallPackagesTask.js +337 -0
  57. package/lib/src/tasks/StartConsumingProjectBuildsTask.js +143 -0
  58. package/lib/src/tasks/StartMonorepoBuildTask.js +95 -0
  59. package/lib/src/tasks/ValidateCommitsTask.js +6 -14
  60. package/lib/src/tasks/ValidateDescriptionsTask.js +15 -16
  61. package/lib/src/tasks/ValidateMergeRequestTask.js +108 -0
  62. package/lib/src/tasks/ValidateTask.js +7 -8
  63. package/lib/src/tasks/VersionTask.js +7 -20
  64. package/lib/src/tasks/index.js +5 -0
  65. package/lib/src/types.js +13 -2
  66. package/lib/src/utils/BranchNames.js +2 -0
  67. package/lib/src/utils/Descriptions.js +28 -23
  68. package/lib/src/utils/ProjectIds.js +10 -6
  69. package/package.json +24 -23
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Descriptions = void 0;
4
- // const VALID_HEADINGS: any = {
5
- // 'dependencies': true,
6
- // 'before release': true,
7
- // 'customer changes': true,
8
- // 'code changes': true,
9
- // 'testing': true,
10
- // 'notes': true
11
- // };
4
+ var VALID_HEADINGS = {
5
+ 'dependencies': true,
6
+ 'before release': true,
7
+ 'customer changes': true,
8
+ 'code changes': true,
9
+ 'testing': true,
10
+ 'notes': true
11
+ };
12
12
  var VALID_MONOREPO_HEADINGS = {
13
13
  'common': true,
14
14
  'curator': true,
@@ -19,19 +19,20 @@ var VALID_MONOREPO_HEADINGS = {
19
19
  'styles': true,
20
20
  'player': true,
21
21
  'reports': true,
22
- 'analytis': true,
22
+ 'analytics': true,
23
23
  'tooling': true,
24
24
  'testing': true,
25
25
  'dependencies': true,
26
- 'notes': true
26
+ 'notes': true,
27
+ 'monorepo': true
27
28
  };
28
29
  function toObject(lines, headingPrefix) {
29
- var obj = [];
30
+ var obj = {};
30
31
  var currentHeading = 'Other';
31
32
  for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
32
33
  var line = lines_1[_i];
33
34
  // Skip empty lines
34
- if (!line.trim() || line === '/n' || line.toLowerCase().trim() === 'n/a')
35
+ if (!line.trim() || line === '/n')
35
36
  continue;
36
37
  if (line.startsWith(headingPrefix + ' ')) {
37
38
  // TODO: Potentially add heading transforms to capture multiple variants
@@ -45,7 +46,11 @@ function toObject(lines, headingPrefix) {
45
46
  */
46
47
  if (line.startsWith('!'))
47
48
  obj[currentHeading] += '\n';
48
- obj[currentHeading] += line + '\n';
49
+ /**
50
+ * Skip the line if the dev is opting out by adding n/a
51
+ */
52
+ if (line.toLowerCase().trim() !== 'n/a')
53
+ obj[currentHeading] += line + '\n';
49
54
  }
50
55
  return obj;
51
56
  }
@@ -58,11 +63,10 @@ exports.Descriptions = {
58
63
  var keys = Object.keys(obj);
59
64
  if (!(keys === null || keys === void 0 ? void 0 : keys.length))
60
65
  return false;
61
- // TODO: Uncomment below once the team is writing good MR descriptions
62
- // if (keys.some(k => !VALID_HEADINGS[k]))
63
- // return false;
64
- // if (!obj['testing'])
65
- // return false;
66
+ if (keys.some(function (k) { return !VALID_HEADINGS[k]; }))
67
+ return false;
68
+ if (obj['testing'] === undefined)
69
+ return false;
66
70
  return true;
67
71
  },
68
72
  isMonorepoDescriptionValid: function (description) {
@@ -74,9 +78,8 @@ exports.Descriptions = {
74
78
  return false;
75
79
  if (keys.some(function (k) { return !VALID_MONOREPO_HEADINGS[k]; }))
76
80
  return false;
77
- // TODO: Uncomment below once the team is writing good MR descriptions
78
- // if (!obj['testing'])
79
- // return false;
81
+ if (!obj['testing'])
82
+ return false;
80
83
  var isValid = Object.keys(obj).every(function (key) {
81
84
  if (key !== 'dependencies' && key !== 'testing')
82
85
  return true;
@@ -89,7 +92,7 @@ exports.Descriptions = {
89
92
  var descriptionObjs = mergeRequests
90
93
  .filter(function (mr) { return mr.status === 'merged'; })
91
94
  .map(function (mr) { return toObject(mr.description.split('\n'), headingPrefix); });
92
- var obj = [];
95
+ var obj = {};
93
96
  var _loop_1 = function (descriptionObj) {
94
97
  Object.keys(descriptionObj).forEach(function (key) {
95
98
  if (!obj[key])
@@ -105,6 +108,8 @@ exports.Descriptions = {
105
108
  Object.keys(obj).forEach(function (key) {
106
109
  if (key === 'notes')
107
110
  return;
111
+ if (!obj[key])
112
+ return;
108
113
  description += '\n' + headingPrefix + ' ' + key.charAt(0).toUpperCase() + key.slice(1) + '\n';
109
114
  description += obj[key];
110
115
  });
@@ -116,7 +121,7 @@ exports.Descriptions = {
116
121
  var descriptionObjs = mergeRequests
117
122
  .filter(function (mr) { return mr.status === 'merged'; })
118
123
  .map(function (mr) { return toObject(mr.description.split('\n'), '#'); });
119
- var combinedObj = [];
124
+ var combinedObj = {};
120
125
  var _loop_2 = function (descriptionObj) {
121
126
  Object.keys(descriptionObj).forEach(function (key) {
122
127
  if (!combinedObj[key])
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- // TODO: Eventually this should allow us to map project names to project ids
3
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
4
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
4
  };
6
5
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ProjectIds = void 0;
6
+ exports.ProjectIds = exports.PROJECT_NAMES = void 0;
8
7
  var lodash_1 = __importDefault(require("lodash"));
9
- var PROJECT_NAMES = {
10
- monorepo: '789',
8
+ var errors_1 = require("../errors");
9
+ exports.PROJECT_NAMES = {
10
+ monorepo: '798',
11
11
  online: '109',
12
12
  curator: '62',
13
13
  cloud: '534',
@@ -16,6 +16,10 @@ var PROJECT_NAMES = {
16
16
  };
17
17
  exports.ProjectIds = {
18
18
  MONOREPO_PROJECT_ID: '798',
19
+ /**
20
+ * This allows project names to be passed into the CLI.
21
+ * For example `ship-it release -m S2 -p lite`
22
+ */
19
23
  getProjectIds: function (projects) {
20
24
  var projectIds = [];
21
25
  for (var _i = 0, projects_1 = projects; _i < projects_1.length; _i++) {
@@ -24,9 +28,9 @@ exports.ProjectIds = {
24
28
  projectIds.push(project);
25
29
  continue;
26
30
  }
27
- var mappedId = PROJECT_NAMES[project.toLowerCase()];
31
+ var mappedId = exports.PROJECT_NAMES[project.toLowerCase()];
28
32
  if (!mappedId)
29
- throw new Error("Could not find project id mapping for ".concat(project));
33
+ throw new errors_1.ShipItError("Could not find project id mapping for ".concat(project));
30
34
  projectIds.push(mappedId);
31
35
  }
32
36
  return projectIds;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@clickview/ship-it",
3
- "version": "0.0.2",
3
+ "version": "0.0.4-dev.0",
4
4
  "description": "Release Manager",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
7
7
  "ship-it": "./lib/src/index.js"
8
8
  },
9
9
  "scripts": {
10
- "start": "npm run lint && ts-node src/index.ts",
10
+ "start": "npm run lint && ts-node --files src/index.ts",
11
11
  "build": "npm run lint && tsc -p . && tsc-alias -p tsconfig.json",
12
12
  "lint": "eslint . --ext .ts"
13
13
  },
@@ -18,28 +18,29 @@
18
18
  "author": "Joshua Taylor, Shale Kuzmanovski",
19
19
  "license": "ISC",
20
20
  "dependencies": {
21
- "@gitbeaker/node": "^35.6.0",
22
- "chalk": "^4.1.2",
23
- "commander": "^9.1.0",
24
- "fs-extra": "^10.0.1",
25
- "inversify": "^6.0.1",
26
- "lodash": "^4.17.21",
27
- "reflect-metadata": "^0.1.13",
28
- "semver": "^7.3.5"
21
+ "@gitbeaker/node": "35.6.0",
22
+ "chalk": "4.1.2",
23
+ "commander": "9.1.0",
24
+ "fs-extra": "10.0.1",
25
+ "inversify": "6.0.1",
26
+ "lodash": "4.17.21",
27
+ "reflect-metadata": "0.1.13",
28
+ "semver": "7.3.5",
29
+ "teamcity-rest-api": "0.0.8"
29
30
  },
30
31
  "devDependencies": {
31
- "@clickview/eslint-config": "^1.0.3",
32
- "@types/fs-extra": "^9.0.13",
33
- "@types/lodash": "^4.14.181",
34
- "@types/node": "^17.0.23",
35
- "@types/semver": "^7.3.9",
36
- "@typescript-eslint/eslint-plugin": "^5.17.0",
37
- "@typescript-eslint/parser": "^5.17.0",
38
- "eslint": "^8.12.0",
39
- "eslint-plugin-react-hooks": "^4.4.0",
40
- "ts-node": "^10.7.0",
41
- "tsc-alias": "^1.6.6",
42
- "tsconfig-paths": "^3.14.1",
43
- "typescript": "^4.6.3"
32
+ "@clickview/eslint-config": "1.0.3",
33
+ "@types/fs-extra": "9.0.13",
34
+ "@types/lodash": "4.14.181",
35
+ "@types/node": "17.0.23",
36
+ "@types/semver": "7.3.9",
37
+ "@typescript-eslint/eslint-plugin": "5.17.0",
38
+ "@typescript-eslint/parser": "5.17.0",
39
+ "eslint": "8.12.0",
40
+ "eslint-plugin-react-hooks": "4.4.0",
41
+ "ts-node": "10.7.0",
42
+ "tsc-alias": "1.6.6",
43
+ "tsconfig-paths": "3.14.1",
44
+ "typescript": "4.6.3"
44
45
  }
45
46
  }