@clickview/ship-it 0.0.4-dev.5 → 0.0.4-rc.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 (42) hide show
  1. package/config.json +0 -5
  2. package/lib/config.json +0 -5
  3. package/lib/src/api-clients/git-lab/GitLabApiClient.js +0 -24
  4. package/lib/src/api-clients/git-lab/GitLabMapper.js +0 -1
  5. package/lib/src/api-clients/index.js +0 -1
  6. package/lib/src/commands/ReleaseCommand.js +11 -16
  7. package/lib/src/commands/index.js +0 -1
  8. package/lib/src/constants/CommandTypeMapping.js +0 -1
  9. package/lib/src/interfaces/command-options/index.js +1 -2
  10. package/lib/src/interfaces/index.js +0 -1
  11. package/lib/src/inversify.config.js +0 -8
  12. package/lib/src/services/GitLabService.js +0 -33
  13. package/lib/src/services/index.js +0 -1
  14. package/lib/src/startup/AddMilestoneCommand.js +1 -2
  15. package/lib/src/startup/SetupCommands.js +2 -74
  16. package/lib/src/tasks/BumpPackagesTask.js +1 -2
  17. package/lib/src/tasks/CommitPackageVersionsTask.js +1 -8
  18. package/lib/src/tasks/CreateBranchTask.js +19 -37
  19. package/lib/src/tasks/InstallPackagesTask.js +47 -26
  20. package/lib/src/tasks/ValidateTask.js +2 -2
  21. package/lib/src/tasks/index.js +0 -2
  22. package/lib/src/types.js +0 -6
  23. package/lib/src/utils/BranchNames.js +0 -2
  24. package/lib/src/utils/ProjectIds.js +3 -3
  25. package/lib/src/utils/Versions.js +0 -1
  26. package/package.json +3 -4
  27. package/lib/src/api-clients/GitLabApiClient.js +0 -342
  28. package/lib/src/api-clients/team-city/TeamCityApiClient.js +0 -85
  29. package/lib/src/commands/CommitPackageVersionsCommand.js +0 -78
  30. package/lib/src/commands/StartConsumingProjectBuildsCommand.js +0 -76
  31. package/lib/src/constants/TeamCityBuildIDs.js +0 -13
  32. package/lib/src/interfaces/ShipItOptions.js +0 -2
  33. package/lib/src/interfaces/command-cli-options/MilestoneCommandCliOptions.js +0 -2
  34. package/lib/src/interfaces/command-cli-options/ReleaseCommandCliOptions.js +0 -2
  35. package/lib/src/interfaces/command-cli-options/index.js +0 -18
  36. package/lib/src/interfaces/command-options/CommitPackageVersionsCommandOptions.js +0 -2
  37. package/lib/src/interfaces/command-options/DockerMilestoneCommandOptions.js +0 -2
  38. package/lib/src/interfaces/command-options/ReleaseCommandOptions.js +0 -2
  39. package/lib/src/services/TeamCityService.js +0 -34
  40. package/lib/src/tasks/CommitLocalPackagesTask.js +0 -137
  41. package/lib/src/tasks/StartConsumingProjectBuildsTask.js +0 -143
  42. package/lib/src/tasks/StartMonorepoBuildTask.js +0 -95
@@ -86,7 +86,7 @@ var ValidateTask = /** @class */ (function () {
86
86
  utils_1.Logger.logMessage("Found ".concat(projects.length, " projects that need to be released"));
87
87
  cont = true;
88
88
  _loop_1 = function (project) {
89
- var groupedMRs = lodash_1.default.groupBy(project.mergeRequests.filter(function (mr) { return mr.targetBranch !== 'master'; }), function (mr) { return mr.status; });
89
+ var groupedMRs = lodash_1.default.groupBy(project.mergeRequests, function (mr) { return mr.status; });
90
90
  var count = Object.keys(groupedMRs).reduce(function (prev, current) {
91
91
  var _a;
92
92
  return __assign(__assign({}, prev), (_a = {}, _a[current] = groupedMRs[current].length, _a));
@@ -132,7 +132,7 @@ var ValidateTask = /** @class */ (function () {
132
132
  var allNonDevMrs = [];
133
133
  for (var _i = 0, projects_2 = projects; _i < projects_2.length; _i++) {
134
134
  var project = projects_2[_i];
135
- var notReadyMrs = project.mergeRequests.filter(function (mr) { return mr.status === 'opened' && mr.targetBranch !== 'master'; });
135
+ var notReadyMrs = project.mergeRequests.filter(function (mr) { return mr.status === 'opened'; });
136
136
  var nonDevMrs = project.mergeRequests.filter(function (mr) { return mr.targetBranch !== 'dev' && mr.targetBranch !== 'master'; });
137
137
  if (notReadyMrs.length)
138
138
  allNotReadyMrs.push.apply(allNotReadyMrs, notReadyMrs);
@@ -21,8 +21,6 @@ __exportStar(require("./CreateBranchTask"), exports);
21
21
  __exportStar(require("./CreateMergeRequestTask"), exports);
22
22
  __exportStar(require("./CreateReleaseNotesTask"), exports);
23
23
  __exportStar(require("./InstallPackagesTask"), exports);
24
- __exportStar(require("./StartConsumingProjectBuildsTask"), exports);
25
- __exportStar(require("./StartMonorepoBuildTask"), exports);
26
24
  __exportStar(require("./ValidateCommitsTask"), exports);
27
25
  __exportStar(require("./ValidateDescriptionsTask"), exports);
28
26
  __exportStar(require("./ValidateMergeRequestTask"), exports);
package/lib/src/types.js CHANGED
@@ -3,15 +3,12 @@ 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
- TeamCityConfig: Symbol.for('TeamCityConfig')
7
6
  };
8
7
  exports.API_CLIENTS = {
9
8
  GitLabApiClient: Symbol.for('GitLabApiClient'),
10
- TeamCityApiClient: Symbol.for('TeamCityApiClient')
11
9
  };
12
10
  exports.SERVICES = {
13
11
  GitLabService: Symbol.for('GitLabService'),
14
- TeamCityService: Symbol.for('TeamCityService')
15
12
  };
16
13
  exports.TASKS = {
17
14
  ValidateTask: Symbol.for('ValidateTask'),
@@ -25,8 +22,6 @@ exports.TASKS = {
25
22
  InstallPackagesTask: Symbol.for('InstallPackagesTask'),
26
23
  BumpPackagesTask: Symbol.for('BumpPackagesTask'),
27
24
  CommitPackageVersionsTask: Symbol.for('CommitPackageVersionsTask'),
28
- StartMonorepoBuildTask: Symbol.for('StartMonorepoBuildTask'),
29
- StartConsumingProjectBuildsTask: Symbol.for('StartConsumingProjectBuildsTask'),
30
25
  ValidateMergeRequestTask: Symbol.for('ValidateMergeRequestTask')
31
26
  };
32
27
  exports.COMMANDS = {
@@ -38,6 +33,5 @@ exports.COMMANDS = {
38
33
  CreateReleaseNotesCommand: Symbol.for('CreateReleaseNotesCommand'),
39
34
  InstallPackagesCommand: Symbol.for('InstallPackagesCommand'),
40
35
  BumpPackagesCommand: Symbol.for('BumpPackagesCommand'),
41
- StartConsumingProjectBuildsCommand: Symbol.for('StartConsumingProjectBuildsCommand'),
42
36
  ValidateMergeRequestCommand: Symbol.for('ValidateMergeRequestCommand')
43
37
  };
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BranchNames = void 0;
4
4
  exports.BranchNames = {
5
5
  getRelease: function (version) {
6
- return 'release/9.9.9';
7
6
  return "release/".concat(version);
8
7
  },
9
8
  getHotfix: function (version) {
10
- return 'hotfix/9.9.9';
11
9
  return "hotfix/".concat(version);
12
10
  }
13
11
  };
@@ -3,10 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ProjectIds = exports.PROJECT_NAMES = void 0;
6
+ exports.ProjectIds = void 0;
7
7
  var lodash_1 = __importDefault(require("lodash"));
8
8
  var errors_1 = require("../errors");
9
- exports.PROJECT_NAMES = {
9
+ var PROJECT_NAMES = {
10
10
  monorepo: '798',
11
11
  online: '109',
12
12
  curator: '62',
@@ -28,7 +28,7 @@ exports.ProjectIds = {
28
28
  projectIds.push(project);
29
29
  continue;
30
30
  }
31
- var mappedId = exports.PROJECT_NAMES[project.toLowerCase()];
31
+ var mappedId = PROJECT_NAMES[project.toLowerCase()];
32
32
  if (!mappedId)
33
33
  throw new errors_1.ShipItError("Could not find project id mapping for ".concat(project));
34
34
  projectIds.push(mappedId);
@@ -7,7 +7,6 @@ exports.Versions = void 0;
7
7
  var semver_1 = __importDefault(require("semver"));
8
8
  exports.Versions = {
9
9
  getNextVersion: function (currentVersion, type) {
10
- return '9.9.9';
11
10
  var curr = new semver_1.default.SemVer(currentVersion);
12
11
  switch (type) {
13
12
  case 'major':
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@clickview/ship-it",
3
- "version": "0.0.4-dev.5",
3
+ "version": "0.0.4-rc.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 --files src/index.ts",
10
+ "start": "npm run lint && ts-node src/index.ts",
11
11
  "build": "npm run lint && tsc -p . && tsc-alias -p tsconfig.json",
12
12
  "lint": "eslint . --ext .ts"
13
13
  },
@@ -25,8 +25,7 @@
25
25
  "inversify": "6.0.1",
26
26
  "lodash": "4.17.21",
27
27
  "reflect-metadata": "0.1.13",
28
- "semver": "7.3.5",
29
- "teamcity-rest-api": "0.0.8"
28
+ "semver": "7.3.5"
30
29
  },
31
30
  "devDependencies": {
32
31
  "@clickview/eslint-config": "1.0.3",
@@ -1,342 +0,0 @@
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 GitLabApiClient = /** @class */ (function () {
57
- function GitLabApiClient(config) {
58
- this._config = config;
59
- this._client = new node_1.Gitlab({
60
- token: this._config.accessToken,
61
- host: this._config.url
62
- });
63
- }
64
- GitLabApiClient.prototype.getMergeRequests = function (options) {
65
- return __awaiter(this, void 0, void 0, function () {
66
- var milestone, projectIds, mergeRequests;
67
- return __generator(this, function (_a) {
68
- switch (_a.label) {
69
- case 0:
70
- milestone = options.milestone, projectIds = options.projectIds;
71
- if (!milestone && !(projectIds === null || projectIds === void 0 ? void 0 : projectIds.length))
72
- throw new Error('Must specifiy one of the following: Milestone or ProjectIds');
73
- return [4 /*yield*/, this._client.MergeRequests.all({
74
- milestone: milestone,
75
- scope: 'all'
76
- })];
77
- case 1:
78
- mergeRequests = _a.sent();
79
- /**
80
- * Filter out only projectIds we care aboutr
81
- */
82
- if (projectIds === null || projectIds === void 0 ? void 0 : projectIds.length) {
83
- mergeRequests = mergeRequests.filter(function (mr) {
84
- return projectIds.some(function (p) { return mr.project_id.toString() === p.toString(); });
85
- });
86
- }
87
- return [2 /*return*/, mergeRequests.map(function (m) {
88
- var _a;
89
- return ({
90
- title: m.title,
91
- description: m.description,
92
- status: m.state,
93
- projectId: m.project_id,
94
- mergeCommit: m.merge_commit_sha,
95
- author: m.author.name,
96
- assignee: (_a = m.assignee) === null || _a === void 0 ? void 0 : _a.name,
97
- url: m.web_url,
98
- hasConflicts: m.has_conflicts,
99
- targetBranch: m.target_branch
100
- });
101
- })];
102
- }
103
- });
104
- });
105
- };
106
- GitLabApiClient.prototype.getProjectsByIds = function (projectIds) {
107
- return __awaiter(this, void 0, void 0, function () {
108
- var projects, i, projectId, p;
109
- return __generator(this, function (_a) {
110
- switch (_a.label) {
111
- case 0:
112
- projects = [];
113
- i = 0;
114
- _a.label = 1;
115
- case 1:
116
- if (!(i < projectIds.length)) return [3 /*break*/, 4];
117
- projectId = projectIds[i];
118
- return [4 /*yield*/, this._client.Projects.show(projectId)];
119
- case 2:
120
- p = _a.sent();
121
- projects.push(p);
122
- _a.label = 3;
123
- case 3:
124
- i++;
125
- return [3 /*break*/, 1];
126
- case 4: return [2 /*return*/, projects.map(function (p) { return ({
127
- id: p.id,
128
- title: p.name
129
- }); })];
130
- }
131
- });
132
- });
133
- };
134
- GitLabApiClient.prototype.getLatestTags = function (projectId) {
135
- return __awaiter(this, void 0, void 0, function () {
136
- var tags;
137
- return __generator(this, function (_a) {
138
- switch (_a.label) {
139
- case 0: return [4 /*yield*/, this._client.Tags.all(projectId, { maxPages: 1, perPage: 20 })];
140
- case 1:
141
- tags = _a.sent();
142
- if (!tags.length)
143
- throw new Error("Project ".concat(projectId, " does not have any tags"));
144
- return [2 /*return*/, tags.map(function (t) { return ({
145
- name: t.name,
146
- target: t.commit.id
147
- }); })];
148
- }
149
- });
150
- });
151
- };
152
- GitLabApiClient.prototype.getCommitsSince = function (projectId, branchName, sinceSha) {
153
- return __awaiter(this, void 0, void 0, function () {
154
- var commit, commits;
155
- return __generator(this, function (_a) {
156
- switch (_a.label) {
157
- case 0: return [4 /*yield*/, this._client.Commits.show(projectId, sinceSha)];
158
- case 1:
159
- commit = _a.sent();
160
- return [4 /*yield*/, this._client.Commits.all(projectId, {
161
- ref_name: branchName,
162
- since: commit.committed_date,
163
- first_parent: true
164
- })];
165
- case 2:
166
- commits = _a.sent();
167
- return [2 /*return*/, commits.map(function (c) { return ({
168
- id: c.id,
169
- title: c.title,
170
- message: c.message
171
- }); })];
172
- }
173
- });
174
- });
175
- };
176
- GitLabApiClient.prototype.getBranch = function (projectId, branchName) {
177
- return __awaiter(this, void 0, void 0, function () {
178
- var branch, _a;
179
- return __generator(this, function (_b) {
180
- switch (_b.label) {
181
- case 0:
182
- _b.trys.push([0, 2, , 3]);
183
- return [4 /*yield*/, this._client.Branches.show(projectId, branchName)];
184
- case 1:
185
- branch = _b.sent();
186
- return [2 /*return*/, {
187
- name: branch.name
188
- }];
189
- case 2:
190
- _a = _b.sent();
191
- return [2 /*return*/, null];
192
- case 3: return [2 /*return*/];
193
- }
194
- });
195
- });
196
- };
197
- GitLabApiClient.prototype.createBranch = function (projectId, branchName, branchFrom) {
198
- return __awaiter(this, void 0, void 0, function () {
199
- var newBranch;
200
- return __generator(this, function (_a) {
201
- switch (_a.label) {
202
- case 0: return [4 /*yield*/, this._client.Branches.create(projectId, branchName, branchFrom)];
203
- case 1:
204
- newBranch = _a.sent();
205
- return [2 /*return*/, {
206
- name: newBranch.name
207
- }];
208
- }
209
- });
210
- });
211
- };
212
- GitLabApiClient.prototype.cherryPick = function (projectId, sha, branchName) {
213
- return __awaiter(this, void 0, void 0, function () {
214
- return __generator(this, function (_a) {
215
- switch (_a.label) {
216
- case 0: return [4 /*yield*/, this._client.Commits.cherryPick(projectId, sha, branchName)];
217
- case 1:
218
- _a.sent();
219
- return [2 /*return*/];
220
- }
221
- });
222
- });
223
- };
224
- GitLabApiClient.prototype.getMergeRequest = function (projectId, sourceBranch, targetBranch) {
225
- var _a;
226
- return __awaiter(this, void 0, void 0, function () {
227
- var mergeRequests, mergeRequest;
228
- return __generator(this, function (_b) {
229
- switch (_b.label) {
230
- case 0: return [4 /*yield*/, this._client.MergeRequests.all({
231
- projectId: projectId,
232
- sourceBranch: sourceBranch,
233
- targetBranch: targetBranch,
234
- state: 'opened'
235
- })];
236
- case 1:
237
- mergeRequests = _b.sent();
238
- mergeRequest = mergeRequests[0];
239
- if (!mergeRequest)
240
- return [2 /*return*/, null];
241
- return [2 /*return*/, {
242
- title: mergeRequest.title,
243
- description: mergeRequest.description,
244
- status: mergeRequest.state,
245
- projectId: mergeRequest.project_id,
246
- mergeCommit: mergeRequest.merge_commit_sha,
247
- author: mergeRequest.author.name,
248
- assignee: (_a = mergeRequest.assignee) === null || _a === void 0 ? void 0 : _a.name,
249
- url: mergeRequest.web_url,
250
- hasConflicts: mergeRequest.has_conflicts,
251
- targetBranch: mergeRequest.target_branch
252
- }];
253
- }
254
- });
255
- });
256
- };
257
- GitLabApiClient.prototype.createMergeRequest = function (projectId, sourceBranch, targetBranch, title, description) {
258
- var _a;
259
- return __awaiter(this, void 0, void 0, function () {
260
- var mergeRequest;
261
- return __generator(this, function (_b) {
262
- switch (_b.label) {
263
- case 0: return [4 /*yield*/, this._client.MergeRequests.create(projectId, sourceBranch, targetBranch, title, {
264
- description: description
265
- })];
266
- case 1:
267
- mergeRequest = _b.sent();
268
- return [2 /*return*/, {
269
- title: mergeRequest.title,
270
- description: mergeRequest.description,
271
- status: mergeRequest.state,
272
- projectId: mergeRequest.project_id,
273
- mergeCommit: mergeRequest.merge_commit_sha,
274
- author: mergeRequest.author.name,
275
- assignee: (_a = mergeRequest.assignee) === null || _a === void 0 ? void 0 : _a.name,
276
- url: mergeRequest.web_url,
277
- hasConflicts: mergeRequest.has_conflicts,
278
- targetBranch: mergeRequest.target_branch
279
- }];
280
- }
281
- });
282
- });
283
- };
284
- GitLabApiClient.prototype.getFile = function (projectId, filePath, branchName) {
285
- return __awaiter(this, void 0, void 0, function () {
286
- var file, _a;
287
- return __generator(this, function (_b) {
288
- switch (_b.label) {
289
- case 0:
290
- _b.trys.push([0, 2, , 3]);
291
- return [4 /*yield*/, this._client.RepositoryFiles.show(projectId, filePath, branchName)];
292
- case 1:
293
- file = _b.sent();
294
- return [2 /*return*/, {
295
- name: file.file_name,
296
- path: file.file_path,
297
- content: file.content
298
- }];
299
- case 2:
300
- _a = _b.sent();
301
- return [2 /*return*/, null];
302
- case 3: return [2 /*return*/];
303
- }
304
- });
305
- });
306
- };
307
- GitLabApiClient.prototype.updateFile = function (projectId, filePath, branchName, content, commitMessage) {
308
- return __awaiter(this, void 0, void 0, function () {
309
- return __generator(this, function (_a) {
310
- switch (_a.label) {
311
- case 0: return [4 /*yield*/, this._client.RepositoryFiles.edit(projectId, filePath, branchName, content, commitMessage)];
312
- case 1:
313
- _a.sent();
314
- return [2 /*return*/];
315
- }
316
- });
317
- });
318
- };
319
- GitLabApiClient.prototype.commit = function (projectId, branchName, files, commitMessage) {
320
- return __awaiter(this, void 0, void 0, function () {
321
- return __generator(this, function (_a) {
322
- switch (_a.label) {
323
- case 0: return [4 /*yield*/, this._client.Commits.create(projectId, branchName, commitMessage, files.map(function (f) { return ({
324
- action: 'update',
325
- filePath: f.filePath,
326
- content: f.content
327
- }); }))];
328
- case 1:
329
- _a.sent();
330
- return [2 /*return*/];
331
- }
332
- });
333
- });
334
- };
335
- GitLabApiClient = __decorate([
336
- (0, inversify_1.injectable)(),
337
- __param(0, (0, inversify_1.inject)(types_1.MISC.GitLabConfig)),
338
- __metadata("design:paramtypes", [Object])
339
- ], GitLabApiClient);
340
- return GitLabApiClient;
341
- }());
342
- exports.GitLabApiClient = GitLabApiClient;
@@ -1,85 +0,0 @@
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;
@@ -1,78 +0,0 @@
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;