@clickview/ship-it 0.0.15 → 0.0.16
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.
|
@@ -81,9 +81,9 @@ var InstallPackagesTask = /** @class */ (function () {
|
|
|
81
81
|
}
|
|
82
82
|
InstallPackagesTask.prototype.run = function (_options) {
|
|
83
83
|
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
-
var milestone, options, projects, monorepo, consumingProjects, _a, monorepoBranch, monorepoBranchName, versions, _i, consumingProjects_1, project, _b, branch, branchName, hasUpdates;
|
|
85
|
-
return __generator(this, function (
|
|
86
|
-
switch (
|
|
84
|
+
var milestone, options, projects, monorepo, consumingProjects, _a, monorepoBranch, monorepoBranchName, versions, _i, consumingProjects_1, project, _b, branch, branchName, hasUpdates, _c;
|
|
85
|
+
return __generator(this, function (_d) {
|
|
86
|
+
switch (_d.label) {
|
|
87
87
|
case 0:
|
|
88
88
|
utils_1.Logger.logTask('Installing npm packages');
|
|
89
89
|
if (!_options.monorepoBranchName && !_options.milestone) {
|
|
@@ -95,8 +95,8 @@ var InstallPackagesTask = /** @class */ (function () {
|
|
|
95
95
|
utils_1.Logger.logInfo("Searching for a merge request in project \"monorepo\" with branch name \"".concat(_options.monorepoBranchName, "\"..."));
|
|
96
96
|
return [4 /*yield*/, this.service.getMilestoneByBranchName(utils_1.ProjectIds.MONOREPO_PROJECT_ID, _options.monorepoBranchName)];
|
|
97
97
|
case 1:
|
|
98
|
-
milestone =
|
|
99
|
-
|
|
98
|
+
milestone = _d.sent();
|
|
99
|
+
_d.label = 2;
|
|
100
100
|
case 2:
|
|
101
101
|
if (!milestone)
|
|
102
102
|
return [2 /*return*/, false];
|
|
@@ -109,7 +109,7 @@ var InstallPackagesTask = /** @class */ (function () {
|
|
|
109
109
|
};
|
|
110
110
|
return [4 /*yield*/, this.service.getProjects(options)];
|
|
111
111
|
case 3:
|
|
112
|
-
projects =
|
|
112
|
+
projects = _d.sent();
|
|
113
113
|
monorepo = projects.find(function (p) { return p.id.toString() === utils_1.ProjectIds.MONOREPO_PROJECT_ID; });
|
|
114
114
|
consumingProjects = projects.filter(function (p) { return p.id.toString() !== utils_1.ProjectIds.MONOREPO_PROJECT_ID; });
|
|
115
115
|
if (!monorepo) {
|
|
@@ -122,40 +122,43 @@ var InstallPackagesTask = /** @class */ (function () {
|
|
|
122
122
|
}
|
|
123
123
|
return [4 /*yield*/, this.service.getNextBranchInfo(monorepo.id, options.version)];
|
|
124
124
|
case 4:
|
|
125
|
-
_a =
|
|
125
|
+
_a = _d.sent(), monorepoBranch = _a.branch, monorepoBranchName = _a.branchName;
|
|
126
126
|
if (!monorepoBranch) {
|
|
127
127
|
utils_1.Logger.logError("[".concat(monorepo.title, "]: [").concat(monorepoBranchName, "] branch does not exist"));
|
|
128
128
|
return [2 /*return*/, false];
|
|
129
129
|
}
|
|
130
130
|
return [4 /*yield*/, this.getPackageVersions(monorepoBranchName)];
|
|
131
131
|
case 5:
|
|
132
|
-
versions =
|
|
132
|
+
versions = _d.sent();
|
|
133
133
|
utils_1.Logger.logMessage("Versions identified for ".concat(monorepoBranchName));
|
|
134
134
|
Object.keys(versions).forEach(function (key) {
|
|
135
135
|
utils_1.Logger.logMessage("- [".concat(key, "]: ").concat(versions[key]));
|
|
136
136
|
});
|
|
137
137
|
utils_1.Logger.logMessage('\nInstalling packages:\n');
|
|
138
138
|
_i = 0, consumingProjects_1 = consumingProjects;
|
|
139
|
-
|
|
139
|
+
_d.label = 6;
|
|
140
140
|
case 6:
|
|
141
|
-
if (!(_i < consumingProjects_1.length)) return [3 /*break*/,
|
|
141
|
+
if (!(_i < consumingProjects_1.length)) return [3 /*break*/, 13];
|
|
142
142
|
project = consumingProjects_1[_i];
|
|
143
|
-
|
|
143
|
+
_d.label = 7;
|
|
144
144
|
case 7:
|
|
145
|
-
|
|
145
|
+
_d.trys.push([7, 11, , 12]);
|
|
146
|
+
return [4 /*yield*/, this.service.getNextBranchInfo(project.id, options.version)];
|
|
147
|
+
case 8:
|
|
148
|
+
_b = _d.sent(), branch = _b.branch, branchName = _b.branchName;
|
|
146
149
|
if (!branch) {
|
|
147
150
|
utils_1.Logger.logError("[".concat(project.title, "]: [").concat(branchName, "] does not exist"));
|
|
148
|
-
return [3 /*break*/,
|
|
151
|
+
return [3 /*break*/, 12];
|
|
149
152
|
}
|
|
150
153
|
return [4 /*yield*/, this.updateAndSavePackageFiles(project, options.milestone, branchName, versions)];
|
|
151
|
-
case
|
|
152
|
-
hasUpdates =
|
|
154
|
+
case 9:
|
|
155
|
+
hasUpdates = _d.sent();
|
|
153
156
|
/**
|
|
154
157
|
* If there are no changes to the versions, we're done here
|
|
155
158
|
*/
|
|
156
159
|
if (!hasUpdates) {
|
|
157
160
|
utils_1.Logger.logWarning("[".concat(project.title, "]: [").concat(branchName, "] does not require any updates"));
|
|
158
|
-
return [3 /*break*/,
|
|
161
|
+
return [3 /*break*/, 12];
|
|
159
162
|
}
|
|
160
163
|
/**
|
|
161
164
|
* Run npm i to update our package log file
|
|
@@ -167,17 +170,21 @@ var InstallPackagesTask = /** @class */ (function () {
|
|
|
167
170
|
* Commit our updated package.json and package-lock.json
|
|
168
171
|
*/
|
|
169
172
|
return [4 /*yield*/, this.commitUpdatedFiles(project, options.milestone, branchName)];
|
|
170
|
-
case
|
|
173
|
+
case 10:
|
|
171
174
|
/**
|
|
172
175
|
* Commit our updated package.json and package-lock.json
|
|
173
176
|
*/
|
|
174
|
-
|
|
177
|
+
_d.sent();
|
|
175
178
|
utils_1.Logger.logMessage("[".concat(project.title, "]: File changes committed"));
|
|
176
|
-
|
|
177
|
-
case
|
|
179
|
+
return [3 /*break*/, 12];
|
|
180
|
+
case 11:
|
|
181
|
+
_c = _d.sent();
|
|
182
|
+
utils_1.Logger.logError("[".concat(project.title, "]: Something went wrong while attempting to install packages. Please manually check if this project should have any monorepo packages installed."));
|
|
183
|
+
return [3 /*break*/, 12];
|
|
184
|
+
case 12:
|
|
178
185
|
_i++;
|
|
179
186
|
return [3 /*break*/, 6];
|
|
180
|
-
case
|
|
187
|
+
case 13: return [2 /*return*/, true];
|
|
181
188
|
}
|
|
182
189
|
});
|
|
183
190
|
});
|