@clickview/ship-it 0.0.35-dev.10 → 0.0.35-dev.12
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.
|
@@ -72,13 +72,16 @@ var HOTFIX_BRANCH_REGEX = /^hotfix\/(\d|\.)+$/;
|
|
|
72
72
|
var DEV_VERSION_REGEX = /-dev\.\d+$/;
|
|
73
73
|
var RC_VERSION_REGEX = /-rc\.\d+$/;
|
|
74
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
|
|
75
78
|
function execSyncWithTimeout(command, timeout, options) {
|
|
76
79
|
if (options === void 0) { options = {}; }
|
|
77
80
|
return new Promise(function (resolve, reject) {
|
|
78
81
|
var child = (0, child_process_1.spawn)(command, [], __assign({ shell: true, stdio: 'inherit' }, options));
|
|
79
82
|
var timer = setTimeout(function () {
|
|
80
83
|
child.kill('SIGTERM');
|
|
81
|
-
reject(new Error("
|
|
84
|
+
reject(new Error("ExecSync timeout"));
|
|
82
85
|
}, timeout);
|
|
83
86
|
child.on('exit', function (code, signal) {
|
|
84
87
|
clearTimeout(timer);
|
|
@@ -107,7 +110,7 @@ var BumpPackagesTask = /** @class */ (function () {
|
|
|
107
110
|
}
|
|
108
111
|
BumpPackagesTask.prototype.run = function (options) {
|
|
109
112
|
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
-
var branch, isValid, lernaVersionCmd
|
|
113
|
+
var branch, isValid, lernaVersionCmd;
|
|
111
114
|
return __generator(this, function (_a) {
|
|
112
115
|
switch (_a.label) {
|
|
113
116
|
case 0:
|
|
@@ -131,22 +134,17 @@ var BumpPackagesTask = /** @class */ (function () {
|
|
|
131
134
|
utils_1.Logger.logError('Something went wrong while trying to detect which versioning script to run with Lerna.');
|
|
132
135
|
return [2 /*return*/, false];
|
|
133
136
|
}
|
|
134
|
-
|
|
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)];
|
|
135
142
|
case 3:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return [3 /*break*/, 7];
|
|
142
|
-
case 5:
|
|
143
|
-
error_1 = _a.sent();
|
|
144
|
-
utils_1.Logger.logInfo('Command failed:', error_1.message);
|
|
145
|
-
return [3 /*break*/, 7];
|
|
146
|
-
case 6:
|
|
147
|
-
utils_1.Logger.logInfo('Exiting process');
|
|
148
|
-
return [2 /*return*/, true];
|
|
149
|
-
case 7:
|
|
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();
|
|
150
148
|
utils_1.Logger.logSuccess('Successfully executed Lerna versioning command.');
|
|
151
149
|
return [2 /*return*/, true];
|
|
152
150
|
}
|