@clickview/ship-it 0.0.35-dev.1 → 0.0.35-dev.11

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,42 +107,46 @@ 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:
76
114
  utils_1.Logger.logTask('Bumping clickview npm package versions');
77
115
  this.isReleaseBranch = RELEASE_BRANCH_REGEX.test(options.branchName);
78
- utils_1.Logger.logInfo(1);
79
116
  this.isHotfixBranch = HOTFIX_BRANCH_REGEX.test(options.branchName);
80
- utils_1.Logger.logInfo(2);
81
117
  return [4 /*yield*/, this.service.getBranch(utils_1.ProjectIds.MONOREPO_PROJECT_ID, options.branchName)];
82
118
  case 1:
83
119
  branch = _a.sent();
84
- utils_1.Logger.logInfo(3);
85
120
  if (!branch) {
86
- utils_1.Logger.logInfo(4);
87
121
  utils_1.Logger.logError("Branch with name ".concat(options.branchName, " was not be found."));
88
122
  return [2 /*return*/, false];
89
123
  }
90
- utils_1.Logger.logInfo(5);
91
124
  isValid = this.validateOptions(options);
92
- utils_1.Logger.logInfo(6);
93
125
  if (!isValid)
94
126
  return [2 /*return*/, false];
95
- utils_1.Logger.logInfo(7);
96
127
  return [4 /*yield*/, this.getLernaCommand(options)];
97
128
  case 2:
98
129
  lernaVersionCmd = _a.sent();
99
- utils_1.Logger.logInfo(8);
100
130
  if (!lernaVersionCmd) {
101
- utils_1.Logger.logInfo(9);
102
131
  utils_1.Logger.logError('Something went wrong while trying to detect which versioning script to run with Lerna.');
103
132
  return [2 /*return*/, false];
104
133
  }
105
- utils_1.Logger.logInfo(10);
106
- (0, child_process_1.execSync)(lernaVersionCmd);
107
- utils_1.Logger.logInfo(11);
134
+ _a.label = 3;
135
+ case 3:
136
+ _a.trys.push([3, 5, 6, 7]);
137
+ return [4 /*yield*/, execSyncWithTimeout(lernaVersionCmd, 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:
108
150
  utils_1.Logger.logSuccess('Successfully executed Lerna versioning command.');
109
151
  return [2 /*return*/, true];
110
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickview/ship-it",
3
- "version": "0.0.35-dev.1",
3
+ "version": "0.0.35-dev.11",
4
4
  "description": "Release Manager",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {