@clickview/ship-it 0.0.35-dev.0 → 0.0.35-dev.10

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,4 +1,15 @@
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
+ };
2
13
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
14
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
15
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -61,6 +72,33 @@ var HOTFIX_BRANCH_REGEX = /^hotfix\/(\d|\.)+$/;
61
72
  var DEV_VERSION_REGEX = /-dev\.\d+$/;
62
73
  var RC_VERSION_REGEX = /-rc\.\d+$/;
63
74
  var SHARED_LERNA_OPTIONS = '--exact --no-git-tag-version --no-push --yes';
75
+ function execSyncWithTimeout(command, timeout, options) {
76
+ if (options === void 0) { options = {}; }
77
+ return new Promise(function (resolve, reject) {
78
+ var child = (0, child_process_1.spawn)(command, [], __assign({ shell: true, stdio: 'inherit' }, options));
79
+ var timer = setTimeout(function () {
80
+ child.kill('SIGTERM');
81
+ reject(new Error("Command timed out after ".concat(timeout, "ms")));
82
+ }, timeout);
83
+ child.on('exit', function (code, signal) {
84
+ clearTimeout(timer);
85
+ if (signal === 'SIGTERM') {
86
+ // If the process was terminated by our timer
87
+ return;
88
+ }
89
+ if (code === 0) {
90
+ resolve();
91
+ }
92
+ else {
93
+ reject(new Error("Command failed with exit code ".concat(code)));
94
+ }
95
+ });
96
+ child.on('error', function (error) {
97
+ clearTimeout(timer);
98
+ reject(error);
99
+ });
100
+ });
101
+ }
64
102
  var BumpPackagesTask = /** @class */ (function () {
65
103
  function BumpPackagesTask(service) {
66
104
  this.isReleaseBranch = false;
@@ -69,7 +107,7 @@ var BumpPackagesTask = /** @class */ (function () {
69
107
  }
70
108
  BumpPackagesTask.prototype.run = function (options) {
71
109
  return __awaiter(this, void 0, void 0, function () {
72
- var branch, isValid, lernaVersionCmd;
110
+ var branch, isValid, lernaVersionCmd, error_1;
73
111
  return __generator(this, function (_a) {
74
112
  switch (_a.label) {
75
113
  case 0:
@@ -93,7 +131,22 @@ var BumpPackagesTask = /** @class */ (function () {
93
131
  utils_1.Logger.logError('Something went wrong while trying to detect which versioning script to run with Lerna.');
94
132
  return [2 /*return*/, false];
95
133
  }
96
- (0, child_process_1.execSync)(lernaVersionCmd);
134
+ _a.label = 3;
135
+ case 3:
136
+ _a.trys.push([3, 5, 6, 7]);
137
+ return [4 /*yield*/, execSyncWithTimeout('your lerna command', 20000)];
138
+ case 4:
139
+ _a.sent(); // 30 second timeout
140
+ utils_1.Logger.logInfo('Command completed successfully');
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:
97
150
  utils_1.Logger.logSuccess('Successfully executed Lerna versioning command.');
98
151
  return [2 /*return*/, true];
99
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickview/ship-it",
3
- "version": "0.0.35-dev.0",
3
+ "version": "0.0.35-dev.10",
4
4
  "description": "Release Manager",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {