@clickview/ship-it 0.0.6 → 0.0.7

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.
Files changed (44) hide show
  1. package/lib/src/constants/ProjectNames.js +44 -0
  2. package/lib/src/constants/TeamCityBuildIDs.js +7 -7
  3. package/lib/src/constants/index.js +1 -0
  4. package/lib/src/services/GitLabService.js +14 -8
  5. package/lib/src/startup/AddMilestoneCommand.js +6 -0
  6. package/lib/src/startup/SetupCommands.js +3 -0
  7. package/lib/src/tasks/InstallPackagesTask.js +1 -0
  8. package/lib/src/tasks/StartConsumingProjectBuildsTask.js +1 -0
  9. package/lib/src/utils/ProjectIds.js +25 -15
  10. package/package.json +1 -1
  11. package/temp/S3/Analytics Web/package-lock.json +0 -1831
  12. package/temp/S3/Analytics Web/package.json +0 -43
  13. package/temp/S3/ClickView Online/package-lock.json +0 -10575
  14. package/temp/S3/ClickView Online/package.json +0 -151
  15. package/temp/S3/Lite/package-lock.json +0 -1411
  16. package/temp/S3/Lite/package.json +0 -48
  17. package/temp/T1/Analytics Web/package-lock.json +0 -2186
  18. package/temp/T1/Analytics Web/package.json +0 -43
  19. package/temp/T1/ClickView Online/package-lock.json +0 -10575
  20. package/temp/T1/ClickView Online/package.json +0 -151
  21. package/temp/T1/ClickView.Curator/package-lock.json +0 -11913
  22. package/temp/T1/ClickView.Curator/package.json +0 -62
  23. package/temp/T1/Lite/package-lock.json +0 -1411
  24. package/temp/T1/Lite/package.json +0 -48
  25. package/temp/T2/Analytics Web/package-lock.json +0 -2186
  26. package/temp/T2/Analytics Web/package.json +0 -43
  27. package/temp/T2/ClickView Online/package-lock.json +0 -10575
  28. package/temp/T2/ClickView Online/package.json +0 -151
  29. package/temp/T2/ClickView.Curator/package-lock.json +0 -11913
  30. package/temp/T2/ClickView.Curator/package.json +0 -62
  31. package/temp/T2/Library Editor/package-lock.json +0 -2415
  32. package/temp/T2/Library Editor/package.json +0 -41
  33. package/temp/T2/Lite/package-lock.json +0 -1411
  34. package/temp/T2/Lite/package.json +0 -48
  35. package/temp/U3/Analytics Web/package-lock.json +0 -2186
  36. package/temp/U3/Analytics Web/package.json +0 -43
  37. package/temp/U3/ClickView Online/package-lock.json +0 -10593
  38. package/temp/U3/ClickView Online/package.json +0 -151
  39. package/temp/U3/ClickView.Curator/package-lock.json +0 -11923
  40. package/temp/U3/ClickView.Curator/package.json +0 -62
  41. package/temp/U3/Library Editor/package-lock.json +0 -2389
  42. package/temp/U3/Library Editor/package.json +0 -41
  43. package/temp/U3/Lite/package-lock.json +0 -1411
  44. package/temp/U3/Lite/package.json +0 -48
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROJECT_NAMES = void 0;
4
+ exports.PROJECT_NAMES = {
5
+ frontend: {
6
+ monorepo: '798',
7
+ online: '109',
8
+ curator: '62',
9
+ lite: '822',
10
+ // Project names listed below are projects that have multiple names internally. Either can be used as an argument
11
+ cloud: '534',
12
+ le: '534',
13
+ analytics: '970',
14
+ reports: '970'
15
+ },
16
+ /**
17
+ * IMPORTANT: Please don't append "api" or "service" to these names unless it makes sense (like for tvweb vs tvapi)
18
+ * If someone passes for example "emailservice" or "onlineapi" as arguments,
19
+ * it will still be detected by `ProjectIds.ts`
20
+ */
21
+ backend: {
22
+ integrations: '850',
23
+ auth: '54',
24
+ online: '41',
25
+ email: '66',
26
+ launch: '969',
27
+ videoprocessor: '84',
28
+ image: '83',
29
+ hydration: '844',
30
+ index: '932',
31
+ search: '936',
32
+ videoviews: '835',
33
+ domain: '108',
34
+ classroom: '921',
35
+ classrooms: '921',
36
+ user: '914',
37
+ users: '914',
38
+ tvweb: '161',
39
+ cloud247web: '161',
40
+ },
41
+ mobile: {
42
+ android: '887'
43
+ }
44
+ };
@@ -2,12 +2,12 @@
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.TeamCityBuildIds = void 0;
5
- var utils_1 = require("../utils");
5
+ var constants_1 = require("../constants");
6
6
  exports.TeamCityBuildIds = (_a = {},
7
- _a[utils_1.PROJECT_NAMES.monorepo] = 'Frontend_BuildAndPublishReleaseCandidate',
8
- _a[utils_1.PROJECT_NAMES.online] = 'online_web_build_and_package',
9
- _a[utils_1.PROJECT_NAMES.curator] = 'curator_web_build_and_package',
10
- _a[utils_1.PROJECT_NAMES.cloud] = 'ClickViewCloud_BuildAndPackageDocker',
11
- _a[utils_1.PROJECT_NAMES.reports] = 'Web_AnalyticsWeb_BuildAndPackageDocker',
12
- _a[utils_1.PROJECT_NAMES.lite] = 'ClickViewLiteWeb_BuildAndPackageDocker',
7
+ _a[constants_1.PROJECT_NAMES.frontend.monorepo] = 'Frontend_BuildAndPublishReleaseCandidate',
8
+ _a[constants_1.PROJECT_NAMES.frontend.online] = 'online_web_build_and_package',
9
+ _a[constants_1.PROJECT_NAMES.frontend.curator] = 'curator_web_build_and_package',
10
+ _a[constants_1.PROJECT_NAMES.frontend.cloud] = 'ClickViewCloud_BuildAndPackageDocker',
11
+ _a[constants_1.PROJECT_NAMES.frontend.reports] = 'Web_AnalyticsWeb_BuildAndPackageDocker',
12
+ _a[constants_1.PROJECT_NAMES.frontend.lite] = 'ClickViewLiteWeb_BuildAndPackageDocker',
13
13
  _a);
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./CommandTypeMapping"), exports);
18
18
  __exportStar(require("./MonorepoPackageJsonFiles"), exports);
19
+ __exportStar(require("./ProjectNames"), exports);
@@ -82,37 +82,37 @@ var GitLabService = /** @class */ (function () {
82
82
  this.apiClient = apiClient;
83
83
  }
84
84
  GitLabService.prototype.getProjects = function (options) {
85
- var _a;
85
+ var _a, _b;
86
86
  return __awaiter(this, void 0, void 0, function () {
87
87
  var allMergeRequests, mergeRequests, projectIds, projects, mappedProjects, _i, mappedProjects_1, mappedProject, extraProjects;
88
- return __generator(this, function (_b) {
89
- switch (_b.label) {
88
+ return __generator(this, function (_c) {
89
+ switch (_c.label) {
90
90
  case 0:
91
91
  if (this.projects)
92
92
  return [2 /*return*/, this.projects];
93
93
  return [4 /*yield*/, this.apiClient.getMergeRequests(options)];
94
94
  case 1:
95
- allMergeRequests = _b.sent();
95
+ allMergeRequests = _c.sent();
96
96
  mergeRequests = allMergeRequests.filter(function (mr) { return mr.targetBranch !== 'master'; });
97
97
  if (!(mergeRequests === null || mergeRequests === void 0 ? void 0 : mergeRequests.length))
98
98
  throw new errors_1.ShipItError('Could not find any merge requests for the specified options');
99
99
  projectIds = lodash_1.default.uniqBy(mergeRequests, function (m) { return m.projectId; }).map(function (m) { return m.projectId; });
100
100
  return [4 /*yield*/, this.apiClient.getProjectsByIds(projectIds)];
101
101
  case 2:
102
- projects = _b.sent();
102
+ projects = _c.sent();
103
103
  if (!(projects === null || projects === void 0 ? void 0 : projects.length) || projects.length !== projectIds.length)
104
104
  throw new errors_1.ShipItError('Could not find all projects for the found merge requests');
105
105
  mappedProjects = projects.map(function (p) { return (__assign(__assign({}, p), { mergeRequests: mergeRequests.filter(function (mr) { return mr.projectId === p.id; }) })); });
106
106
  _i = 0, mappedProjects_1 = mappedProjects;
107
- _b.label = 3;
107
+ _c.label = 3;
108
108
  case 3:
109
109
  if (!(_i < mappedProjects_1.length)) return [3 /*break*/, 6];
110
110
  mappedProject = mappedProjects_1[_i];
111
111
  return [4 /*yield*/, this.getExtraProjects(mappedProject, projectIds)];
112
112
  case 4:
113
- extraProjects = _b.sent();
113
+ extraProjects = _c.sent();
114
114
  Array.prototype.push.apply(mappedProjects, extraProjects.map(function (p) { return (__assign(__assign({}, p), { mergeRequests: [] })); }));
115
- _b.label = 5;
115
+ _c.label = 5;
116
116
  case 5:
117
117
  _i++;
118
118
  return [3 /*break*/, 3];
@@ -126,6 +126,12 @@ var GitLabService = /** @class */ (function () {
126
126
  return (_a = options.projectIds) === null || _a === void 0 ? void 0 : _a.some(function (pid) { return p.id.toString() === pid; });
127
127
  });
128
128
  }
129
+ if ((_b = options.omittedProjectIds) === null || _b === void 0 ? void 0 : _b.length) {
130
+ mappedProjects = mappedProjects.filter(function (p) {
131
+ var _a;
132
+ return !((_a = options.omittedProjectIds) === null || _a === void 0 ? void 0 : _a.some(function (pid) { return p.id.toString() === pid; }));
133
+ });
134
+ }
129
135
  return [2 /*return*/, (this.projects = mappedProjects)];
130
136
  }
131
137
  });
@@ -50,9 +50,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
50
50
  exports.processMilestoneCommandOptions = exports.getAddMilestoneCommand = void 0;
51
51
  var utils_1 = require("../utils");
52
52
  function processOptions(options) {
53
+ var _a, _b;
53
54
  var opts = __assign(__assign({}, options), { version: 'minor' });
55
+ if (((_a = options.projectIds) === null || _a === void 0 ? void 0 : _a.length) && ((_b = options.omit) === null || _b === void 0 ? void 0 : _b.length))
56
+ throw new Error("Cannot provide both project IDs and omitted project IDs in the same command");
54
57
  if (options.projectIds)
55
58
  opts.projectIds = utils_1.ProjectIds.getProjectIds(options.projectIds);
59
+ if (options.omit)
60
+ opts.omittedProjectIds = utils_1.ProjectIds.getProjectIds(options.omit);
56
61
  if (options.hotfix && options.major)
57
62
  throw new Error('Cannot pass both --hotfix and --major options');
58
63
  if (options.major)
@@ -69,6 +74,7 @@ var getAddMilestoneCommand = function (program, getAction) {
69
74
  .description(description)
70
75
  .requiredOption('-m, --milestone <milestone>')
71
76
  .option('-p, --projectIds <projectIds...>')
77
+ .option('-o, --omit <omittedProjectIds...>')
72
78
  .option('--hotfix')
73
79
  .option('--major')
74
80
  .action(function (opts) { return __awaiter(_this, void 0, void 0, function () {
@@ -54,6 +54,7 @@ function setupCommands(program, container) {
54
54
  .description('Create releases for all projects that are part of a milestone')
55
55
  .requiredOption('-m, --milestone <milestone>')
56
56
  .option('-p, --projectIds <projectIds...>')
57
+ .option('-o, --omit <omittedProjectIds...>')
57
58
  .option('--hotfix')
58
59
  .option('--major')
59
60
  .option('--trigger-monorepo-build')
@@ -80,6 +81,7 @@ function setupCommands(program, container) {
80
81
  .option('-m, --milestone <milestone>')
81
82
  .option('-b, --monorepoBranchName <monorepoBranchName>')
82
83
  .option('-p, --projectIds <projectIds...>')
84
+ .option('-o, --omit <omittedProjectIds...>')
83
85
  .action(function (opts) { return __awaiter(_this, void 0, void 0, function () {
84
86
  var options;
85
87
  return __generator(this, function (_a) {
@@ -103,6 +105,7 @@ function setupCommands(program, container) {
103
105
  .option('-m, --milestone <milestone>')
104
106
  .option('--monorepoBranchName <monorepoBranchName>')
105
107
  .option('-p, --projectIds <projectIds...>')
108
+ .option('-o, --omit <omittedProjectIds...>')
106
109
  .action(function (opts) { return __awaiter(_this, void 0, void 0, function () {
107
110
  var options;
108
111
  return __generator(this, function (_a) {
@@ -102,6 +102,7 @@ var InstallPackagesTask = /** @class */ (function () {
102
102
  options = {
103
103
  version: _options.version,
104
104
  projectIds: _options.projectIds,
105
+ omittedProjectIds: _options.omittedProjectIds,
105
106
  milestone: milestone
106
107
  };
107
108
  return [4 /*yield*/, this.service.getProjects(options)];
@@ -85,6 +85,7 @@ var StartConsumingProjectBuildsTask = /** @class */ (function () {
85
85
  options = {
86
86
  version: _options.version,
87
87
  projectIds: _options.projectIds,
88
+ omittedProjectIds: _options.omittedProjectIds,
88
89
  milestone: milestone
89
90
  };
90
91
  return [4 /*yield*/, this.gitLabService.getProjects(options)];
@@ -1,20 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProjectIds = exports.PROJECT_NAMES = void 0;
3
+ exports.ProjectIds = void 0;
4
+ var lodash_1 = require("lodash");
5
+ var constants_1 = require("../constants");
4
6
  var errors_1 = require("../errors");
5
- exports.PROJECT_NAMES = {
6
- monorepo: '798',
7
- online: '109',
8
- curator: '62',
9
- cloud: '534',
10
- reports: '970',
11
- lite: '822',
12
- android: '887',
13
- integrationsapi: '850',
14
- auth: '54'
15
- };
16
7
  exports.ProjectIds = {
17
- MONOREPO_PROJECT_ID: '798',
8
+ MONOREPO_PROJECT_ID: constants_1.PROJECT_NAMES.frontend.monorepo,
18
9
  /**
19
10
  * This allows project names to be passed into the CLI.
20
11
  * For example `ship-it release -m S2 -p lite`
@@ -27,11 +18,30 @@ exports.ProjectIds = {
27
18
  projectIds.push(project);
28
19
  continue;
29
20
  }
30
- var mappedId = exports.PROJECT_NAMES[project.toLowerCase()];
21
+ var mappedId = getMappedId(project);
31
22
  if (!mappedId)
32
23
  throw new errors_1.ShipItError("Could not find project id mapping for ".concat(project));
33
24
  projectIds.push(mappedId);
34
25
  }
35
- return projectIds;
26
+ return (0, lodash_1.uniq)(projectIds);
36
27
  }
37
28
  };
29
+ function getMappedId(project) {
30
+ for (var projectGroup in constants_1.PROJECT_NAMES) {
31
+ var projectGroupIds = constants_1.PROJECT_NAMES[projectGroup];
32
+ if (projectGroupIds[project])
33
+ return projectGroupIds[project];
34
+ // Support arguments such as "emailapi"
35
+ if (projectGroupIds[project.replace('api', '')])
36
+ return projectGroupIds[project.replace('api', '')];
37
+ // Support arguments such as "emailservice"
38
+ if (projectGroupIds[project.replace('service', '')])
39
+ return projectGroupIds[project.replace('service', '')];
40
+ // Support arguments such as "launchweb"
41
+ if (projectGroupIds[project.replace('web', '')])
42
+ return projectGroupIds[project.replace('web', '')];
43
+ // Support arguments such as "hydrationapp"
44
+ if (projectGroupIds[project.replace('app', '')])
45
+ return projectGroupIds[project.replace('app', '')];
46
+ }
47
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickview/ship-it",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Release Manager",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {