@clickview/ship-it 0.0.3 → 0.0.4-dev.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/config.json +5 -0
- package/lib/config.json +5 -0
- package/lib/src/api-clients/GitLabApiClient.js +342 -0
- package/lib/src/api-clients/git-lab/GitLabApiClient.js +24 -0
- package/lib/src/api-clients/git-lab/GitLabMapper.js +1 -0
- package/lib/src/api-clients/index.js +1 -0
- package/lib/src/api-clients/team-city/TeamCityApiClient.js +85 -0
- package/lib/src/commands/BumpPackagesCommand.js +2 -4
- package/lib/src/commands/CommitPackageVersionsCommand.js +78 -0
- package/lib/src/commands/CreateBranchCommand.js +4 -6
- package/lib/src/commands/CreateMergeRequestCommand.js +5 -7
- package/lib/src/commands/CreateReleaseNotesCommand.js +2 -4
- package/lib/src/commands/InstallPackagesCommand.js +1 -3
- package/lib/src/commands/ReleaseCommand.js +17 -10
- package/lib/src/commands/StartConsumingProjectBuildsCommand.js +76 -0
- package/lib/src/commands/StatusCommand.js +1 -3
- package/lib/src/commands/ValidateMergeRequestCommand.js +1 -3
- package/lib/src/commands/VersionCommand.js +1 -3
- package/lib/src/commands/index.js +1 -0
- package/lib/src/constants/CommandTypeMapping.js +1 -0
- package/lib/src/constants/TeamCityBuildIDs.js +13 -0
- package/lib/src/constants/index.js +18 -0
- package/lib/src/index.js +1 -1
- package/lib/src/interfaces/ShipItOptions.js +2 -0
- package/lib/src/interfaces/command-cli-options/MilestoneCommandCliOptions.js +2 -0
- package/lib/src/interfaces/command-cli-options/ReleaseCommandCliOptions.js +2 -0
- package/lib/src/interfaces/command-cli-options/index.js +18 -0
- package/lib/src/interfaces/command-options/CommitPackageVersionsCommandOptions.js +2 -0
- package/lib/src/interfaces/command-options/DockerMilestoneCommandOptions.js +2 -0
- package/lib/src/interfaces/command-options/ReleaseCommandOptions.js +2 -0
- package/lib/src/interfaces/command-options/index.js +2 -1
- package/lib/src/interfaces/index.js +1 -0
- package/lib/src/inversify.config.js +8 -0
- package/lib/src/services/GitLabService.js +33 -0
- package/lib/src/services/TeamCityService.js +34 -0
- package/lib/src/services/index.js +1 -0
- package/lib/src/startup/AddMilestoneCommand.js +13 -7
- package/lib/src/startup/GetAction.js +68 -0
- package/lib/src/startup/SetupCommands.js +49 -27
- package/lib/src/tasks/CommitLocalPackagesTask.js +137 -0
- package/lib/src/tasks/CreateBranchTask.js +37 -19
- package/lib/src/tasks/InstallPackagesTask.js +26 -47
- package/lib/src/tasks/StartConsumingProjectBuildsTask.js +143 -0
- package/lib/src/tasks/StartMonorepoBuildTask.js +95 -0
- package/lib/src/tasks/index.js +2 -0
- package/lib/src/types.js +6 -0
- package/lib/src/utils/BranchNames.js +2 -0
- package/lib/src/utils/ProjectIds.js +3 -3
- package/package.json +4 -3
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
24
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
25
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
26
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
27
|
+
function step(op) {
|
|
28
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
29
|
+
while (_) try {
|
|
30
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
31
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
32
|
+
switch (op[0]) {
|
|
33
|
+
case 0: case 1: t = op; break;
|
|
34
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
35
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
36
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
37
|
+
default:
|
|
38
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
39
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
40
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
41
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
42
|
+
if (t[2]) _.ops.pop();
|
|
43
|
+
_.trys.pop(); continue;
|
|
44
|
+
}
|
|
45
|
+
op = body.call(thisArg, _);
|
|
46
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
47
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.StartMonorepoBuildTask = void 0;
|
|
52
|
+
require("reflect-metadata");
|
|
53
|
+
var inversify_1 = require("inversify");
|
|
54
|
+
var utils_1 = require("../utils");
|
|
55
|
+
var services_1 = require("../services");
|
|
56
|
+
var types_1 = require("../types");
|
|
57
|
+
var TeamCityBuildIDs_1 = require("../constants/TeamCityBuildIDs");
|
|
58
|
+
var StartMonorepoBuildTask = /** @class */ (function () {
|
|
59
|
+
function StartMonorepoBuildTask(teamCityService, gitLabService) {
|
|
60
|
+
this.teamCityService = teamCityService;
|
|
61
|
+
this.gitLabService = gitLabService;
|
|
62
|
+
}
|
|
63
|
+
StartMonorepoBuildTask.prototype.run = function (options) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
+
var branchName, build;
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
switch (_a.label) {
|
|
68
|
+
case 0:
|
|
69
|
+
utils_1.Logger.logTask('Starting Monorepo build in TeamCity');
|
|
70
|
+
return [4 /*yield*/, this.gitLabService.getReleaseBranchNameMilestone(utils_1.ProjectIds.MONOREPO_PROJECT_ID, options.milestone)];
|
|
71
|
+
case 1:
|
|
72
|
+
branchName = _a.sent();
|
|
73
|
+
if (!branchName) {
|
|
74
|
+
utils_1.Logger.logError("Monorepo release branch with milestone \"".concat(options.milestone, "\" was not found."));
|
|
75
|
+
return [2 /*return*/, false];
|
|
76
|
+
}
|
|
77
|
+
return [4 /*yield*/, this.teamCityService.startBuild(TeamCityBuildIDs_1.TeamCityBuildIds[utils_1.ProjectIds.MONOREPO_PROJECT_ID], branchName)];
|
|
78
|
+
case 2:
|
|
79
|
+
build = _a.sent();
|
|
80
|
+
utils_1.Logger.logSuccess("Successfully started build in monorepo. View progress here: ".concat(build.webUrl));
|
|
81
|
+
return [2 /*return*/, true];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
StartMonorepoBuildTask = __decorate([
|
|
87
|
+
(0, inversify_1.injectable)(),
|
|
88
|
+
__param(0, (0, inversify_1.inject)(types_1.SERVICES.TeamCityService)),
|
|
89
|
+
__param(1, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
|
|
90
|
+
__metadata("design:paramtypes", [services_1.TeamCityService,
|
|
91
|
+
services_1.GitLabService])
|
|
92
|
+
], StartMonorepoBuildTask);
|
|
93
|
+
return StartMonorepoBuildTask;
|
|
94
|
+
}());
|
|
95
|
+
exports.StartMonorepoBuildTask = StartMonorepoBuildTask;
|
package/lib/src/tasks/index.js
CHANGED
|
@@ -21,6 +21,8 @@ __exportStar(require("./CreateBranchTask"), exports);
|
|
|
21
21
|
__exportStar(require("./CreateMergeRequestTask"), exports);
|
|
22
22
|
__exportStar(require("./CreateReleaseNotesTask"), exports);
|
|
23
23
|
__exportStar(require("./InstallPackagesTask"), exports);
|
|
24
|
+
__exportStar(require("./StartConsumingProjectBuildsTask"), exports);
|
|
25
|
+
__exportStar(require("./StartMonorepoBuildTask"), exports);
|
|
24
26
|
__exportStar(require("./ValidateCommitsTask"), exports);
|
|
25
27
|
__exportStar(require("./ValidateDescriptionsTask"), exports);
|
|
26
28
|
__exportStar(require("./ValidateMergeRequestTask"), exports);
|
package/lib/src/types.js
CHANGED
|
@@ -3,12 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.COMMANDS = exports.TASKS = exports.SERVICES = exports.API_CLIENTS = exports.MISC = void 0;
|
|
4
4
|
exports.MISC = {
|
|
5
5
|
GitLabConfig: Symbol.for('GitLabConfig'),
|
|
6
|
+
TeamCityConfig: Symbol.for('TeamCityConfig')
|
|
6
7
|
};
|
|
7
8
|
exports.API_CLIENTS = {
|
|
8
9
|
GitLabApiClient: Symbol.for('GitLabApiClient'),
|
|
10
|
+
TeamCityApiClient: Symbol.for('TeamCityApiClient')
|
|
9
11
|
};
|
|
10
12
|
exports.SERVICES = {
|
|
11
13
|
GitLabService: Symbol.for('GitLabService'),
|
|
14
|
+
TeamCityService: Symbol.for('TeamCityService')
|
|
12
15
|
};
|
|
13
16
|
exports.TASKS = {
|
|
14
17
|
ValidateTask: Symbol.for('ValidateTask'),
|
|
@@ -22,6 +25,8 @@ exports.TASKS = {
|
|
|
22
25
|
InstallPackagesTask: Symbol.for('InstallPackagesTask'),
|
|
23
26
|
BumpPackagesTask: Symbol.for('BumpPackagesTask'),
|
|
24
27
|
CommitPackageVersionsTask: Symbol.for('CommitPackageVersionsTask'),
|
|
28
|
+
StartMonorepoBuildTask: Symbol.for('StartMonorepoBuildTask'),
|
|
29
|
+
StartConsumingProjectBuildsTask: Symbol.for('StartConsumingProjectBuildsTask'),
|
|
25
30
|
ValidateMergeRequestTask: Symbol.for('ValidateMergeRequestTask')
|
|
26
31
|
};
|
|
27
32
|
exports.COMMANDS = {
|
|
@@ -33,5 +38,6 @@ exports.COMMANDS = {
|
|
|
33
38
|
CreateReleaseNotesCommand: Symbol.for('CreateReleaseNotesCommand'),
|
|
34
39
|
InstallPackagesCommand: Symbol.for('InstallPackagesCommand'),
|
|
35
40
|
BumpPackagesCommand: Symbol.for('BumpPackagesCommand'),
|
|
41
|
+
StartConsumingProjectBuildsCommand: Symbol.for('StartConsumingProjectBuildsCommand'),
|
|
36
42
|
ValidateMergeRequestCommand: Symbol.for('ValidateMergeRequestCommand')
|
|
37
43
|
};
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BranchNames = void 0;
|
|
4
4
|
exports.BranchNames = {
|
|
5
5
|
getRelease: function (version) {
|
|
6
|
+
return 'release/9.9.9';
|
|
6
7
|
return "release/".concat(version);
|
|
7
8
|
},
|
|
8
9
|
getHotfix: function (version) {
|
|
10
|
+
return 'hotfix/9.9.9';
|
|
9
11
|
return "hotfix/".concat(version);
|
|
10
12
|
}
|
|
11
13
|
};
|
|
@@ -3,10 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ProjectIds = void 0;
|
|
6
|
+
exports.ProjectIds = exports.PROJECT_NAMES = void 0;
|
|
7
7
|
var lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
var errors_1 = require("../errors");
|
|
9
|
-
|
|
9
|
+
exports.PROJECT_NAMES = {
|
|
10
10
|
monorepo: '798',
|
|
11
11
|
online: '109',
|
|
12
12
|
curator: '62',
|
|
@@ -28,7 +28,7 @@ exports.ProjectIds = {
|
|
|
28
28
|
projectIds.push(project);
|
|
29
29
|
continue;
|
|
30
30
|
}
|
|
31
|
-
var mappedId = PROJECT_NAMES[project.toLowerCase()];
|
|
31
|
+
var mappedId = exports.PROJECT_NAMES[project.toLowerCase()];
|
|
32
32
|
if (!mappedId)
|
|
33
33
|
throw new errors_1.ShipItError("Could not find project id mapping for ".concat(project));
|
|
34
34
|
projectIds.push(mappedId);
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clickview/ship-it",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4-dev.0",
|
|
4
4
|
"description": "Release Manager",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"ship-it": "./lib/src/index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"start": "npm run lint && ts-node src/index.ts",
|
|
10
|
+
"start": "npm run lint && ts-node --files src/index.ts",
|
|
11
11
|
"build": "npm run lint && tsc -p . && tsc-alias -p tsconfig.json",
|
|
12
12
|
"lint": "eslint . --ext .ts"
|
|
13
13
|
},
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"inversify": "6.0.1",
|
|
26
26
|
"lodash": "4.17.21",
|
|
27
27
|
"reflect-metadata": "0.1.13",
|
|
28
|
-
"semver": "7.3.5"
|
|
28
|
+
"semver": "7.3.5",
|
|
29
|
+
"teamcity-rest-api": "0.0.8"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@clickview/eslint-config": "1.0.3",
|