@teams-max/mwsp 2.0.8 → 2.0.9
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/es/utils/index.js +57 -43
- package/lib/utils/index.js +48 -28
- package/package.json +1 -1
package/es/utils/index.js
CHANGED
|
@@ -86,13 +86,12 @@ function _addIntegrateDeps() {
|
|
|
86
86
|
_context.next = 6;
|
|
87
87
|
break;
|
|
88
88
|
}
|
|
89
|
-
logStep(
|
|
89
|
+
logStep('No integration packages are required.');
|
|
90
90
|
return _context.abrupt("return");
|
|
91
91
|
case 6:
|
|
92
|
-
;
|
|
93
92
|
dependencies = {};
|
|
94
93
|
devDependencies = {};
|
|
95
|
-
_context.prev =
|
|
94
|
+
_context.prev = 8;
|
|
96
95
|
asgDependencies = require(join(ASG_DIR, 'base', 'integrationDeps.js')) || {};
|
|
97
96
|
dependencies = integration.reduce(function (acc, item) {
|
|
98
97
|
var _asgDependencies$item;
|
|
@@ -102,63 +101,63 @@ function _addIntegrateDeps() {
|
|
|
102
101
|
var _asgDependencies$item2;
|
|
103
102
|
return _objectSpread(_objectSpread({}, acc), ((_asgDependencies$item2 = asgDependencies[item]) === null || _asgDependencies$item2 === void 0 ? void 0 : _asgDependencies$item2.devDependencies) || {});
|
|
104
103
|
}, {});
|
|
105
|
-
_context.next =
|
|
104
|
+
_context.next = 18;
|
|
106
105
|
break;
|
|
107
|
-
case
|
|
108
|
-
_context.prev =
|
|
109
|
-
_context.t0 = _context["catch"](
|
|
106
|
+
case 14:
|
|
107
|
+
_context.prev = 14;
|
|
108
|
+
_context.t0 = _context["catch"](8);
|
|
110
109
|
printErrorAndExit('The Asgard directory does not exist.', "Reason: ".concat(_context.t0.message));
|
|
111
110
|
return _context.abrupt("return");
|
|
112
|
-
case
|
|
111
|
+
case 18:
|
|
113
112
|
asgDeps = pickDependencies(dependencies);
|
|
114
113
|
asgDevDeps = pickDependencies(devDependencies, true);
|
|
115
|
-
if (!((infra == null ? void 0 : infra.arch) ===
|
|
116
|
-
_context.next =
|
|
114
|
+
if (!((infra == null ? void 0 : infra.arch) === 'PRO')) {
|
|
115
|
+
_context.next = 31;
|
|
117
116
|
break;
|
|
118
117
|
}
|
|
119
118
|
_context.t1 = !!asgDeps.length;
|
|
120
119
|
if (!_context.t1) {
|
|
121
|
-
_context.next =
|
|
120
|
+
_context.next = 25;
|
|
122
121
|
break;
|
|
123
122
|
}
|
|
124
|
-
_context.next =
|
|
125
|
-
return exec(
|
|
126
|
-
case
|
|
123
|
+
_context.next = 25;
|
|
124
|
+
return exec('yarn', ['add'].concat(_toConsumableArray(asgDeps)));
|
|
125
|
+
case 25:
|
|
127
126
|
_context.t2 = !!asgDevDeps.length;
|
|
128
127
|
if (!_context.t2) {
|
|
129
|
-
_context.next =
|
|
128
|
+
_context.next = 29;
|
|
130
129
|
break;
|
|
131
130
|
}
|
|
132
|
-
_context.next =
|
|
133
|
-
return exec(
|
|
134
|
-
case
|
|
135
|
-
_context.next =
|
|
131
|
+
_context.next = 29;
|
|
132
|
+
return exec('yarn', ['add'].concat(_toConsumableArray(asgDevDeps), ['-D']));
|
|
133
|
+
case 29:
|
|
134
|
+
_context.next = 40;
|
|
136
135
|
break;
|
|
137
|
-
case
|
|
138
|
-
if (!((infra == null ? void 0 : infra.arch) ===
|
|
139
|
-
_context.next =
|
|
136
|
+
case 31:
|
|
137
|
+
if (!((infra == null ? void 0 : infra.arch) === 'MAX')) {
|
|
138
|
+
_context.next = 40;
|
|
140
139
|
break;
|
|
141
140
|
}
|
|
142
141
|
_context.t3 = !!asgDeps.length;
|
|
143
142
|
if (!_context.t3) {
|
|
144
|
-
_context.next =
|
|
143
|
+
_context.next = 36;
|
|
145
144
|
break;
|
|
146
145
|
}
|
|
147
|
-
_context.next =
|
|
148
|
-
return exec(
|
|
149
|
-
case
|
|
146
|
+
_context.next = 36;
|
|
147
|
+
return exec('pnpm', ['add'].concat(_toConsumableArray(asgDeps)));
|
|
148
|
+
case 36:
|
|
150
149
|
_context.t4 = !!asgDevDeps.length;
|
|
151
150
|
if (!_context.t4) {
|
|
152
|
-
_context.next =
|
|
151
|
+
_context.next = 40;
|
|
153
152
|
break;
|
|
154
153
|
}
|
|
155
|
-
_context.next =
|
|
156
|
-
return exec(
|
|
157
|
-
case
|
|
154
|
+
_context.next = 40;
|
|
155
|
+
return exec('pnpm', ['add'].concat(_toConsumableArray(asgDevDeps), ['-D']));
|
|
156
|
+
case 40:
|
|
158
157
|
case "end":
|
|
159
158
|
return _context.stop();
|
|
160
159
|
}
|
|
161
|
-
}, _callee, null, [[
|
|
160
|
+
}, _callee, null, [[8, 14]]);
|
|
162
161
|
}));
|
|
163
162
|
return _addIntegrateDeps.apply(this, arguments);
|
|
164
163
|
}
|
|
@@ -239,23 +238,29 @@ function _addAsgDependencies() {
|
|
|
239
238
|
return _addAsgDependencies.apply(this, arguments);
|
|
240
239
|
}
|
|
241
240
|
function getCfg() {
|
|
241
|
+
var args = yParser(process.argv.slice(2));
|
|
242
|
+
var JENKINS_BUILD = args.jenkinsBuild || args.JENKINSBUILD || args.jenkins_build || args.JENKINS_BUILD;
|
|
242
243
|
var pkgs = require(join(cwd, 'package.json'));
|
|
243
244
|
var _pkgs$infra = pkgs.infra,
|
|
244
245
|
infra = _pkgs$infra === void 0 ? {} : _pkgs$infra,
|
|
245
246
|
appKey = pkgs.appKey;
|
|
246
|
-
|
|
247
|
+
var projectUrl = '';
|
|
248
|
+
if (JENKINS_BUILD) {
|
|
249
|
+
projectUrl = infra.ssh || infra.url;
|
|
250
|
+
} else {
|
|
251
|
+
projectUrl = infra.http || infra.url;
|
|
252
|
+
}
|
|
253
|
+
if (!projectUrl || !appKey) {
|
|
247
254
|
printErrorAndExit('Please check the infra and appKey in package.json.');
|
|
248
255
|
}
|
|
249
|
-
var args = yParser(process.argv.slice(2));
|
|
250
|
-
var JENKINS_BUILD = args.jenkinsBuild || args.JENKINSBUILD || args.jenkins_build || args.JENKINS_BUILD;
|
|
251
256
|
var APP_ENV = args.env || args.ENV || '';
|
|
252
257
|
var ASG_BRANCH = args.asg_branch || args.ASG_BRANCH || '';
|
|
253
258
|
var RESOURCE_URL = '';
|
|
254
259
|
var SUB_APP = '';
|
|
255
260
|
var archStr = 'unknown';
|
|
256
|
-
if (
|
|
261
|
+
if (projectUrl.includes('teams-pro')) {
|
|
257
262
|
archStr = 'PRO';
|
|
258
|
-
} else if (
|
|
263
|
+
} else if (projectUrl.includes('teams-max')) {
|
|
259
264
|
archStr = 'MAX';
|
|
260
265
|
RESOURCE_URL = args.versionUrl || args.RESOURCE_URL || '';
|
|
261
266
|
SUB_APP = args.subApp || args.SUB_APP || '';
|
|
@@ -263,7 +268,7 @@ function getCfg() {
|
|
|
263
268
|
return {
|
|
264
269
|
appKey: appKey,
|
|
265
270
|
infra: {
|
|
266
|
-
url:
|
|
271
|
+
url: projectUrl,
|
|
267
272
|
arch: archStr
|
|
268
273
|
},
|
|
269
274
|
ASG_DIR: asgDir,
|
|
@@ -295,7 +300,7 @@ function fetchRemoteRepository() {
|
|
|
295
300
|
}
|
|
296
301
|
function _fetchRemoteRepository() {
|
|
297
302
|
_fetchRemoteRepository = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
298
|
-
var cfg, infra, directory, ASG_BRANCH, JENKINS_BUILD, remoteUrl, doesExist, _yield$
|
|
303
|
+
var cfg, infra, directory, ASG_BRANCH, JENKINS_BUILD, remoteUrl, doesExist, timer, _yield$Promise$race, syncUp, infraBranchsOutput, infraBranchArray, filteredBranches, defaultBrancheIdx, questions;
|
|
299
304
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
300
305
|
while (1) switch (_context3.prev = _context3.next) {
|
|
301
306
|
case 0:
|
|
@@ -330,15 +335,24 @@ function _fetchRemoteRepository() {
|
|
|
330
335
|
break;
|
|
331
336
|
}
|
|
332
337
|
_context3.next = 22;
|
|
333
|
-
return inquirer.prompt([{
|
|
338
|
+
return Promise.race([inquirer.prompt([{
|
|
334
339
|
type: 'confirm',
|
|
335
340
|
name: 'syncUp',
|
|
336
|
-
message: '同步远端仓库',
|
|
341
|
+
message: '同步远端仓库(5s后跳过同步)',
|
|
337
342
|
default: 'Y'
|
|
338
|
-
}])
|
|
343
|
+
}]).then(function (answer) {
|
|
344
|
+
timer && clearTimeout(timer);
|
|
345
|
+
return answer;
|
|
346
|
+
}), new Promise(function (resolve) {
|
|
347
|
+
timer = setTimeout(function () {
|
|
348
|
+
return resolve({
|
|
349
|
+
syncUp: false
|
|
350
|
+
});
|
|
351
|
+
}, 5e3);
|
|
352
|
+
})]);
|
|
339
353
|
case 22:
|
|
340
|
-
_yield$
|
|
341
|
-
syncUp = _yield$
|
|
354
|
+
_yield$Promise$race = _context3.sent;
|
|
355
|
+
syncUp = _yield$Promise$race.syncUp;
|
|
342
356
|
if (syncUp) {
|
|
343
357
|
_context3.next = 26;
|
|
344
358
|
break;
|
package/lib/utils/index.js
CHANGED
|
@@ -43,25 +43,30 @@ async function addIntegrateDeps(cfg) {
|
|
|
43
43
|
logStep("No integration packages are required.");
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
;
|
|
47
46
|
let dependencies = {};
|
|
48
47
|
let devDependencies = {};
|
|
49
48
|
try {
|
|
50
49
|
const asgDependencies = require(join(ASG_DIR, "base", "integrationDeps.js")) || {};
|
|
51
|
-
dependencies = integration.reduce(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
50
|
+
dependencies = integration.reduce(
|
|
51
|
+
(acc, item) => {
|
|
52
|
+
var _a;
|
|
53
|
+
return {
|
|
54
|
+
...acc,
|
|
55
|
+
...((_a = asgDependencies[item]) == null ? void 0 : _a.dependencies) || {}
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
{}
|
|
59
|
+
);
|
|
60
|
+
devDependencies = integration.reduce(
|
|
61
|
+
(acc, item) => {
|
|
62
|
+
var _a;
|
|
63
|
+
return {
|
|
64
|
+
...acc,
|
|
65
|
+
...((_a = asgDependencies[item]) == null ? void 0 : _a.devDependencies) || {}
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
{}
|
|
69
|
+
);
|
|
65
70
|
} catch (error) {
|
|
66
71
|
printErrorAndExit(
|
|
67
72
|
"The Asgard directory does not exist.",
|
|
@@ -105,21 +110,27 @@ async function addAsgDependencies(cfg) {
|
|
|
105
110
|
}
|
|
106
111
|
}
|
|
107
112
|
function getCfg() {
|
|
113
|
+
const args = yParser(process.argv.slice(2));
|
|
114
|
+
const JENKINS_BUILD = args.jenkinsBuild || args.JENKINSBUILD || args.jenkins_build || args.JENKINS_BUILD;
|
|
108
115
|
const pkgs = require(join(cwd, "package.json"));
|
|
109
116
|
const { infra = {}, appKey } = pkgs;
|
|
110
|
-
|
|
117
|
+
let projectUrl = "";
|
|
118
|
+
if (JENKINS_BUILD) {
|
|
119
|
+
projectUrl = infra.ssh || infra.url;
|
|
120
|
+
} else {
|
|
121
|
+
projectUrl = infra.http || infra.url;
|
|
122
|
+
}
|
|
123
|
+
if (!projectUrl || !appKey) {
|
|
111
124
|
printErrorAndExit("Please check the infra and appKey in package.json.");
|
|
112
125
|
}
|
|
113
|
-
const args = yParser(process.argv.slice(2));
|
|
114
|
-
const JENKINS_BUILD = args.jenkinsBuild || args.JENKINSBUILD || args.jenkins_build || args.JENKINS_BUILD;
|
|
115
126
|
const APP_ENV = args.env || args.ENV || "";
|
|
116
127
|
const ASG_BRANCH = args.asg_branch || args.ASG_BRANCH || "";
|
|
117
128
|
let RESOURCE_URL = "";
|
|
118
129
|
let SUB_APP = "";
|
|
119
130
|
let archStr = "unknown";
|
|
120
|
-
if (
|
|
131
|
+
if (projectUrl.includes("teams-pro")) {
|
|
121
132
|
archStr = "PRO";
|
|
122
|
-
} else if (
|
|
133
|
+
} else if (projectUrl.includes("teams-max")) {
|
|
123
134
|
archStr = "MAX";
|
|
124
135
|
RESOURCE_URL = args.versionUrl || args.RESOURCE_URL || "";
|
|
125
136
|
SUB_APP = args.subApp || args.SUB_APP || "";
|
|
@@ -127,7 +138,7 @@ function getCfg() {
|
|
|
127
138
|
return {
|
|
128
139
|
appKey,
|
|
129
140
|
infra: {
|
|
130
|
-
url:
|
|
141
|
+
url: projectUrl,
|
|
131
142
|
arch: archStr
|
|
132
143
|
},
|
|
133
144
|
ASG_DIR: asgDir,
|
|
@@ -167,13 +178,22 @@ async function fetchRemoteRepository() {
|
|
|
167
178
|
return;
|
|
168
179
|
} else {
|
|
169
180
|
if (!JENKINS_BUILD) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
181
|
+
let timer;
|
|
182
|
+
const { syncUp } = await Promise.race([
|
|
183
|
+
inquirer.prompt([
|
|
184
|
+
{
|
|
185
|
+
type: "confirm",
|
|
186
|
+
name: "syncUp",
|
|
187
|
+
message: "\u540C\u6B65\u8FDC\u7AEF\u4ED3\u5E93(5s\u540E\u8DF3\u8FC7\u540C\u6B65)",
|
|
188
|
+
default: "Y"
|
|
189
|
+
}
|
|
190
|
+
]).then((answer) => {
|
|
191
|
+
timer && clearTimeout(timer);
|
|
192
|
+
return answer;
|
|
193
|
+
}),
|
|
194
|
+
new Promise((resolve) => {
|
|
195
|
+
timer = setTimeout(() => resolve({ syncUp: false }), 5e3);
|
|
196
|
+
})
|
|
177
197
|
]);
|
|
178
198
|
if (!syncUp)
|
|
179
199
|
return;
|