@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
package/config.json CHANGED
@@ -2,5 +2,10 @@
2
2
  "gitLab": {
3
3
  "accessToken": "glpat-YK8GmVgXRRf3zBe3JQze",
4
4
  "url": "https://gitlab.cvinternal.net"
5
+ },
6
+ "teamCity": {
7
+ "url": "http://build.cvinternal.net/",
8
+ "username": "shale.kuzmanovski",
9
+ "password": "final2&ergot"
5
10
  }
6
11
  }
package/lib/config.json CHANGED
@@ -2,5 +2,10 @@
2
2
  "gitLab": {
3
3
  "accessToken": "glpat-YK8GmVgXRRf3zBe3JQze",
4
4
  "url": "https://gitlab.cvinternal.net"
5
+ },
6
+ "teamCity": {
7
+ "url": "http://build.cvinternal.net/",
8
+ "username": "shale.kuzmanovski",
9
+ "password": "final2&ergot"
5
10
  }
6
11
  }
@@ -52,7 +52,7 @@ exports.GitLabApiClient = void 0;
52
52
  require("reflect-metadata");
53
53
  var inversify_1 = require("inversify");
54
54
  var node_1 = require("@gitbeaker/node");
55
- var types_1 = require("../types");
55
+ var types_1 = require("types");
56
56
  var GitLabApiClient = /** @class */ (function () {
57
57
  function GitLabApiClient(config) {
58
58
  this._config = config;
@@ -0,0 +1,341 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ var __generator = (this && this.__generator) || function (thisArg, body) {
24
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
+ function verb(n) { return function (v) { return step([n, v]); }; }
27
+ function step(op) {
28
+ if (f) throw new TypeError("Generator is already executing.");
29
+ while (_) try {
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
+ if (y = 0, t) op = [op[0] & 2, t.value];
32
+ switch (op[0]) {
33
+ case 0: case 1: t = op; break;
34
+ case 4: _.label++; return { value: op[1], done: false };
35
+ case 5: _.label++; y = op[1]; op = [0]; continue;
36
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
+ default:
38
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
+ if (t[2]) _.ops.pop();
43
+ _.trys.pop(); continue;
44
+ }
45
+ op = body.call(thisArg, _);
46
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
+ }
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.GitLabApiClient = void 0;
52
+ require("reflect-metadata");
53
+ var inversify_1 = require("inversify");
54
+ var node_1 = require("@gitbeaker/node");
55
+ var types_1 = require("../../types");
56
+ var errors_1 = require("../../errors");
57
+ var GitLabMapper_1 = require("./GitLabMapper");
58
+ var GitLabApiClient = /** @class */ (function () {
59
+ function GitLabApiClient(config) {
60
+ this.config = config;
61
+ this.client = new node_1.Gitlab({
62
+ token: this.config.accessToken,
63
+ host: this.config.url
64
+ });
65
+ }
66
+ GitLabApiClient.prototype.getMergeRequests = function (options) {
67
+ return __awaiter(this, void 0, void 0, function () {
68
+ var milestone, projectIds, mergeRequests;
69
+ return __generator(this, function (_a) {
70
+ switch (_a.label) {
71
+ case 0:
72
+ milestone = options.milestone, projectIds = options.projectIds;
73
+ if (!milestone && !(projectIds === null || projectIds === void 0 ? void 0 : projectIds.length))
74
+ throw new errors_1.ShipItError('Must specify one of the following: Milestone or ProjectIds');
75
+ return [4 /*yield*/, this.client.MergeRequests.all({
76
+ milestone: milestone,
77
+ scope: 'all'
78
+ })];
79
+ case 1:
80
+ mergeRequests = _a.sent();
81
+ /**
82
+ * Filter out only projectIds we care about
83
+ */
84
+ if (projectIds === null || projectIds === void 0 ? void 0 : projectIds.length) {
85
+ mergeRequests = mergeRequests.filter(function (mr) {
86
+ return projectIds.some(function (p) { return mr.project_id.toString() === p.toString(); });
87
+ });
88
+ }
89
+ return [2 /*return*/, mergeRequests.map(GitLabMapper_1.GitLabMapper.mergeRequest)];
90
+ }
91
+ });
92
+ });
93
+ };
94
+ GitLabApiClient.prototype.getProjectsByIds = function (projectIds) {
95
+ return __awaiter(this, void 0, void 0, function () {
96
+ var promises, projects;
97
+ var _this = this;
98
+ return __generator(this, function (_a) {
99
+ switch (_a.label) {
100
+ case 0:
101
+ promises = projectIds.map(function (p) { return _this.client.Projects.show(p); });
102
+ return [4 /*yield*/, Promise.all(promises)];
103
+ case 1:
104
+ projects = _a.sent();
105
+ return [2 /*return*/, projects.map(GitLabMapper_1.GitLabMapper.project)];
106
+ }
107
+ });
108
+ });
109
+ };
110
+ GitLabApiClient.prototype.getLatestTags = function (projectId) {
111
+ return __awaiter(this, void 0, void 0, function () {
112
+ var tags;
113
+ return __generator(this, function (_a) {
114
+ switch (_a.label) {
115
+ case 0: return [4 /*yield*/, this.client.Tags.all(projectId, { maxPages: 1, perPage: 20 })];
116
+ case 1:
117
+ tags = _a.sent();
118
+ if (!tags.length)
119
+ throw new errors_1.ShipItError("Project ".concat(projectId, " does not have any tags"));
120
+ return [2 /*return*/, tags.map(GitLabMapper_1.GitLabMapper.tag)];
121
+ }
122
+ });
123
+ });
124
+ };
125
+ GitLabApiClient.prototype.getCommitsSince = function (projectId, branchName, sinceSha) {
126
+ return __awaiter(this, void 0, void 0, function () {
127
+ var commit, commits;
128
+ return __generator(this, function (_a) {
129
+ switch (_a.label) {
130
+ case 0: return [4 /*yield*/, this.client.Commits.show(projectId, sinceSha)];
131
+ case 1:
132
+ commit = _a.sent();
133
+ return [4 /*yield*/, this.client.Commits.all(projectId, {
134
+ ref_name: branchName,
135
+ since: commit.committed_date,
136
+ /**
137
+ * This allows us to get merge commits of MRs being accepted
138
+ */
139
+ first_parent: true
140
+ })];
141
+ case 2:
142
+ commits = _a.sent();
143
+ return [2 /*return*/, commits.map(GitLabMapper_1.GitLabMapper.commit)];
144
+ }
145
+ });
146
+ });
147
+ };
148
+ GitLabApiClient.prototype.getBranch = function (projectId, branchName) {
149
+ return __awaiter(this, void 0, void 0, function () {
150
+ var branch, _a;
151
+ return __generator(this, function (_b) {
152
+ switch (_b.label) {
153
+ case 0:
154
+ _b.trys.push([0, 2, , 3]);
155
+ return [4 /*yield*/, this.client.Branches.show(projectId, branchName)];
156
+ case 1:
157
+ branch = _b.sent();
158
+ return [2 /*return*/, GitLabMapper_1.GitLabMapper.branch(branch)];
159
+ case 2:
160
+ _a = _b.sent();
161
+ return [2 /*return*/, null];
162
+ case 3: return [2 /*return*/];
163
+ }
164
+ });
165
+ });
166
+ };
167
+ GitLabApiClient.prototype.createBranch = function (projectId, branchName, branchFrom) {
168
+ return __awaiter(this, void 0, void 0, function () {
169
+ var newBranch;
170
+ return __generator(this, function (_a) {
171
+ switch (_a.label) {
172
+ case 0: return [4 /*yield*/, this.client.Branches.create(projectId, branchName, branchFrom)];
173
+ case 1:
174
+ newBranch = _a.sent();
175
+ return [2 /*return*/, GitLabMapper_1.GitLabMapper.branch(newBranch)];
176
+ }
177
+ });
178
+ });
179
+ };
180
+ GitLabApiClient.prototype.cherryPick = function (projectId, sha, branchName) {
181
+ return __awaiter(this, void 0, void 0, function () {
182
+ return __generator(this, function (_a) {
183
+ switch (_a.label) {
184
+ case 0: return [4 /*yield*/, this.client.Commits.cherryPick(projectId, sha, branchName)];
185
+ case 1:
186
+ _a.sent();
187
+ return [2 /*return*/];
188
+ }
189
+ });
190
+ });
191
+ };
192
+ GitLabApiClient.prototype.getMergeRequest = function (projectId, sourceBranch, targetBranch) {
193
+ return __awaiter(this, void 0, void 0, function () {
194
+ var mergeRequests, mergeRequest;
195
+ return __generator(this, function (_a) {
196
+ switch (_a.label) {
197
+ case 0: return [4 /*yield*/, this.client.MergeRequests.all({
198
+ projectId: projectId,
199
+ sourceBranch: sourceBranch,
200
+ targetBranch: targetBranch,
201
+ /**
202
+ * We only care about open MRs, this allows us to close any MR and run the CLI again if needed
203
+ */
204
+ state: 'opened'
205
+ })];
206
+ case 1:
207
+ mergeRequests = _a.sent();
208
+ mergeRequest = mergeRequests[0];
209
+ if (!mergeRequest)
210
+ return [2 /*return*/, null];
211
+ return [2 /*return*/, GitLabMapper_1.GitLabMapper.mergeRequest(mergeRequest)];
212
+ }
213
+ });
214
+ });
215
+ };
216
+ GitLabApiClient.prototype.getMergeRequestById = function (projectId, mergeRequestId) {
217
+ return __awaiter(this, void 0, void 0, function () {
218
+ var mergeRequest;
219
+ return __generator(this, function (_a) {
220
+ switch (_a.label) {
221
+ case 0: return [4 /*yield*/, this.client.MergeRequests.show(projectId, mergeRequestId)];
222
+ case 1:
223
+ mergeRequest = _a.sent();
224
+ if (!mergeRequest)
225
+ return [2 /*return*/, null];
226
+ return [2 /*return*/, GitLabMapper_1.GitLabMapper.mergeRequest(mergeRequest)];
227
+ }
228
+ });
229
+ });
230
+ };
231
+ GitLabApiClient.prototype.getReleaseMergeRequest = function (projectId, milestone) {
232
+ return __awaiter(this, void 0, void 0, function () {
233
+ var mergeRequests, releaseMR;
234
+ return __generator(this, function (_a) {
235
+ switch (_a.label) {
236
+ case 0: return [4 /*yield*/, this.client.MergeRequests.all({
237
+ projectId: projectId,
238
+ targetBranch: 'master',
239
+ /**
240
+ * We only care about open MRs, this allows us to close any MR and run the CLI again if needed
241
+ */
242
+ state: 'opened',
243
+ milestone: milestone
244
+ })];
245
+ case 1:
246
+ mergeRequests = _a.sent();
247
+ releaseMR = mergeRequests[0];
248
+ if (!releaseMR)
249
+ return [2 /*return*/, null];
250
+ return [2 /*return*/, GitLabMapper_1.GitLabMapper.mergeRequest(releaseMR)];
251
+ }
252
+ });
253
+ });
254
+ };
255
+ GitLabApiClient.prototype.createMergeRequest = function (projectId, sourceBranch, targetBranch, title, description, milestone) {
256
+ return __awaiter(this, void 0, void 0, function () {
257
+ var mergeRequest;
258
+ return __generator(this, function (_a) {
259
+ switch (_a.label) {
260
+ case 0: return [4 /*yield*/, this.client.MergeRequests.create(projectId, sourceBranch, targetBranch, title, {
261
+ description: description,
262
+ milestoneId: milestone.id
263
+ })];
264
+ case 1:
265
+ mergeRequest = _a.sent();
266
+ return [2 /*return*/, GitLabMapper_1.GitLabMapper.mergeRequest(mergeRequest)];
267
+ }
268
+ });
269
+ });
270
+ };
271
+ GitLabApiClient.prototype.getFile = function (projectId, filePath, branchName) {
272
+ return __awaiter(this, void 0, void 0, function () {
273
+ var file, _a;
274
+ return __generator(this, function (_b) {
275
+ switch (_b.label) {
276
+ case 0:
277
+ _b.trys.push([0, 2, , 3]);
278
+ return [4 /*yield*/, this.client.RepositoryFiles.show(projectId, filePath, branchName)];
279
+ case 1:
280
+ file = _b.sent();
281
+ return [2 /*return*/, GitLabMapper_1.GitLabMapper.file(file)];
282
+ case 2:
283
+ _a = _b.sent();
284
+ return [2 /*return*/, null];
285
+ case 3: return [2 /*return*/];
286
+ }
287
+ });
288
+ });
289
+ };
290
+ GitLabApiClient.prototype.updateFile = function (projectId, filePath, branchName, content, commitMessage) {
291
+ return __awaiter(this, void 0, void 0, function () {
292
+ return __generator(this, function (_a) {
293
+ switch (_a.label) {
294
+ case 0: return [4 /*yield*/, this.client.RepositoryFiles.edit(projectId, filePath, branchName, content, commitMessage)];
295
+ case 1:
296
+ _a.sent();
297
+ return [2 /*return*/];
298
+ }
299
+ });
300
+ });
301
+ };
302
+ GitLabApiClient.prototype.commit = function (projectId, branchName, files, commitMessage) {
303
+ return __awaiter(this, void 0, void 0, function () {
304
+ return __generator(this, function (_a) {
305
+ switch (_a.label) {
306
+ case 0: return [4 /*yield*/, this.client.Commits.create(projectId, branchName, commitMessage, files.map(function (f) { return ({
307
+ action: 'update',
308
+ filePath: f.filePath,
309
+ content: f.content
310
+ }); }))];
311
+ case 1:
312
+ _a.sent();
313
+ return [2 /*return*/];
314
+ }
315
+ });
316
+ });
317
+ };
318
+ GitLabApiClient.prototype.getMilestone = function (projectId, milestoneName) {
319
+ return __awaiter(this, void 0, void 0, function () {
320
+ var milestones, milestone;
321
+ return __generator(this, function (_a) {
322
+ switch (_a.label) {
323
+ case 0: return [4 /*yield*/, this.client.ProjectMilestones.all(projectId)];
324
+ case 1:
325
+ milestones = _a.sent();
326
+ milestone = milestones.find(function (milestone) { return milestone.title === milestoneName; });
327
+ if (!milestone)
328
+ return [2 /*return*/, null];
329
+ return [2 /*return*/, GitLabMapper_1.GitLabMapper.milestone(milestone)];
330
+ }
331
+ });
332
+ });
333
+ };
334
+ GitLabApiClient = __decorate([
335
+ (0, inversify_1.injectable)(),
336
+ __param(0, (0, inversify_1.inject)(types_1.MISC.GitLabConfig)),
337
+ __metadata("design:paramtypes", [Object])
338
+ ], GitLabApiClient);
339
+ return GitLabApiClient;
340
+ }());
341
+ exports.GitLabApiClient = GitLabApiClient;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GitLabMapper = void 0;
4
+ exports.GitLabMapper = {
5
+ mergeRequest: function (m) {
6
+ var _a;
7
+ return {
8
+ title: m.title,
9
+ description: m.description,
10
+ status: m.state,
11
+ projectId: m.project_id,
12
+ mergeCommit: m.merge_commit_sha,
13
+ author: m.author.name,
14
+ assignee: (_a = m.assignee) === null || _a === void 0 ? void 0 : _a.name,
15
+ url: m.web_url,
16
+ hasConflicts: m.has_conflicts,
17
+ targetBranch: m.target_branch,
18
+ sourceBranch: m.source_branch,
19
+ milestone: exports.GitLabMapper.milestone(m.milestone)
20
+ };
21
+ },
22
+ project: function (p) {
23
+ return {
24
+ id: p.id,
25
+ title: p.name
26
+ };
27
+ },
28
+ tag: function (t) {
29
+ return {
30
+ name: t.name,
31
+ target: t.commit.id
32
+ };
33
+ },
34
+ commit: function (c) {
35
+ return {
36
+ id: c.id,
37
+ title: c.title,
38
+ message: c.message
39
+ };
40
+ },
41
+ branch: function (b) {
42
+ return {
43
+ name: b.name
44
+ };
45
+ },
46
+ file: function (f) {
47
+ return {
48
+ name: f.file_name,
49
+ path: f.file_path,
50
+ content: f.content
51
+ };
52
+ },
53
+ milestone: function (m) {
54
+ if (!m)
55
+ return null;
56
+ return {
57
+ id: m.id,
58
+ name: m.title
59
+ };
60
+ }
61
+ };
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./GitLabApiClient"), exports);
17
+ __exportStar(require("./git-lab/GitLabApiClient"), exports);
18
+ __exportStar(require("./team-city/TeamCityApiClient"), exports);
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ var __generator = (this && this.__generator) || function (thisArg, body) {
24
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
+ function verb(n) { return function (v) { return step([n, v]); }; }
27
+ function step(op) {
28
+ if (f) throw new TypeError("Generator is already executing.");
29
+ while (_) try {
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
+ if (y = 0, t) op = [op[0] & 2, t.value];
32
+ switch (op[0]) {
33
+ case 0: case 1: t = op; break;
34
+ case 4: _.label++; return { value: op[1], done: false };
35
+ case 5: _.label++; y = op[1]; op = [0]; continue;
36
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
+ default:
38
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
+ if (t[2]) _.ops.pop();
43
+ _.trys.pop(); continue;
44
+ }
45
+ op = body.call(thisArg, _);
46
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
+ }
49
+ };
50
+ var __importDefault = (this && this.__importDefault) || function (mod) {
51
+ return (mod && mod.__esModule) ? mod : { "default": mod };
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.TeamCityApiClient = void 0;
55
+ require("reflect-metadata");
56
+ var teamcity_rest_api_1 = __importDefault(require("teamcity-rest-api"));
57
+ var inversify_1 = require("inversify");
58
+ var types_1 = require("../../types");
59
+ var TeamCityApiClient = /** @class */ (function () {
60
+ function TeamCityApiClient(config) {
61
+ this.client = teamcity_rest_api_1.default.create(config);
62
+ }
63
+ TeamCityApiClient.prototype.startBuild = function (buildId, branchName) {
64
+ return __awaiter(this, void 0, void 0, function () {
65
+ var buildXml, build;
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0:
69
+ buildXml = "\n <build branchName=\"".concat(branchName, "\">\n <buildType id=\"").concat(buildId, "\" />\n </build>\n ");
70
+ return [4 /*yield*/, this.client.builds.startBuild(buildXml)];
71
+ case 1:
72
+ build = _a.sent();
73
+ return [2 /*return*/, build];
74
+ }
75
+ });
76
+ });
77
+ };
78
+ TeamCityApiClient = __decorate([
79
+ (0, inversify_1.injectable)(),
80
+ __param(0, (0, inversify_1.inject)(types_1.MISC.TeamCityConfig)),
81
+ __metadata("design:paramtypes", [Object])
82
+ ], TeamCityApiClient);
83
+ return TeamCityApiClient;
84
+ }());
85
+ exports.TeamCityApiClient = TeamCityApiClient;
@@ -53,17 +53,22 @@ require("reflect-metadata");
53
53
  var inversify_1 = require("inversify");
54
54
  var types_1 = require("../types");
55
55
  var BumpPackagesCommand = /** @class */ (function () {
56
- function BumpPackagesCommand(bumpPackagesTask) {
57
- this._bumpPackagesTask = bumpPackagesTask;
56
+ function BumpPackagesCommand(bumpPackagesTask, commitPackageVersionsTask) {
57
+ this.bumpPackagesTask = bumpPackagesTask;
58
+ this.commitPackageVersionsTask = commitPackageVersionsTask;
58
59
  }
59
60
  BumpPackagesCommand.prototype.run = function (options) {
60
61
  return __awaiter(this, void 0, void 0, function () {
62
+ var cont;
61
63
  return __generator(this, function (_a) {
62
64
  switch (_a.label) {
63
- case 0: return [4 /*yield*/, this._bumpPackagesTask.run(options)];
65
+ case 0: return [4 /*yield*/, this.bumpPackagesTask.run(options)];
64
66
  case 1:
65
- _a.sent();
66
- return [2 /*return*/];
67
+ cont = _a.sent();
68
+ if (!cont)
69
+ return [2 /*return*/, false];
70
+ return [4 /*yield*/, this.commitPackageVersionsTask.run(options)];
71
+ case 2: return [2 /*return*/, _a.sent()];
67
72
  }
68
73
  });
69
74
  });
@@ -71,7 +76,8 @@ var BumpPackagesCommand = /** @class */ (function () {
71
76
  BumpPackagesCommand = __decorate([
72
77
  (0, inversify_1.injectable)(),
73
78
  __param(0, (0, inversify_1.inject)(types_1.TASKS.BumpPackagesTask)),
74
- __metadata("design:paramtypes", [Object])
79
+ __param(1, (0, inversify_1.inject)(types_1.TASKS.CommitPackageVersionsTask)),
80
+ __metadata("design:paramtypes", [Object, Object])
75
81
  ], BumpPackagesCommand);
76
82
  return BumpPackagesCommand;
77
83
  }());
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ var __generator = (this && this.__generator) || function (thisArg, body) {
24
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
+ function verb(n) { return function (v) { return step([n, v]); }; }
27
+ function step(op) {
28
+ if (f) throw new TypeError("Generator is already executing.");
29
+ while (_) try {
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
+ if (y = 0, t) op = [op[0] & 2, t.value];
32
+ switch (op[0]) {
33
+ case 0: case 1: t = op; break;
34
+ case 4: _.label++; return { value: op[1], done: false };
35
+ case 5: _.label++; y = op[1]; op = [0]; continue;
36
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
+ default:
38
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
+ if (t[2]) _.ops.pop();
43
+ _.trys.pop(); continue;
44
+ }
45
+ op = body.call(thisArg, _);
46
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
+ }
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.CommitPackageVersionsCommand = void 0;
52
+ require("reflect-metadata");
53
+ var inversify_1 = require("inversify");
54
+ var types_1 = require("types");
55
+ var CommitPackageVersionsCommand = /** @class */ (function () {
56
+ function CommitPackageVersionsCommand(commitPackageVersionsTask) {
57
+ this.commitPackageVersionsTask = commitPackageVersionsTask;
58
+ }
59
+ CommitPackageVersionsCommand.prototype.run = function (options) {
60
+ return __awaiter(this, void 0, void 0, function () {
61
+ return __generator(this, function (_a) {
62
+ switch (_a.label) {
63
+ case 0: return [4 /*yield*/, this.commitPackageVersionsTask.run(options)];
64
+ case 1:
65
+ _a.sent();
66
+ return [2 /*return*/];
67
+ }
68
+ });
69
+ });
70
+ };
71
+ CommitPackageVersionsCommand = __decorate([
72
+ (0, inversify_1.injectable)(),
73
+ __param(0, (0, inversify_1.inject)(types_1.TASKS.CommitPackageVersionsTask)),
74
+ __metadata("design:paramtypes", [Object])
75
+ ], CommitPackageVersionsCommand);
76
+ return CommitPackageVersionsCommand;
77
+ }());
78
+ exports.CommitPackageVersionsCommand = CommitPackageVersionsCommand;