@clickview/ship-it 0.0.35-dev.15 → 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.
@@ -359,22 +359,6 @@ var GitLabApiClient = /** @class */ (function () {
359
359
  });
360
360
  });
361
361
  };
362
- GitLabApiClient.prototype.updateFiles = function (projectId, branchName, commitMessage, files) {
363
- return __awaiter(this, void 0, void 0, function () {
364
- return __generator(this, function (_a) {
365
- switch (_a.label) {
366
- case 0: return [4 /*yield*/, this.client.Commits.create(projectId, branchName, commitMessage, files.map(function (f) { return ({
367
- action: 'update',
368
- filePath: f.filePath,
369
- content: f.content
370
- }); }))];
371
- case 1:
372
- _a.sent();
373
- return [2 /*return*/];
374
- }
375
- });
376
- });
377
- };
378
362
  GitLabApiClient.prototype.commit = function (projectId, branchName, files, commitMessage) {
379
363
  return __awaiter(this, void 0, void 0, function () {
380
364
  return __generator(this, function (_a) {
@@ -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);
package/lib/src/index.js CHANGED
File without changes
@@ -353,9 +353,6 @@ var GitLabService = /** @class */ (function () {
353
353
  GitLabService.prototype.updateFile = function (projectId, filePath, branchName, content, commit) {
354
354
  return this.apiClient.updateFile(projectId, filePath, branchName, content, commit);
355
355
  };
356
- GitLabService.prototype.updateFiles = function (projectId, branchName, commitMessage, files) {
357
- return this.apiClient.updateFiles(projectId, branchName, commitMessage, files);
358
- };
359
356
  GitLabService.prototype.commit = function (projectId, branchName, commitMessage, files) {
360
357
  return __awaiter(this, void 0, void 0, function () {
361
358
  return __generator(this, function (_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 _a, branch, isValid, commitFiles;
73
- return __generator(this, function (_b) {
74
- switch (_b.label) {
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
- this.isReleaseBranch = RELEASE_BRANCH_REGEX.test(options.branchName) || true;
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
- _a = this;
81
+ _b = this;
81
82
  return [4 /*yield*/, this.getIsInPrerelease(options.branchName)];
82
83
  case 1:
83
- _a.isInPreRelease = _b.sent();
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 = _b.sent();
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,11 +92,22 @@ 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! Proceeding to bump package versions.');
95
- commitFiles = this.getCommitFiles(options);
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);
102
+ utils_1.Logger.logInfo('Writing new versions to package.json files...');
103
+ for (_i = 0, commitFiles_1 = commitFiles; _i < commitFiles_1.length; _i++) {
104
+ file = commitFiles_1[_i];
105
+ (0, fs_1.writeFileSync)(file.filePath, file.content);
106
+ }
107
+ utils_1.Logger.logInfo('Committing new versions...');
96
108
  return [4 /*yield*/, this.service.commit(utils_1.ProjectIds.MONOREPO_PROJECT_ID, options.branchName, 'Bump package versions', commitFiles)];
97
109
  case 3:
98
- _b.sent();
110
+ _c.sent();
99
111
  utils_1.Logger.logSuccess('Successfully committed updated version numbers.');
100
112
  return [2 /*return*/, true];
101
113
  }
@@ -138,14 +150,13 @@ var BumpPackagesTask = /** @class */ (function () {
138
150
  });
139
151
  });
140
152
  };
141
- BumpPackagesTask.prototype.getCommitFiles = function (options) {
153
+ BumpPackagesTask.prototype.getCommitFiles = function (options, packageJsonFiles) {
142
154
  var commitFiles = [];
143
- for (var _i = 0, MONOREPO_PACKAGE_JSON_FILES_1 = MonorepoPackageJsonFiles_1.MONOREPO_PACKAGE_JSON_FILES; _i < MONOREPO_PACKAGE_JSON_FILES_1.length; _i++) {
144
- var filePath = MONOREPO_PACKAGE_JSON_FILES_1[_i];
155
+ for (var _i = 0, packageJsonFiles_1 = packageJsonFiles; _i < packageJsonFiles_1.length; _i++) {
156
+ var filePath = packageJsonFiles_1[_i];
145
157
  var content = '';
146
158
  try {
147
159
  content = (0, fs_1.readFileSync)(filePath, { encoding: 'utf8' });
148
- utils_1.Logger.logInfo('file', filePath, content);
149
160
  }
150
161
  catch (_a) {
151
162
  /**
@@ -185,15 +196,15 @@ var BumpPackagesTask = /** @class */ (function () {
185
196
  };
186
197
  BumpPackagesTask.prototype.getIsInPrerelease = function (branchName) {
187
198
  return __awaiter(this, void 0, void 0, function () {
188
- var _i, MONOREPO_PACKAGE_JSON_FILES_2, file, text, json;
199
+ var _i, MONOREPO_PACKAGE_JSON_FILES_1, file, text, json;
189
200
  return __generator(this, function (_a) {
190
201
  switch (_a.label) {
191
202
  case 0:
192
- _i = 0, MONOREPO_PACKAGE_JSON_FILES_2 = MonorepoPackageJsonFiles_1.MONOREPO_PACKAGE_JSON_FILES;
203
+ _i = 0, MONOREPO_PACKAGE_JSON_FILES_1 = MonorepoPackageJsonFiles_1.MONOREPO_PACKAGE_JSON_FILES;
193
204
  _a.label = 1;
194
205
  case 1:
195
- if (!(_i < MONOREPO_PACKAGE_JSON_FILES_2.length)) return [3 /*break*/, 4];
196
- file = MONOREPO_PACKAGE_JSON_FILES_2[_i];
206
+ if (!(_i < MONOREPO_PACKAGE_JSON_FILES_1.length)) return [3 /*break*/, 4];
207
+ file = MONOREPO_PACKAGE_JSON_FILES_1[_i];
197
208
  return [4 /*yield*/, this.getFileText(utils_1.ProjectIds.MONOREPO_PROJECT_ID, branchName, file)];
198
209
  case 2:
199
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 --package-lock-only"));
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 --package-lock-only"));
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 --package-lock-only', {
283
+ child_process_1.default.execSync('npm i', {
284
284
  cwd: outputPath,
285
285
  // Uncomment if we want to silence
286
286
  // stdio: 'pipe'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickview/ship-it",
3
- "version": "0.0.35-dev.15",
3
+ "version": "0.0.35-dev.17",
4
4
  "description": "Release Manager",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {