@clickview/ship-it 0.0.35-dev.16 → 0.0.35-dev.17
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.
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MONOREPO_PACKAGE_JSON_FILES = void 0;
|
|
4
|
+
exports.MONOREPO_PACKAGE_JSON_FILES_MAP = exports.MONOREPO_PACKAGE_JSON_FILES = void 0;
|
|
5
|
+
var ProjectNames_1 = require("./ProjectNames");
|
|
4
6
|
exports.MONOREPO_PACKAGE_JSON_FILES = [
|
|
5
7
|
'packages/libs/analytics/package.json',
|
|
6
8
|
'packages/libs/styles/package.json',
|
|
@@ -15,3 +17,14 @@ exports.MONOREPO_PACKAGE_JSON_FILES = [
|
|
|
15
17
|
'packages/projects/player/package.json',
|
|
16
18
|
'packages/projects/streamable-learning/package.json'
|
|
17
19
|
];
|
|
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);
|
|
@@ -68,22 +68,23 @@ var BumpPackagesTask = /** @class */ (function () {
|
|
|
68
68
|
this.service = service;
|
|
69
69
|
}
|
|
70
70
|
BumpPackagesTask.prototype.run = function (options) {
|
|
71
|
+
var _a;
|
|
71
72
|
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
-
var
|
|
73
|
-
return __generator(this, function (
|
|
74
|
-
switch (
|
|
73
|
+
var _b, branch, isValid, packageJsonFiles, commitFiles, _i, commitFiles_1, file;
|
|
74
|
+
return __generator(this, function (_c) {
|
|
75
|
+
switch (_c.label) {
|
|
75
76
|
case 0:
|
|
76
77
|
utils_1.Logger.logTask('Bumping clickview npm package versions');
|
|
77
78
|
this.isReleaseBranch = RELEASE_BRANCH_REGEX.test(options.branchName);
|
|
78
79
|
this.isHotfixBranch = HOTFIX_BRANCH_REGEX.test(options.branchName);
|
|
79
80
|
utils_1.Logger.logTask('Detected that monorepo is currently in a pre-release state');
|
|
80
|
-
|
|
81
|
+
_b = this;
|
|
81
82
|
return [4 /*yield*/, this.getIsInPrerelease(options.branchName)];
|
|
82
83
|
case 1:
|
|
83
|
-
|
|
84
|
+
_b.isInPreRelease = _c.sent();
|
|
84
85
|
return [4 /*yield*/, this.service.getBranch(utils_1.ProjectIds.MONOREPO_PROJECT_ID, options.branchName)];
|
|
85
86
|
case 2:
|
|
86
|
-
branch =
|
|
87
|
+
branch = _c.sent();
|
|
87
88
|
if (!branch) {
|
|
88
89
|
utils_1.Logger.logError("Branch with name ".concat(options.branchName, " was not be found."));
|
|
89
90
|
return [2 /*return*/, false];
|
|
@@ -91,21 +92,23 @@ var BumpPackagesTask = /** @class */ (function () {
|
|
|
91
92
|
isValid = this.validateOptions(options);
|
|
92
93
|
if (!isValid)
|
|
93
94
|
return [2 /*return*/, false];
|
|
94
|
-
utils_1.Logger.logInfo('Options are valid!
|
|
95
|
-
|
|
95
|
+
utils_1.Logger.logInfo('Options are valid!');
|
|
96
|
+
packageJsonFiles = MonorepoPackageJsonFiles_1.MONOREPO_PACKAGE_JSON_FILES;
|
|
97
|
+
if ((_a = options.projectIds) === null || _a === void 0 ? void 0 : _a.length) {
|
|
98
|
+
utils_1.Logger.logInfo('Project IDs list detected. Filtering out unspecified package.json files...');
|
|
99
|
+
packageJsonFiles = options.projectIds.map(function (projectId) { return MonorepoPackageJsonFiles_1.MONOREPO_PACKAGE_JSON_FILES_MAP[projectId]; });
|
|
100
|
+
}
|
|
101
|
+
commitFiles = this.getCommitFiles(options, packageJsonFiles);
|
|
96
102
|
utils_1.Logger.logInfo('Writing new versions to package.json files...');
|
|
97
103
|
for (_i = 0, commitFiles_1 = commitFiles; _i < commitFiles_1.length; _i++) {
|
|
98
104
|
file = commitFiles_1[_i];
|
|
99
105
|
(0, fs_1.writeFileSync)(file.filePath, file.content);
|
|
100
106
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
// commitFiles
|
|
107
|
-
// );
|
|
108
|
-
utils_1.Logger.logSuccess('Successfully updated version numbers.');
|
|
107
|
+
utils_1.Logger.logInfo('Committing new versions...');
|
|
108
|
+
return [4 /*yield*/, this.service.commit(utils_1.ProjectIds.MONOREPO_PROJECT_ID, options.branchName, 'Bump package versions', commitFiles)];
|
|
109
|
+
case 3:
|
|
110
|
+
_c.sent();
|
|
111
|
+
utils_1.Logger.logSuccess('Successfully committed updated version numbers.');
|
|
109
112
|
return [2 /*return*/, true];
|
|
110
113
|
}
|
|
111
114
|
});
|
|
@@ -147,10 +150,10 @@ var BumpPackagesTask = /** @class */ (function () {
|
|
|
147
150
|
});
|
|
148
151
|
});
|
|
149
152
|
};
|
|
150
|
-
BumpPackagesTask.prototype.getCommitFiles = function (options) {
|
|
153
|
+
BumpPackagesTask.prototype.getCommitFiles = function (options, packageJsonFiles) {
|
|
151
154
|
var commitFiles = [];
|
|
152
|
-
for (var _i = 0,
|
|
153
|
-
var filePath =
|
|
155
|
+
for (var _i = 0, packageJsonFiles_1 = packageJsonFiles; _i < packageJsonFiles_1.length; _i++) {
|
|
156
|
+
var filePath = packageJsonFiles_1[_i];
|
|
154
157
|
var content = '';
|
|
155
158
|
try {
|
|
156
159
|
content = (0, fs_1.readFileSync)(filePath, { encoding: 'utf8' });
|
|
@@ -193,15 +196,15 @@ var BumpPackagesTask = /** @class */ (function () {
|
|
|
193
196
|
};
|
|
194
197
|
BumpPackagesTask.prototype.getIsInPrerelease = function (branchName) {
|
|
195
198
|
return __awaiter(this, void 0, void 0, function () {
|
|
196
|
-
var _i,
|
|
199
|
+
var _i, MONOREPO_PACKAGE_JSON_FILES_1, file, text, json;
|
|
197
200
|
return __generator(this, function (_a) {
|
|
198
201
|
switch (_a.label) {
|
|
199
202
|
case 0:
|
|
200
|
-
_i = 0,
|
|
203
|
+
_i = 0, MONOREPO_PACKAGE_JSON_FILES_1 = MonorepoPackageJsonFiles_1.MONOREPO_PACKAGE_JSON_FILES;
|
|
201
204
|
_a.label = 1;
|
|
202
205
|
case 1:
|
|
203
|
-
if (!(_i <
|
|
204
|
-
file =
|
|
206
|
+
if (!(_i < MONOREPO_PACKAGE_JSON_FILES_1.length)) return [3 /*break*/, 4];
|
|
207
|
+
file = MONOREPO_PACKAGE_JSON_FILES_1[_i];
|
|
205
208
|
return [4 /*yield*/, this.getFileText(utils_1.ProjectIds.MONOREPO_PROJECT_ID, branchName, file)];
|
|
206
209
|
case 2:
|
|
207
210
|
text = _a.sent();
|
|
@@ -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"));
|
|
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"));
|
|
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', {
|
|
284
284
|
cwd: outputPath,
|
|
285
285
|
// Uncomment if we want to silence
|
|
286
286
|
// stdio: 'pipe'
|