@clickview/ship-it 0.0.35-dev.18 → 0.0.35-dev.2
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.
- package/lib/src/commands/BumpPackagesCommand.js +11 -3
- package/lib/src/constants/MonorepoPackageJsonFiles.js +1 -14
- package/lib/src/index.js +0 -0
- package/lib/src/inversify.config.js +1 -0
- package/lib/src/startup/SetupCommands.js +0 -1
- package/lib/src/tasks/BumpPackagesTask.js +69 -72
- package/lib/src/tasks/CommitPackageVersionsTask.js +116 -0
- package/lib/src/tasks/InstallPackagesTask.js +3 -3
- package/lib/src/tasks/index.js +1 -0
- package/lib/src/types.js +1 -0
- package/package.json +1 -1
|
@@ -53,15 +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) {
|
|
56
|
+
function BumpPackagesCommand(bumpPackagesTask, commitPackageVersionsTask) {
|
|
57
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
65
|
case 0: return [4 /*yield*/, this.bumpPackagesTask.run(options)];
|
|
64
|
-
case 1:
|
|
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()];
|
|
65
72
|
}
|
|
66
73
|
});
|
|
67
74
|
});
|
|
@@ -69,7 +76,8 @@ var BumpPackagesCommand = /** @class */ (function () {
|
|
|
69
76
|
BumpPackagesCommand = __decorate([
|
|
70
77
|
(0, inversify_1.injectable)(),
|
|
71
78
|
__param(0, (0, inversify_1.inject)(types_1.TASKS.BumpPackagesTask)),
|
|
72
|
-
|
|
79
|
+
__param(1, (0, inversify_1.inject)(types_1.TASKS.CommitPackageVersionsTask)),
|
|
80
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
73
81
|
], BumpPackagesCommand);
|
|
74
82
|
return BumpPackagesCommand;
|
|
75
83
|
}());
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
var ProjectNames_1 = require("./ProjectNames");
|
|
3
|
+
exports.MONOREPO_PACKAGE_JSON_FILES = void 0;
|
|
6
4
|
exports.MONOREPO_PACKAGE_JSON_FILES = [
|
|
7
5
|
'packages/libs/analytics/package.json',
|
|
8
6
|
'packages/libs/styles/package.json',
|
|
@@ -17,14 +15,3 @@ exports.MONOREPO_PACKAGE_JSON_FILES = [
|
|
|
17
15
|
'packages/projects/player/package.json',
|
|
18
16
|
'packages/projects/streamable-learning/package.json'
|
|
19
17
|
];
|
|
20
|
-
exports.MONOREPO_PACKAGE_JSON_FILES_MAP = (_a = {},
|
|
21
|
-
_a[ProjectNames_1.PROJECT_NAMES.backend.auth] = 'packages/projects/auth/package.json',
|
|
22
|
-
_a[ProjectNames_1.PROJECT_NAMES.frontend.curator] = 'packages/projects/curator/package.json',
|
|
23
|
-
_a[ProjectNames_1.PROJECT_NAMES.frontend.cloud] = 'packages/projects/library-editor/package.json',
|
|
24
|
-
_a[ProjectNames_1.PROJECT_NAMES.frontend.lite] = 'packages/projects/lite/package.json',
|
|
25
|
-
_a[ProjectNames_1.PROJECT_NAMES.frontend.online] = 'packages/projects/online/package.json',
|
|
26
|
-
_a[ProjectNames_1.PROJECT_NAMES.frontend.reports] = 'packages/projects/reports/package.json',
|
|
27
|
-
_a[ProjectNames_1.PROJECT_NAMES.frontend.exchange] = 'packages/projects/exchange/package.json',
|
|
28
|
-
_a[ProjectNames_1.PROJECT_NAMES.frontend.player] = 'packages/projects/player/package.json',
|
|
29
|
-
_a[ProjectNames_1.PROJECT_NAMES.frontend.streamable] = 'packages/projects/streamable-learning/package.json',
|
|
30
|
-
_a);
|
package/lib/src/index.js
CHANGED
|
File without changes
|
|
@@ -44,6 +44,7 @@ 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);
|
|
47
48
|
container.bind(types_1.TASKS.ValidateMergeRequestTask).to(tasks_1.ValidateMergeRequestTask);
|
|
48
49
|
container.bind(types_1.TASKS.StartMonorepoBuildTask).to(tasks_1.StartMonorepoBuildTask);
|
|
49
50
|
container.bind(types_1.TASKS.TagMasterTask).to(tasks_1.TagMasterTask);
|
|
@@ -115,7 +115,6 @@ function setupCommands(program, container) {
|
|
|
115
115
|
.description('Bump clickview npm package versions in monorepo to their next version')
|
|
116
116
|
.requiredOption('-b, --branchName <branchName>')
|
|
117
117
|
.option('-p, --preId <preId>')
|
|
118
|
-
.option('--projectIds <projectIds...>')
|
|
119
118
|
.action(getAction('bump-packages'));
|
|
120
119
|
program.command('install-packages')
|
|
121
120
|
.description('Install the latest clickview npm packages in all consuming projects that are part of a milestone')
|
|
@@ -50,8 +50,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
51
|
exports.BumpPackagesTask = void 0;
|
|
52
52
|
require("reflect-metadata");
|
|
53
|
-
var fs_1 = require("fs");
|
|
54
53
|
var inversify_1 = require("inversify");
|
|
54
|
+
var child_process_1 = require("child_process");
|
|
55
55
|
var types_1 = require("../types");
|
|
56
56
|
var services_1 = require("../services");
|
|
57
57
|
var MonorepoPackageJsonFiles_1 = require("../constants/MonorepoPackageJsonFiles");
|
|
@@ -60,31 +60,25 @@ var RELEASE_BRANCH_REGEX = /^release\/(\d|\.)+$/;
|
|
|
60
60
|
var HOTFIX_BRANCH_REGEX = /^hotfix\/(\d|\.)+$/;
|
|
61
61
|
var DEV_VERSION_REGEX = /-dev\.\d+$/;
|
|
62
62
|
var RC_VERSION_REGEX = /-rc\.\d+$/;
|
|
63
|
+
var SHARED_LERNA_OPTIONS = '--exact --no-git-tag-version --no-push --yes';
|
|
63
64
|
var BumpPackagesTask = /** @class */ (function () {
|
|
64
65
|
function BumpPackagesTask(service) {
|
|
65
66
|
this.isReleaseBranch = false;
|
|
66
67
|
this.isHotfixBranch = false;
|
|
67
|
-
this.isInPreRelease = false;
|
|
68
68
|
this.service = service;
|
|
69
69
|
}
|
|
70
70
|
BumpPackagesTask.prototype.run = function (options) {
|
|
71
|
-
var _a;
|
|
72
71
|
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
-
var
|
|
74
|
-
return __generator(this, function (
|
|
75
|
-
switch (
|
|
72
|
+
var branch, isValid, lernaVersionCmd;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
76
75
|
case 0:
|
|
77
76
|
utils_1.Logger.logTask('Bumping clickview npm package versions');
|
|
78
77
|
this.isReleaseBranch = RELEASE_BRANCH_REGEX.test(options.branchName);
|
|
79
78
|
this.isHotfixBranch = HOTFIX_BRANCH_REGEX.test(options.branchName);
|
|
80
|
-
utils_1.Logger.logTask('Detected that monorepo is currently in a pre-release state');
|
|
81
|
-
_b = this;
|
|
82
|
-
return [4 /*yield*/, this.getIsInPrerelease(options.branchName)];
|
|
83
|
-
case 1:
|
|
84
|
-
_b.isInPreRelease = _c.sent();
|
|
85
79
|
return [4 /*yield*/, this.service.getBranch(utils_1.ProjectIds.MONOREPO_PROJECT_ID, options.branchName)];
|
|
86
|
-
case
|
|
87
|
-
branch =
|
|
80
|
+
case 1:
|
|
81
|
+
branch = _a.sent();
|
|
88
82
|
if (!branch) {
|
|
89
83
|
utils_1.Logger.logError("Branch with name ".concat(options.branchName, " was not be found."));
|
|
90
84
|
return [2 /*return*/, false];
|
|
@@ -92,23 +86,15 @@ var BumpPackagesTask = /** @class */ (function () {
|
|
|
92
86
|
isValid = this.validateOptions(options);
|
|
93
87
|
if (!isValid)
|
|
94
88
|
return [2 /*return*/, false];
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
commitFiles = this.getCommitFiles(options, packageJsonFiles);
|
|
102
|
-
utils_1.Logger.logInfo('Writing new versions to package.json files...');
|
|
103
|
-
for (_i = 0, commitFiles_1 = commitFiles; _i < commitFiles_1.length; _i++) {
|
|
104
|
-
file = commitFiles_1[_i];
|
|
105
|
-
(0, fs_1.writeFileSync)(file.filePath, file.content);
|
|
89
|
+
return [4 /*yield*/, this.getLernaCommand(options)];
|
|
90
|
+
case 2:
|
|
91
|
+
lernaVersionCmd = _a.sent();
|
|
92
|
+
if (!lernaVersionCmd) {
|
|
93
|
+
utils_1.Logger.logError('Something went wrong while trying to detect which versioning script to run with Lerna.');
|
|
94
|
+
return [2 /*return*/, false];
|
|
106
95
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
case 3:
|
|
110
|
-
_c.sent();
|
|
111
|
-
utils_1.Logger.logSuccess('Successfully committed updated version numbers.');
|
|
96
|
+
(0, child_process_1.execSync)(lernaVersionCmd, { stdio: 'inherit' });
|
|
97
|
+
utils_1.Logger.logSuccess('Successfully executed Lerna versioning command.');
|
|
112
98
|
return [2 /*return*/, true];
|
|
113
99
|
}
|
|
114
100
|
});
|
|
@@ -150,51 +136,62 @@ var BumpPackagesTask = /** @class */ (function () {
|
|
|
150
136
|
});
|
|
151
137
|
});
|
|
152
138
|
};
|
|
153
|
-
BumpPackagesTask.prototype.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
139
|
+
BumpPackagesTask.prototype.getLernaCommand = function (options) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
+
var isInPrerelease;
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
switch (_a.label) {
|
|
144
|
+
case 0: return [4 /*yield*/, this.isInPrerelease(options.branchName)];
|
|
145
|
+
case 1:
|
|
146
|
+
isInPrerelease = _a.sent();
|
|
147
|
+
/**
|
|
148
|
+
* The `lerna version prerelease` script only cares about incrementing the preId part
|
|
149
|
+
* of the version number. That's why we run this if `isInPrerelease` is true.
|
|
150
|
+
*
|
|
151
|
+
* E.g. this would change 0.0.1-dev.0 to 0.0.0-dev.1
|
|
152
|
+
*/
|
|
153
|
+
if (isInPrerelease && options.preId) {
|
|
154
|
+
utils_1.Logger.logMessage("Incrementing \"".concat(options.preId, "\" preId for each package."));
|
|
155
|
+
return [2 /*return*/, "lerna version prerelease --preid ".concat(options.preId, " ").concat(SHARED_LERNA_OPTIONS)];
|
|
156
|
+
}
|
|
157
|
+
// Bump the patch with the preId "dev". We currently only support dev prereleases on patch versions
|
|
158
|
+
if (options.preId === 'dev') {
|
|
159
|
+
utils_1.Logger.logMessage("Incrementing the patch version for each package and appending preId: \"dev\".");
|
|
160
|
+
return [2 /*return*/, "lerna version prepatch --preid dev ".concat(SHARED_LERNA_OPTIONS)];
|
|
161
|
+
}
|
|
162
|
+
if (options.preId === 'rc') {
|
|
163
|
+
// Bump the minor number with the preId "rc". Release branches always bump the minor number.
|
|
164
|
+
if (this.isReleaseBranch) {
|
|
165
|
+
utils_1.Logger.logMessage("Incrementing the minor version for each package and appending preId: \"rc\".");
|
|
166
|
+
return [2 /*return*/, "lerna version preminor --preid rc ".concat(SHARED_LERNA_OPTIONS)];
|
|
167
|
+
}
|
|
168
|
+
// Bump the patch with the preId "rc". Hotfix branches always bump the patch number.
|
|
169
|
+
if (this.isHotfixBranch) {
|
|
170
|
+
utils_1.Logger.logMessage("Incrementing the patch version for each package and appending preId: \"rc\".");
|
|
171
|
+
return [2 /*return*/, "lerna version prepatch --preid rc ".concat(SHARED_LERNA_OPTIONS)];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* If no preId is provided, we bump the version number to a production version.
|
|
176
|
+
*
|
|
177
|
+
* Release branch = minor bump
|
|
178
|
+
* Hotfix branch = patch bump
|
|
179
|
+
*/
|
|
180
|
+
if (this.isReleaseBranch) {
|
|
181
|
+
utils_1.Logger.logMessage('Updating each package to production release version.');
|
|
182
|
+
return [2 /*return*/, "lerna version minor ".concat(SHARED_LERNA_OPTIONS)];
|
|
183
|
+
}
|
|
184
|
+
if (this.isHotfixBranch) {
|
|
185
|
+
utils_1.Logger.logMessage('Updating each package to production hotfix version.');
|
|
186
|
+
return [2 /*return*/, "lerna version patch ".concat(SHARED_LERNA_OPTIONS)];
|
|
187
|
+
}
|
|
188
|
+
// Should never be reached
|
|
189
|
+
return [2 /*return*/, ''];
|
|
190
|
+
}
|
|
173
191
|
});
|
|
174
|
-
}
|
|
175
|
-
return commitFiles;
|
|
176
|
-
};
|
|
177
|
-
BumpPackagesTask.prototype.getNextVersion = function (version, options) {
|
|
178
|
-
// If we're in a prerelease, we only want to increment the preId part of the version number
|
|
179
|
-
if (this.isInPreRelease && options.preId) {
|
|
180
|
-
var currentPreId = Number(version[version.length - 1]);
|
|
181
|
-
return "".concat(version.substring(0, version.length - 1)).concat(currentPreId + 1);
|
|
182
|
-
}
|
|
183
|
-
if (options.preId === 'dev')
|
|
184
|
-
return "".concat(utils_1.Versions.getNextVersion(version, 'patch'), "-dev.0");
|
|
185
|
-
if (options.preId === 'rc') {
|
|
186
|
-
if (this.isReleaseBranch)
|
|
187
|
-
return "".concat(utils_1.Versions.getNextVersion(version, 'minor'), "-rc.0");
|
|
188
|
-
if (this.isHotfixBranch)
|
|
189
|
-
return "".concat(utils_1.Versions.getNextVersion(version, 'patch'), "-rc.0");
|
|
190
|
-
}
|
|
191
|
-
if (this.isReleaseBranch)
|
|
192
|
-
utils_1.Versions.getNextVersion(version, 'minor');
|
|
193
|
-
if (this.isHotfixBranch)
|
|
194
|
-
utils_1.Versions.getNextVersion(version, 'patch');
|
|
195
|
-
return version;
|
|
192
|
+
});
|
|
196
193
|
};
|
|
197
|
-
BumpPackagesTask.prototype.
|
|
194
|
+
BumpPackagesTask.prototype.isInPrerelease = function (branchName) {
|
|
198
195
|
return __awaiter(this, void 0, void 0, function () {
|
|
199
196
|
var _i, MONOREPO_PACKAGE_JSON_FILES_1, file, text, json;
|
|
200
197
|
return __generator(this, function (_a) {
|
|
@@ -0,0 +1,116 @@
|
|
|
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;
|
|
@@ -128,7 +128,7 @@ var InstallPackagesTask = /** @class */ (function () {
|
|
|
128
128
|
/**
|
|
129
129
|
* Run npm i to update our package log file
|
|
130
130
|
*/
|
|
131
|
-
utils_1.Logger.logInfo("[".concat(project.title, "]: Running npm i"));
|
|
131
|
+
utils_1.Logger.logInfo("[".concat(project.title, "]: Running npm i --package-lock-only"));
|
|
132
132
|
this.npmInstall(project, folderName);
|
|
133
133
|
utils_1.Logger.logInfo('\n');
|
|
134
134
|
/**
|
|
@@ -221,7 +221,7 @@ var InstallPackagesTask = /** @class */ (function () {
|
|
|
221
221
|
/**
|
|
222
222
|
* Run npm i to update our package log file
|
|
223
223
|
*/
|
|
224
|
-
utils_1.Logger.logInfo("[".concat(project.title, "]: Running npm i"));
|
|
224
|
+
utils_1.Logger.logInfo("[".concat(project.title, "]: Running npm i --package-lock-only"));
|
|
225
225
|
this.npmInstall(project, options.milestone);
|
|
226
226
|
utils_1.Logger.logInfo('\n');
|
|
227
227
|
/**
|
|
@@ -280,7 +280,7 @@ var InstallPackagesTask = /** @class */ (function () {
|
|
|
280
280
|
};
|
|
281
281
|
InstallPackagesTask.prototype.npmInstall = function (project, folderName) {
|
|
282
282
|
var outputPath = this.getOutputPath(project, folderName);
|
|
283
|
-
child_process_1.default.execSync('npm i', {
|
|
283
|
+
child_process_1.default.execSync('npm i --package-lock-only', {
|
|
284
284
|
cwd: outputPath,
|
|
285
285
|
// Uncomment if we want to silence
|
|
286
286
|
// stdio: 'pipe'
|
package/lib/src/tasks/index.js
CHANGED
|
@@ -16,6 +16,7 @@ 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);
|
|
19
20
|
__exportStar(require("./CreateBranchTask"), exports);
|
|
20
21
|
__exportStar(require("./CreateMergeRequestTask"), exports);
|
|
21
22
|
__exportStar(require("./CreateReleaseNotesTask"), exports);
|
package/lib/src/types.js
CHANGED
|
@@ -31,6 +31,7 @@ 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'),
|
|
34
35
|
ValidateMergeRequestTask: Symbol.for('ValidateMergeRequestTask'),
|
|
35
36
|
StartMonorepoBuildTask: Symbol.for('StartMonorepoBuildTask'),
|
|
36
37
|
StartProjectBuildsTask: Symbol.for('StartProjectBuildsTask'),
|