@clickview/ship-it 0.0.2-dev.0 → 0.0.2-dev.1

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.
@@ -37,7 +37,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.setupCommands = void 0;
40
- var commander_1 = require("commander");
41
40
  var constants_1 = require("../constants");
42
41
  var AddMilestoneCommand_1 = require("./AddMilestoneCommand");
43
42
  function setupCommands(program, container) {
@@ -54,7 +53,7 @@ function setupCommands(program, container) {
54
53
  program.command('bump-packages')
55
54
  .description('Bump clickview npm package versions in monorepo to their next version')
56
55
  .requiredOption('-b, --branchName <branchName>')
57
- .addOption(new commander_1.Option('-p, --preid <preId>').choices(['dev', 'rc']))
56
+ .option('-p, --preId <preId>')
58
57
  .action(function (options) { return __awaiter(_this, void 0, void 0, function () {
59
58
  return __generator(this, function (_a) {
60
59
  container
@@ -60,6 +60,7 @@ 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 GENERIC_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;
@@ -68,7 +69,7 @@ var BumpPackagesTask = /** @class */ (function () {
68
69
  }
69
70
  BumpPackagesTask.prototype.run = function (options) {
70
71
  return __awaiter(this, void 0, void 0, function () {
71
- var mergeRequest, isValid, bumpCommand;
72
+ var mergeRequest, isValid, lernaVersionCmd;
72
73
  return __generator(this, function (_a) {
73
74
  switch (_a.label) {
74
75
  case 0:
@@ -83,11 +84,14 @@ var BumpPackagesTask = /** @class */ (function () {
83
84
  isValid = this.validateOptions(options);
84
85
  if (!isValid)
85
86
  return [2 /*return*/, false];
86
- return [4 /*yield*/, this.getBumpCommand(options)];
87
+ return [4 /*yield*/, this.getLernaVersionCmd(options)];
87
88
  case 1:
88
- bumpCommand = _a.sent();
89
- // console.log('bump command is:', bumpCommand);
90
- (0, child_process_1.execSync)("npm run ".concat(bumpCommand));
89
+ lernaVersionCmd = _a.sent();
90
+ if (!lernaVersionCmd) {
91
+ utils_1.Logger.logError('Something went wrong while trying to detect which versioning script to run with Lerna.');
92
+ return [2 /*return*/, false];
93
+ }
94
+ (0, child_process_1.execSync)(lernaVersionCmd);
91
95
  return [2 /*return*/, true];
92
96
  }
93
97
  });
@@ -95,6 +99,10 @@ var BumpPackagesTask = /** @class */ (function () {
95
99
  };
96
100
  BumpPackagesTask.prototype.validateOptions = function (options) {
97
101
  var isValidReleaseBranch = this.isReleaseBranch || this.isHotfixBranch;
102
+ if (options.preId && options.preId !== 'rc' && options.preId !== 'dev') {
103
+ utils_1.Logger.logError("Argument for \"preId\" can only be \"rc\" or \"dev\". You entered: ".concat(options.preId));
104
+ return false;
105
+ }
98
106
  if (options.preId === 'dev' && isValidReleaseBranch) {
99
107
  utils_1.Logger.logError('Dev versions cannot be generated on release or hotfix branches.');
100
108
  return false;
@@ -125,7 +133,7 @@ var BumpPackagesTask = /** @class */ (function () {
125
133
  });
126
134
  });
127
135
  };
128
- BumpPackagesTask.prototype.getBumpCommand = function (options) {
136
+ BumpPackagesTask.prototype.getLernaVersionCmd = function (options) {
129
137
  return __awaiter(this, void 0, void 0, function () {
130
138
  var hasBumpedOnce;
131
139
  return __generator(this, function (_a) {
@@ -135,21 +143,21 @@ var BumpPackagesTask = /** @class */ (function () {
135
143
  hasBumpedOnce = _a.sent();
136
144
  if (options.preId === 'rc') {
137
145
  if (hasBumpedOnce)
138
- return [2 /*return*/, 'lerna-prerelease-rc'];
146
+ return [2 /*return*/, "lerna version prerelease --preid rc ".concat(GENERIC_LERNA_OPTIONS)];
139
147
  if (this.isReleaseBranch)
140
- return [2 /*return*/, 'lerna-preminor-rc'];
148
+ return [2 /*return*/, "lerna version preminor --preid rc ".concat(GENERIC_LERNA_OPTIONS)];
141
149
  if (this.isHotfixBranch)
142
- return [2 /*return*/, 'lerna-prepatch-rc'];
150
+ return [2 /*return*/, "lerna version prepatch --preid rc ".concat(GENERIC_LERNA_OPTIONS)];
143
151
  }
144
152
  if (options.preId === 'dev') {
145
153
  if (hasBumpedOnce)
146
- return [2 /*return*/, 'lerna-prerelease-dev'];
147
- return [2 /*return*/, 'lerna-prepatch-dev'];
154
+ return [2 /*return*/, "lerna version prerelease --preid dev ".concat(GENERIC_LERNA_OPTIONS)];
155
+ return [2 /*return*/, "lerna version prepatch --preid dev ".concat(GENERIC_LERNA_OPTIONS)];
148
156
  }
149
157
  if (this.isReleaseBranch)
150
- return [2 /*return*/, 'lerna-minor'];
158
+ return [2 /*return*/, "lerna version minor"];
151
159
  if (this.isHotfixBranch)
152
- return [2 /*return*/, 'lerna-patch'];
160
+ return [2 /*return*/, "lerna version patch"];
153
161
  // Should never be reached
154
162
  return [2 /*return*/, ''];
155
163
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickview/ship-it",
3
- "version": "0.0.2-dev.0",
3
+ "version": "0.0.2-dev.1",
4
4
  "description": "Release Manager",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {