@clickview/ship-it 0.0.6-rc.1 → 0.0.6
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 +1 -4
- package/lib/src/api-clients/git-lab/GitLabMapper.js +4 -2
- package/lib/src/commands/StatusCommand.js +5 -9
- package/lib/src/services/GitLabService.js +14 -1
- package/lib/src/tasks/ValidateTask.js +16 -8
- package/lib/src/utils/Commits.js +12 -2
- package/lib/src/utils/Descriptions.js +52 -3
- package/package.json +1 -1
- package/temp/S3/Analytics Web/package-lock.json +1831 -0
- package/temp/S3/Analytics Web/package.json +43 -0
- package/temp/S3/ClickView Online/package-lock.json +10575 -0
- package/temp/S3/ClickView Online/package.json +151 -0
- package/temp/S3/Lite/package-lock.json +1411 -0
- package/temp/S3/Lite/package.json +48 -0
- package/temp/T1/Analytics Web/package-lock.json +2186 -0
- package/temp/T1/Analytics Web/package.json +43 -0
- package/temp/T1/ClickView Online/package-lock.json +10575 -0
- package/temp/T1/ClickView Online/package.json +151 -0
- package/temp/T1/ClickView.Curator/package-lock.json +11913 -0
- package/temp/T1/ClickView.Curator/package.json +62 -0
- package/temp/T1/Lite/package-lock.json +1411 -0
- package/temp/T1/Lite/package.json +48 -0
- package/temp/T2/Analytics Web/package-lock.json +2186 -0
- package/temp/T2/Analytics Web/package.json +43 -0
- package/temp/T2/ClickView Online/package-lock.json +10575 -0
- package/temp/T2/ClickView Online/package.json +151 -0
- package/temp/T2/ClickView.Curator/package-lock.json +11913 -0
- package/temp/T2/ClickView.Curator/package.json +62 -0
- package/temp/T2/Library Editor/package-lock.json +2415 -0
- package/temp/T2/Library Editor/package.json +41 -0
- package/temp/T2/Lite/package-lock.json +1411 -0
- package/temp/T2/Lite/package.json +48 -0
- package/temp/U3/Analytics Web/package-lock.json +2186 -0
- package/temp/U3/Analytics Web/package.json +43 -0
- package/temp/U3/ClickView Online/package-lock.json +10593 -0
- package/temp/U3/ClickView Online/package.json +151 -0
- package/temp/U3/ClickView.Curator/package-lock.json +11923 -0
- package/temp/U3/ClickView.Curator/package.json +62 -0
- package/temp/U3/Library Editor/package-lock.json +2389 -0
- package/temp/U3/Library Editor/package.json +41 -0
- package/temp/U3/Lite/package-lock.json +1411 -0
- package/temp/U3/Lite/package.json +48 -0
- package/dist/T2/Analytics Web.md +0 -7
- package/dist/T2/ClickView Online.md +0 -64
- package/dist/T2/ClickView.Curator.md +0 -45
- package/dist/T2/Library Editor.md +0 -0
- package/dist/T2/Lite.md +0 -17
- package/dist/T2/Release Notes.md +0 -161
- package/dist/T2/Users.Api.md +0 -28
- package/dist/T2/clickview.md +0 -98
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
|
});
|
|
@@ -158,8 +156,7 @@ var GitLabApiClient = /** @class */ (function () {
|
|
|
158
156
|
name: release.name,
|
|
159
157
|
tag_name: release.tag,
|
|
160
158
|
description: release.description,
|
|
161
|
-
ref: release.ref
|
|
162
|
-
milestones: release.milestones
|
|
159
|
+
ref: release.ref
|
|
163
160
|
})];
|
|
164
161
|
case 1:
|
|
165
162
|
newRelease = _a.sent();
|
|
@@ -23,7 +23,8 @@ exports.GitLabMapper = {
|
|
|
23
23
|
project: function (p) {
|
|
24
24
|
return {
|
|
25
25
|
id: p.id,
|
|
26
|
-
title: p.name
|
|
26
|
+
title: p.name,
|
|
27
|
+
url: p.web_url
|
|
27
28
|
};
|
|
28
29
|
},
|
|
29
30
|
tag: function (t) {
|
|
@@ -36,7 +37,8 @@ exports.GitLabMapper = {
|
|
|
36
37
|
return {
|
|
37
38
|
id: c.id,
|
|
38
39
|
title: c.title,
|
|
39
|
-
message: c.message
|
|
40
|
+
message: c.message,
|
|
41
|
+
parentIds: c.parent_ids
|
|
40
42
|
};
|
|
41
43
|
},
|
|
42
44
|
branch: function (b) {
|
|
@@ -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
|
});
|
|
@@ -412,7 +412,7 @@ var GitLabService = /** @class */ (function () {
|
|
|
412
412
|
case 1:
|
|
413
413
|
tags = _a.sent();
|
|
414
414
|
if (!(tags === null || tags === void 0 ? void 0 : tags.length))
|
|
415
|
-
|
|
415
|
+
throw new errors_1.ShipItError("Project ".concat(projectId, " does not have any tags"));
|
|
416
416
|
tagNames = tags.map(function (t) { return t.name; }).filter(function (t) { return semver_1.default.valid(t); });
|
|
417
417
|
if (!tagNames.length)
|
|
418
418
|
return [2 /*return*/, null];
|
|
@@ -426,6 +426,19 @@ var GitLabService = /** @class */ (function () {
|
|
|
426
426
|
});
|
|
427
427
|
});
|
|
428
428
|
};
|
|
429
|
+
GitLabService.prototype.hasSomeTags = function (projectId) {
|
|
430
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
431
|
+
var tags;
|
|
432
|
+
return __generator(this, function (_a) {
|
|
433
|
+
switch (_a.label) {
|
|
434
|
+
case 0: return [4 /*yield*/, this.apiClient.getLatestTags(projectId)];
|
|
435
|
+
case 1:
|
|
436
|
+
tags = _a.sent();
|
|
437
|
+
return [2 /*return*/, !!(tags === null || tags === void 0 ? void 0 : tags.length)];
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
};
|
|
429
442
|
GitLabService.prototype.getNextBranchInfo = function (projectId, version) {
|
|
430
443
|
return __awaiter(this, void 0, void 0, function () {
|
|
431
444
|
var tag, nextVersion, branchName, branch;
|
|
@@ -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
|
}
|
package/lib/src/utils/Commits.js
CHANGED
|
@@ -14,9 +14,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.Commits = void 0;
|
|
15
15
|
exports.Commits = {
|
|
16
16
|
/**
|
|
17
|
-
* Returns true if dev contains commits that are
|
|
17
|
+
* Returns true if dev contains commits that are merge commits from a milestone
|
|
18
|
+
* that is beyond the current release milestone
|
|
18
19
|
*/
|
|
19
20
|
shouldCherryPick: function (project, commits) {
|
|
21
|
+
var _a;
|
|
20
22
|
var commitKeys = project.mergeRequests.reduce(function (prev, current) {
|
|
21
23
|
var _a;
|
|
22
24
|
if (!current.mergeCommit)
|
|
@@ -25,8 +27,16 @@ exports.Commits = {
|
|
|
25
27
|
}, {});
|
|
26
28
|
for (var _i = 0, commits_1 = commits; _i < commits_1.length; _i++) {
|
|
27
29
|
var commit = commits_1[_i];
|
|
28
|
-
if (!commitKeys[commit.id])
|
|
30
|
+
if (!commitKeys[commit.id]) {
|
|
31
|
+
/**
|
|
32
|
+
* Commits straight to dev will have 1 parentId, however
|
|
33
|
+
* merge commits that are potentially targeting another milestone
|
|
34
|
+
* will have at least 2 parent Ids.
|
|
35
|
+
*/
|
|
36
|
+
if (((_a = commit.parentIds) === null || _a === void 0 ? void 0 : _a.length) === 1)
|
|
37
|
+
continue;
|
|
29
38
|
return true;
|
|
39
|
+
}
|
|
30
40
|
}
|
|
31
41
|
return false;
|
|
32
42
|
}
|
|
@@ -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';
|