@clickview/ship-it 0.0.6-rc.2 → 0.0.7-rc.0
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.
- package/README.md +11 -4
- package/lib/src/api-clients/git-lab/GitLabApiClient.js +0 -2
- package/lib/src/api-clients/git-lab/GitLabMapper.js +2 -1
- package/lib/src/commands/StatusCommand.js +5 -9
- package/lib/src/constants/ProjectNames.js +44 -0
- package/lib/src/constants/TeamCityBuildIDs.js +7 -7
- package/lib/src/constants/index.js +1 -0
- package/lib/src/services/GitLabService.js +28 -9
- package/lib/src/startup/AddMilestoneCommand.js +6 -0
- package/lib/src/startup/SetupCommands.js +3 -0
- package/lib/src/tasks/InstallPackagesTask.js +1 -0
- package/lib/src/tasks/StartConsumingProjectBuildsTask.js +1 -0
- package/lib/src/tasks/ValidateTask.js +16 -8
- package/lib/src/utils/Descriptions.js +52 -3
- package/lib/src/utils/ProjectIds.js +25 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,13 +20,20 @@ After installation, you can run `npm run start -- help` for a list of Shit Comma
|
|
|
20
20
|
|
|
21
21
|
The available commands are listed below. If you run into issues check that you have met all the [prerequisites](#prerequisites) first.
|
|
22
22
|
|
|
23
|
+
Note down the numeric project id from your project's homepage on GitLab - this will be useful for running some of the commands below.
|
|
24
|
+
|
|
23
25
|
### Status
|
|
24
26
|
|
|
25
|
-
* Command: `npm run start -- status -
|
|
26
|
-
* Example: `npm run start -- status -
|
|
27
|
+
* Command: `npm run start -- status -m milestone [-p projectId]`
|
|
28
|
+
* Example: `npm run start -- status -m T3 -p 887`
|
|
29
|
+
|
|
30
|
+
Get the status of all MRs in a milestone. You can run this command at any time to check whether a miletone is ready for release. You can also limit the status check to a particular project.
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
### Create Notes
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
* Command: `npm run start -- create-notes -m milestone [-p projectId]`
|
|
35
|
+
* Example: `npm run start -- create-notes -m U3 -p 887`
|
|
31
36
|
|
|
37
|
+
Generate release notes for all projects targeting a particular milestone. You can also pass in a `projectId` to generate notes for a single project only.
|
|
32
38
|
|
|
39
|
+
The notes will be saved in a `dist` folder in markdown format.
|
|
@@ -109,8 +109,6 @@ var GitLabApiClient = /** @class */ (function () {
|
|
|
109
109
|
case 0: return [4 /*yield*/, this.client.Tags.all(projectId, { maxPages: 1, perPage: 20 })];
|
|
110
110
|
case 1:
|
|
111
111
|
tags = _a.sent();
|
|
112
|
-
if (!tags.length)
|
|
113
|
-
throw new errors_1.ShipItError("Project ".concat(projectId, " does not have any tags"));
|
|
114
112
|
return [2 /*return*/, tags.map(GitLabMapper_1.GitLabMapper.tag)];
|
|
115
113
|
}
|
|
116
114
|
});
|
|
@@ -60,22 +60,18 @@ var StatusCommand = /** @class */ (function () {
|
|
|
60
60
|
}
|
|
61
61
|
StatusCommand.prototype.run = function (options) {
|
|
62
62
|
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var cont;
|
|
64
63
|
return __generator(this, function (_a) {
|
|
65
64
|
switch (_a.label) {
|
|
66
65
|
case 0: return [4 /*yield*/, this.validateTask.run(options)];
|
|
67
66
|
case 1:
|
|
68
|
-
|
|
69
|
-
// Check if we want to continue with inquirer?
|
|
70
|
-
if (!cont)
|
|
71
|
-
return [2 /*return*/, false];
|
|
67
|
+
_a.sent();
|
|
72
68
|
return [4 /*yield*/, this.validateDescriptionsTask.run(options)];
|
|
73
69
|
case 2:
|
|
74
|
-
|
|
75
|
-
if (!cont)
|
|
76
|
-
return [2 /*return*/, false];
|
|
70
|
+
_a.sent();
|
|
77
71
|
return [4 /*yield*/, this.validateCommitsTask.run(options)];
|
|
78
|
-
case 3:
|
|
72
|
+
case 3:
|
|
73
|
+
_a.sent();
|
|
74
|
+
return [2 /*return*/, true];
|
|
79
75
|
}
|
|
80
76
|
});
|
|
81
77
|
});
|
|
@@ -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
|
|
5
|
+
var constants_1 = require("../constants");
|
|
6
6
|
exports.TeamCityBuildIds = (_a = {},
|
|
7
|
-
_a[
|
|
8
|
-
_a[
|
|
9
|
-
_a[
|
|
10
|
-
_a[
|
|
11
|
-
_a[
|
|
12
|
-
_a[
|
|
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 (
|
|
89
|
-
switch (
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
113
|
+
extraProjects = _c.sent();
|
|
114
114
|
Array.prototype.push.apply(mappedProjects, extraProjects.map(function (p) { return (__assign(__assign({}, p), { mergeRequests: [] })); }));
|
|
115
|
-
|
|
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
|
});
|
|
@@ -412,7 +418,7 @@ var GitLabService = /** @class */ (function () {
|
|
|
412
418
|
case 1:
|
|
413
419
|
tags = _a.sent();
|
|
414
420
|
if (!(tags === null || tags === void 0 ? void 0 : tags.length))
|
|
415
|
-
|
|
421
|
+
throw new errors_1.ShipItError("Project ".concat(projectId, " does not have any tags"));
|
|
416
422
|
tagNames = tags.map(function (t) { return t.name; }).filter(function (t) { return semver_1.default.valid(t); });
|
|
417
423
|
if (!tagNames.length)
|
|
418
424
|
return [2 /*return*/, null];
|
|
@@ -426,6 +432,19 @@ var GitLabService = /** @class */ (function () {
|
|
|
426
432
|
});
|
|
427
433
|
});
|
|
428
434
|
};
|
|
435
|
+
GitLabService.prototype.hasSomeTags = function (projectId) {
|
|
436
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
437
|
+
var tags;
|
|
438
|
+
return __generator(this, function (_a) {
|
|
439
|
+
switch (_a.label) {
|
|
440
|
+
case 0: return [4 /*yield*/, this.apiClient.getLatestTags(projectId)];
|
|
441
|
+
case 1:
|
|
442
|
+
tags = _a.sent();
|
|
443
|
+
return [2 /*return*/, !!(tags === null || tags === void 0 ? void 0 : tags.length)];
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
});
|
|
447
|
+
};
|
|
429
448
|
GitLabService.prototype.getNextBranchInfo = function (projectId, version) {
|
|
430
449
|
return __awaiter(this, void 0, void 0, function () {
|
|
431
450
|
var tag, nextVersion, branchName, branch;
|
|
@@ -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)];
|
|
@@ -86,18 +86,20 @@ var ValidateTask = /** @class */ (function () {
|
|
|
86
86
|
utils_1.Logger.logMessage("Found ".concat(projects.length, " projects that need to be released"));
|
|
87
87
|
cont = true;
|
|
88
88
|
_loop_1 = function (project) {
|
|
89
|
-
var groupedMRs, count, ready, wrongTargetMrs,
|
|
89
|
+
var hasSomeTags, groupedMRs, count, ready, wrongTargetMrs, message_1, issues;
|
|
90
90
|
return __generator(this, function (_b) {
|
|
91
91
|
switch (_b.label) {
|
|
92
|
-
case 0:
|
|
92
|
+
case 0: return [4 /*yield*/, this_1.service.hasSomeTags(project.id)];
|
|
93
|
+
case 1:
|
|
94
|
+
hasSomeTags = _b.sent();
|
|
93
95
|
groupedMRs = lodash_1.default.groupBy(project.mergeRequests, function (mr) { return mr.status; });
|
|
94
96
|
count = Object.keys(groupedMRs).reduce(function (prev, current) {
|
|
95
97
|
var _a;
|
|
96
98
|
return __assign(__assign({}, prev), (_a = {}, _a[current] = groupedMRs[current].length, _a));
|
|
97
99
|
}, {});
|
|
98
|
-
ready = !count.opened || count.opened === 0;
|
|
100
|
+
ready = !count.opened || count.opened === 0 && hasSomeTags;
|
|
99
101
|
return [4 /*yield*/, this_1.getMRsTargetingWrongBranch(project, options.version)];
|
|
100
|
-
case
|
|
102
|
+
case 2:
|
|
101
103
|
wrongTargetMrs = _b.sent();
|
|
102
104
|
if (wrongTargetMrs.length)
|
|
103
105
|
ready = false;
|
|
@@ -107,12 +109,18 @@ var ValidateTask = /** @class */ (function () {
|
|
|
107
109
|
utils_1.Logger.logSuccess("[".concat(project.title, "] READY"));
|
|
108
110
|
}
|
|
109
111
|
else {
|
|
110
|
-
|
|
112
|
+
message_1 = "[".concat(project.title, "] NOT READY:");
|
|
113
|
+
issues = [];
|
|
111
114
|
if (count.opened)
|
|
112
|
-
|
|
115
|
+
issues.push("Contains ".concat(count.opened, " Open MR(s)"));
|
|
113
116
|
if (wrongTargetMrs)
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
issues.push("Contains ".concat(wrongTargetMrs.length, " MR(s) not targeting dev or release branch"));
|
|
118
|
+
if (!hasSomeTags)
|
|
119
|
+
issues.push("Does not have any tags. Please create one here: ".concat(project.url, "/tags"));
|
|
120
|
+
issues.forEach(function (issue) {
|
|
121
|
+
message_1 += "\n- ".concat(issue);
|
|
122
|
+
});
|
|
123
|
+
utils_1.Logger.logError(message_1);
|
|
116
124
|
}
|
|
117
125
|
return [2 /*return*/];
|
|
118
126
|
}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.Descriptions = void 0;
|
|
4
13
|
var VALID_HEADINGS = {
|
|
@@ -28,6 +37,31 @@ var VALID_MONOREPO_HEADINGS = {
|
|
|
28
37
|
'monorepo': true,
|
|
29
38
|
'before release': true
|
|
30
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Most of the ordering here doesn't matter, BUT "before release" and "dependencies" should always be
|
|
42
|
+
* at the top so that they're more visible to whoever is managing the release.
|
|
43
|
+
*/
|
|
44
|
+
var HEADING_ORDER = [
|
|
45
|
+
'before release',
|
|
46
|
+
'dependencies',
|
|
47
|
+
'notes',
|
|
48
|
+
'other',
|
|
49
|
+
'customer changes',
|
|
50
|
+
'code changes',
|
|
51
|
+
'lite',
|
|
52
|
+
'library editor',
|
|
53
|
+
'online',
|
|
54
|
+
'reports',
|
|
55
|
+
'curator',
|
|
56
|
+
'player',
|
|
57
|
+
'shared',
|
|
58
|
+
'analytics',
|
|
59
|
+
'styles',
|
|
60
|
+
'common',
|
|
61
|
+
'monorepo',
|
|
62
|
+
'tooling',
|
|
63
|
+
'testing'
|
|
64
|
+
];
|
|
31
65
|
function toObject(lines, headingPrefix) {
|
|
32
66
|
var obj = {};
|
|
33
67
|
var currentHeading = 'other';
|
|
@@ -56,6 +90,18 @@ function toObject(lines, headingPrefix) {
|
|
|
56
90
|
}
|
|
57
91
|
return obj;
|
|
58
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* I can't read this code but it came from here and it works: https://stackoverflow.com/a/63457487/14258157
|
|
95
|
+
* - Josh
|
|
96
|
+
*/
|
|
97
|
+
function orderDescriptionHeadings(headings) {
|
|
98
|
+
var orderForIndexVals = __spreadArray([], HEADING_ORDER, true).reverse();
|
|
99
|
+
return headings.sort(function (a, b) {
|
|
100
|
+
var aIndex = -orderForIndexVals.indexOf(a);
|
|
101
|
+
var bIndex = -orderForIndexVals.indexOf(b);
|
|
102
|
+
return aIndex - bIndex;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
59
105
|
exports.Descriptions = {
|
|
60
106
|
isDescriptionValid: function (description, headingPrefix, checkForTesting) {
|
|
61
107
|
if (headingPrefix === void 0) { headingPrefix = '#'; }
|
|
@@ -109,7 +155,8 @@ exports.Descriptions = {
|
|
|
109
155
|
_loop_1(descriptionObj);
|
|
110
156
|
}
|
|
111
157
|
var description = '';
|
|
112
|
-
Object.keys(obj)
|
|
158
|
+
var orderedHeadings = orderDescriptionHeadings(Object.keys(obj));
|
|
159
|
+
orderedHeadings.forEach(function (key) {
|
|
113
160
|
if (key === 'notes')
|
|
114
161
|
return;
|
|
115
162
|
if (!obj[key])
|
|
@@ -131,7 +178,8 @@ exports.Descriptions = {
|
|
|
131
178
|
if (!combinedObj[key])
|
|
132
179
|
combinedObj[key] = {};
|
|
133
180
|
var combinedSubObj = toObject(descriptionObj[key].split('\n'), '##');
|
|
134
|
-
Object.keys(combinedSubObj)
|
|
181
|
+
var orderedHeadings = orderDescriptionHeadings(Object.keys(combinedSubObj));
|
|
182
|
+
orderedHeadings.forEach(function (subKey) {
|
|
135
183
|
if (!combinedObj[key][subKey])
|
|
136
184
|
combinedObj[key][subKey] = '';
|
|
137
185
|
combinedObj[key][subKey] += combinedSubObj[subKey];
|
|
@@ -143,9 +191,10 @@ exports.Descriptions = {
|
|
|
143
191
|
var descriptionObj = descriptionObjs_2[_i];
|
|
144
192
|
_loop_2(descriptionObj);
|
|
145
193
|
}
|
|
194
|
+
var orderedHeadings = orderDescriptionHeadings(Object.keys(combinedObj));
|
|
146
195
|
// Build our description
|
|
147
196
|
var description = '';
|
|
148
|
-
|
|
197
|
+
orderedHeadings.forEach(function (key) {
|
|
149
198
|
if (key === 'notes')
|
|
150
199
|
return;
|
|
151
200
|
description += '\n# ' + key.charAt(0).toUpperCase() + key.slice(1) + '\n';
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProjectIds =
|
|
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:
|
|
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 =
|
|
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
|
+
}
|