@clickview/ship-it 0.0.35-dev.12 → 0.0.35-dev.13

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.
@@ -359,6 +359,22 @@ var GitLabApiClient = /** @class */ (function () {
359
359
  });
360
360
  });
361
361
  };
362
+ GitLabApiClient.prototype.updateFiles = function (projectId, branchName, commitMessage, files) {
363
+ return __awaiter(this, void 0, void 0, function () {
364
+ return __generator(this, function (_a) {
365
+ switch (_a.label) {
366
+ case 0: return [4 /*yield*/, this.client.Commits.create(projectId, branchName, commitMessage, files.map(function (f) { return ({
367
+ action: 'update',
368
+ filePath: f.filePath,
369
+ content: f.content
370
+ }); }))];
371
+ case 1:
372
+ _a.sent();
373
+ return [2 /*return*/];
374
+ }
375
+ });
376
+ });
377
+ };
362
378
  GitLabApiClient.prototype.commit = function (projectId, branchName, files, commitMessage) {
363
379
  return __awaiter(this, void 0, void 0, function () {
364
380
  return __generator(this, function (_a) {
@@ -53,22 +53,15 @@ 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, commitPackageVersionsTask) {
56
+ function BumpPackagesCommand(bumpPackagesTask) {
57
57
  this.bumpPackagesTask = bumpPackagesTask;
58
- this.commitPackageVersionsTask = commitPackageVersionsTask;
59
58
  }
60
59
  BumpPackagesCommand.prototype.run = function (options) {
61
60
  return __awaiter(this, void 0, void 0, function () {
62
- var cont;
63
61
  return __generator(this, function (_a) {
64
62
  switch (_a.label) {
65
63
  case 0: return [4 /*yield*/, this.bumpPackagesTask.run(options)];
66
- case 1:
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()];
64
+ case 1: return [2 /*return*/, _a.sent()];
72
65
  }
73
66
  });
74
67
  });
@@ -76,8 +69,7 @@ var BumpPackagesCommand = /** @class */ (function () {
76
69
  BumpPackagesCommand = __decorate([
77
70
  (0, inversify_1.injectable)(),
78
71
  __param(0, (0, inversify_1.inject)(types_1.TASKS.BumpPackagesTask)),
79
- __param(1, (0, inversify_1.inject)(types_1.TASKS.CommitPackageVersionsTask)),
80
- __metadata("design:paramtypes", [Object, Object])
72
+ __metadata("design:paramtypes", [Object])
81
73
  ], BumpPackagesCommand);
82
74
  return BumpPackagesCommand;
83
75
  }());
@@ -44,7 +44,6 @@ function createContainer(config) {
44
44
  container.bind(types_1.TASKS.CreateNotesAuditTask).to(tasks_1.CreateNotesAuditTask);
45
45
  container.bind(types_1.TASKS.InstallPackagesTask).to(tasks_1.InstallPackagesTask);
46
46
  container.bind(types_1.TASKS.BumpPackagesTask).to(tasks_1.BumpPackagesTask);
47
- container.bind(types_1.TASKS.CommitPackageVersionsTask).to(tasks_1.CommitPackageVersionsTask);
48
47
  container.bind(types_1.TASKS.ValidateMergeRequestTask).to(tasks_1.ValidateMergeRequestTask);
49
48
  container.bind(types_1.TASKS.StartMonorepoBuildTask).to(tasks_1.StartMonorepoBuildTask);
50
49
  container.bind(types_1.TASKS.TagMasterTask).to(tasks_1.TagMasterTask);
@@ -353,6 +353,9 @@ var GitLabService = /** @class */ (function () {
353
353
  GitLabService.prototype.updateFile = function (projectId, filePath, branchName, content, commit) {
354
354
  return this.apiClient.updateFile(projectId, filePath, branchName, content, commit);
355
355
  };
356
+ GitLabService.prototype.updateFiles = function (projectId, branchName, commitMessage, files) {
357
+ return this.apiClient.updateFiles(projectId, branchName, commitMessage, files);
358
+ };
356
359
  GitLabService.prototype.commit = function (projectId, branchName, commitMessage, files) {
357
360
  return __awaiter(this, void 0, void 0, function () {
358
361
  return __generator(this, function (_a) {
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
14
3
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
4
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -61,8 +50,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
61
50
  Object.defineProperty(exports, "__esModule", { value: true });
62
51
  exports.BumpPackagesTask = void 0;
63
52
  require("reflect-metadata");
53
+ var fs_1 = require("fs");
64
54
  var inversify_1 = require("inversify");
65
- var child_process_1 = require("child_process");
66
55
  var types_1 = require("../types");
67
56
  var services_1 = require("../services");
68
57
  var MonorepoPackageJsonFiles_1 = require("../constants/MonorepoPackageJsonFiles");
@@ -71,55 +60,29 @@ var RELEASE_BRANCH_REGEX = /^release\/(\d|\.)+$/;
71
60
  var HOTFIX_BRANCH_REGEX = /^hotfix\/(\d|\.)+$/;
72
61
  var DEV_VERSION_REGEX = /-dev\.\d+$/;
73
62
  var RC_VERSION_REGEX = /-rc\.\d+$/;
74
- var SHARED_LERNA_OPTIONS = '--exact --no-git-tag-version --no-push --yes';
75
- // ChatGPT bs to kill `execSync` after a timeout
76
- // TODO: Replace `lerna version` with a better lib or our own implementation
77
- // so we can delete this crap
78
- function execSyncWithTimeout(command, timeout, options) {
79
- if (options === void 0) { options = {}; }
80
- return new Promise(function (resolve, reject) {
81
- var child = (0, child_process_1.spawn)(command, [], __assign({ shell: true, stdio: 'inherit' }, options));
82
- var timer = setTimeout(function () {
83
- child.kill('SIGTERM');
84
- reject(new Error("ExecSync timeout"));
85
- }, timeout);
86
- child.on('exit', function (code, signal) {
87
- clearTimeout(timer);
88
- if (signal === 'SIGTERM') {
89
- // If the process was terminated by our timer
90
- return;
91
- }
92
- if (code === 0) {
93
- resolve();
94
- }
95
- else {
96
- reject(new Error("Command failed with exit code ".concat(code)));
97
- }
98
- });
99
- child.on('error', function (error) {
100
- clearTimeout(timer);
101
- reject(error);
102
- });
103
- });
104
- }
105
63
  var BumpPackagesTask = /** @class */ (function () {
106
64
  function BumpPackagesTask(service) {
107
- this.isReleaseBranch = false;
65
+ this.isReleaseBranch = true;
108
66
  this.isHotfixBranch = false;
67
+ this.isInPreRelease = false;
109
68
  this.service = service;
110
69
  }
111
70
  BumpPackagesTask.prototype.run = function (options) {
112
71
  return __awaiter(this, void 0, void 0, function () {
113
- var branch, isValid, lernaVersionCmd;
114
- return __generator(this, function (_a) {
115
- switch (_a.label) {
72
+ var _a, branch, isValid, commitFiles;
73
+ return __generator(this, function (_b) {
74
+ switch (_b.label) {
116
75
  case 0:
117
76
  utils_1.Logger.logTask('Bumping clickview npm package versions');
118
- this.isReleaseBranch = RELEASE_BRANCH_REGEX.test(options.branchName);
77
+ this.isReleaseBranch = RELEASE_BRANCH_REGEX.test(options.branchName) || true;
119
78
  this.isHotfixBranch = HOTFIX_BRANCH_REGEX.test(options.branchName);
120
- return [4 /*yield*/, this.service.getBranch(utils_1.ProjectIds.MONOREPO_PROJECT_ID, options.branchName)];
79
+ _a = this;
80
+ return [4 /*yield*/, this.getIsInPrerelease(options.branchName)];
121
81
  case 1:
122
- branch = _a.sent();
82
+ _a.isInPreRelease = _b.sent();
83
+ return [4 /*yield*/, this.service.getBranch(utils_1.ProjectIds.MONOREPO_PROJECT_ID, options.branchName)];
84
+ case 2:
85
+ branch = _b.sent();
123
86
  if (!branch) {
124
87
  utils_1.Logger.logError("Branch with name ".concat(options.branchName, " was not be found."));
125
88
  return [2 /*return*/, false];
@@ -127,24 +90,10 @@ var BumpPackagesTask = /** @class */ (function () {
127
90
  isValid = this.validateOptions(options);
128
91
  if (!isValid)
129
92
  return [2 /*return*/, false];
130
- return [4 /*yield*/, this.getLernaCommand(options)];
131
- case 2:
132
- lernaVersionCmd = _a.sent();
133
- if (!lernaVersionCmd) {
134
- utils_1.Logger.logError('Something went wrong while trying to detect which versioning script to run with Lerna.');
135
- return [2 /*return*/, false];
136
- }
137
- // Lerna version command hangs in NPM 10 for some reason.
138
- // We need to replace it with another lib or our own implementation.
139
- // For now, we use this util to run the command with `execSync` then time it out
140
- // to "force quit" it after 5s, because the command is hanging after successful execution.
141
- return [4 /*yield*/, execSyncWithTimeout(lernaVersionCmd, 5000)];
93
+ commitFiles = this.getCommitFiles(options);
94
+ return [4 /*yield*/, this.service.commit(utils_1.ProjectIds.MONOREPO_PROJECT_ID, options.branchName, 'Bump package versions', commitFiles)];
142
95
  case 3:
143
- // Lerna version command hangs in NPM 10 for some reason.
144
- // We need to replace it with another lib or our own implementation.
145
- // For now, we use this util to run the command with `execSync` then time it out
146
- // to "force quit" it after 5s, because the command is hanging after successful execution.
147
- _a.sent();
96
+ _b.sent();
148
97
  utils_1.Logger.logSuccess('Successfully executed Lerna versioning command.');
149
98
  return [2 /*return*/, true];
150
99
  }
@@ -187,72 +136,61 @@ var BumpPackagesTask = /** @class */ (function () {
187
136
  });
188
137
  });
189
138
  };
190
- BumpPackagesTask.prototype.getLernaCommand = function (options) {
191
- return __awaiter(this, void 0, void 0, function () {
192
- var isInPrerelease;
193
- return __generator(this, function (_a) {
194
- switch (_a.label) {
195
- case 0: return [4 /*yield*/, this.isInPrerelease(options.branchName)];
196
- case 1:
197
- isInPrerelease = _a.sent();
198
- /**
199
- * The `lerna version prerelease` script only cares about incrementing the preId part
200
- * of the version number. That's why we run this if `isInPrerelease` is true.
201
- *
202
- * E.g. this would change 0.0.1-dev.0 to 0.0.0-dev.1
203
- */
204
- if (isInPrerelease && options.preId) {
205
- utils_1.Logger.logMessage("Incrementing \"".concat(options.preId, "\" preId for each package."));
206
- return [2 /*return*/, "lerna version prerelease --preid ".concat(options.preId, " ").concat(SHARED_LERNA_OPTIONS)];
207
- }
208
- // Bump the patch with the preId "dev". We currently only support dev prereleases on patch versions
209
- if (options.preId === 'dev') {
210
- utils_1.Logger.logMessage("Incrementing the patch version for each package and appending preId: \"dev\".");
211
- return [2 /*return*/, "lerna version prepatch --preid dev ".concat(SHARED_LERNA_OPTIONS)];
212
- }
213
- if (options.preId === 'rc') {
214
- // Bump the minor number with the preId "rc". Release branches always bump the minor number.
215
- if (this.isReleaseBranch) {
216
- utils_1.Logger.logMessage("Incrementing the minor version for each package and appending preId: \"rc\".");
217
- return [2 /*return*/, "lerna version preminor --preid rc ".concat(SHARED_LERNA_OPTIONS)];
218
- }
219
- // Bump the patch with the preId "rc". Hotfix branches always bump the patch number.
220
- if (this.isHotfixBranch) {
221
- utils_1.Logger.logMessage("Incrementing the patch version for each package and appending preId: \"rc\".");
222
- return [2 /*return*/, "lerna version prepatch --preid rc ".concat(SHARED_LERNA_OPTIONS)];
223
- }
224
- }
225
- /**
226
- * If no preId is provided, we bump the version number to a production version.
227
- *
228
- * Release branch = minor bump
229
- * Hotfix branch = patch bump
230
- */
231
- if (this.isReleaseBranch) {
232
- utils_1.Logger.logMessage('Updating each package to production release version.');
233
- return [2 /*return*/, "lerna version minor ".concat(SHARED_LERNA_OPTIONS)];
234
- }
235
- if (this.isHotfixBranch) {
236
- utils_1.Logger.logMessage('Updating each package to production hotfix version.');
237
- return [2 /*return*/, "lerna version patch ".concat(SHARED_LERNA_OPTIONS)];
238
- }
239
- // Should never be reached
240
- return [2 /*return*/, ''];
241
- }
139
+ BumpPackagesTask.prototype.getCommitFiles = function (options) {
140
+ var commitFiles = [];
141
+ for (var _i = 0, MONOREPO_PACKAGE_JSON_FILES_1 = MonorepoPackageJsonFiles_1.MONOREPO_PACKAGE_JSON_FILES; _i < MONOREPO_PACKAGE_JSON_FILES_1.length; _i++) {
142
+ var filePath = MONOREPO_PACKAGE_JSON_FILES_1[_i];
143
+ var content = '';
144
+ try {
145
+ content = (0, fs_1.readFileSync)(filePath, { encoding: 'utf8' });
146
+ }
147
+ catch (_a) {
148
+ /**
149
+ * If the file doesn't exist, ignore the error.
150
+ * This will occur when TC Docker runs this script as it doesn't copy over @clickview/tooling
151
+ */
152
+ continue;
153
+ }
154
+ var json = JSON.parse(content);
155
+ json.version = this.getNextVersion(json.version, options);
156
+ commitFiles.push({
157
+ filePath: filePath,
158
+ content: JSON.stringify(json, null, 2)
242
159
  });
243
- });
160
+ }
161
+ return commitFiles;
162
+ };
163
+ BumpPackagesTask.prototype.getNextVersion = function (version, options) {
164
+ // If we're in a prerelease, we only want to increment the preId part of the version number
165
+ if (this.isInPreRelease && options.preId) {
166
+ var currentPreId = Number(version[version.length - 1]);
167
+ return "".concat(version.substring(0, version.length - 1)).concat(currentPreId + 1);
168
+ }
169
+ if (options.preId === 'dev')
170
+ return "".concat(utils_1.Versions.getNextVersion(version, 'patch'), "-dev.0");
171
+ if (options.preId === 'rc') {
172
+ if (this.isReleaseBranch)
173
+ return "".concat(utils_1.Versions.getNextVersion(version, 'minor'), "-rc.0");
174
+ if (this.isHotfixBranch)
175
+ return "".concat(utils_1.Versions.getNextVersion(version, 'patch'), "-rc.0");
176
+ }
177
+ if (this.isReleaseBranch)
178
+ utils_1.Versions.getNextVersion(version, 'minor');
179
+ if (this.isHotfixBranch)
180
+ utils_1.Versions.getNextVersion(version, 'patch');
181
+ return version;
244
182
  };
245
- BumpPackagesTask.prototype.isInPrerelease = function (branchName) {
183
+ BumpPackagesTask.prototype.getIsInPrerelease = function (branchName) {
246
184
  return __awaiter(this, void 0, void 0, function () {
247
- var _i, MONOREPO_PACKAGE_JSON_FILES_1, file, text, json;
185
+ var _i, MONOREPO_PACKAGE_JSON_FILES_2, file, text, json;
248
186
  return __generator(this, function (_a) {
249
187
  switch (_a.label) {
250
188
  case 0:
251
- _i = 0, MONOREPO_PACKAGE_JSON_FILES_1 = MonorepoPackageJsonFiles_1.MONOREPO_PACKAGE_JSON_FILES;
189
+ _i = 0, MONOREPO_PACKAGE_JSON_FILES_2 = MonorepoPackageJsonFiles_1.MONOREPO_PACKAGE_JSON_FILES;
252
190
  _a.label = 1;
253
191
  case 1:
254
- if (!(_i < MONOREPO_PACKAGE_JSON_FILES_1.length)) return [3 /*break*/, 4];
255
- file = MONOREPO_PACKAGE_JSON_FILES_1[_i];
192
+ if (!(_i < MONOREPO_PACKAGE_JSON_FILES_2.length)) return [3 /*break*/, 4];
193
+ file = MONOREPO_PACKAGE_JSON_FILES_2[_i];
256
194
  return [4 /*yield*/, this.getFileText(utils_1.ProjectIds.MONOREPO_PROJECT_ID, branchName, file)];
257
195
  case 2:
258
196
  text = _a.sent();
@@ -16,7 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./BumpPackagesTask"), exports);
18
18
  __exportStar(require("./BumpVersionTxtTask"), exports);
19
- __exportStar(require("./CommitPackageVersionsTask"), exports);
20
19
  __exportStar(require("./CreateBranchTask"), exports);
21
20
  __exportStar(require("./CreateMergeRequestTask"), exports);
22
21
  __exportStar(require("./CreateReleaseNotesTask"), exports);
package/lib/src/types.js CHANGED
@@ -31,7 +31,6 @@ exports.TASKS = {
31
31
  CreateNotesAuditTask: Symbol.for('CreateNotesAuditTask'),
32
32
  InstallPackagesTask: Symbol.for('InstallPackagesTask'),
33
33
  BumpPackagesTask: Symbol.for('BumpPackagesTask'),
34
- CommitPackageVersionsTask: Symbol.for('CommitPackageVersionsTask'),
35
34
  ValidateMergeRequestTask: Symbol.for('ValidateMergeRequestTask'),
36
35
  StartMonorepoBuildTask: Symbol.for('StartMonorepoBuildTask'),
37
36
  StartProjectBuildsTask: Symbol.for('StartProjectBuildsTask'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickview/ship-it",
3
- "version": "0.0.35-dev.12",
3
+ "version": "0.0.35-dev.13",
4
4
  "description": "Release Manager",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -1,116 +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.CommitPackageVersionsTask = void 0;
52
- require("reflect-metadata");
53
- var fs_1 = require("fs");
54
- var inversify_1 = require("inversify");
55
- var types_1 = require("../types");
56
- var services_1 = require("../services");
57
- var MonorepoPackageJsonFiles_1 = require("../constants/MonorepoPackageJsonFiles");
58
- var utils_1 = require("../utils");
59
- var CommitPackageVersionsTask = /** @class */ (function () {
60
- function CommitPackageVersionsTask(service) {
61
- this.service = service;
62
- }
63
- CommitPackageVersionsTask.prototype.run = function (options) {
64
- return __awaiter(this, void 0, void 0, function () {
65
- var branch, commitFiles;
66
- return __generator(this, function (_a) {
67
- switch (_a.label) {
68
- case 0:
69
- utils_1.Logger.logTask('Committing clickview npm package versions');
70
- return [4 /*yield*/, this.service.getBranch(utils_1.ProjectIds.MONOREPO_PROJECT_ID, options.branchName)];
71
- case 1:
72
- branch = _a.sent();
73
- if (!branch) {
74
- utils_1.Logger.logError("Branch with name ".concat(options.branchName, " was not be found."));
75
- return [2 /*return*/, false];
76
- }
77
- commitFiles = this.getCommitFiles();
78
- return [4 /*yield*/, this.service.commit(utils_1.ProjectIds.MONOREPO_PROJECT_ID, options.branchName, 'Bump package versions', commitFiles)];
79
- case 2:
80
- _a.sent();
81
- utils_1.Logger.logSuccess('Successfully committed package versions.');
82
- return [2 /*return*/, true];
83
- }
84
- });
85
- });
86
- };
87
- CommitPackageVersionsTask.prototype.getCommitFiles = function () {
88
- var commitFiles = [];
89
- for (var _i = 0, MONOREPO_PACKAGE_JSON_FILES_1 = MonorepoPackageJsonFiles_1.MONOREPO_PACKAGE_JSON_FILES; _i < MONOREPO_PACKAGE_JSON_FILES_1.length; _i++) {
90
- var filePath = MONOREPO_PACKAGE_JSON_FILES_1[_i];
91
- var content = '';
92
- try {
93
- content = (0, fs_1.readFileSync)(filePath, { encoding: 'utf8' });
94
- }
95
- catch (_a) {
96
- /**
97
- * If the file doesn't exist, ignore the error.
98
- * This will occur when TC Docker runs this script as it doesn't copy over @clickview/tooling
99
- */
100
- continue;
101
- }
102
- commitFiles.push({
103
- filePath: filePath,
104
- content: content
105
- });
106
- }
107
- return commitFiles;
108
- };
109
- CommitPackageVersionsTask = __decorate([
110
- (0, inversify_1.injectable)(),
111
- __param(0, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
112
- __metadata("design:paramtypes", [services_1.GitLabService])
113
- ], CommitPackageVersionsTask);
114
- return CommitPackageVersionsTask;
115
- }());
116
- exports.CommitPackageVersionsTask = CommitPackageVersionsTask;