@teams-max/mwsp 2.0.12 → 3.0.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/es/utils/defineConfig.js +5 -3
- package/es/utils/index.js +84 -53
- package/lib/utils/defineConfig.js +4 -2
- package/lib/utils/index.js +49 -37
- package/package.json +1 -1
package/es/utils/defineConfig.js
CHANGED
|
@@ -5,7 +5,8 @@ var _require = require("./index"),
|
|
|
5
5
|
getCfg = _require.getCfg;
|
|
6
6
|
function defineConfig(config) {
|
|
7
7
|
var cfg = getCfg();
|
|
8
|
-
var
|
|
8
|
+
var infra = cfg.infra,
|
|
9
|
+
ASG_DIR = cfg.ASG_DIR;
|
|
9
10
|
var nextAsgEnv = process.env.ASG_DIR || ASG_DIR;
|
|
10
11
|
if (!process.env.ASG_DIR) {
|
|
11
12
|
logStep('Process ASG_DIR not set, and use scoped environment');
|
|
@@ -14,11 +15,12 @@ function defineConfig(config) {
|
|
|
14
15
|
logStep('The Asgard directory does not exist, using default config...');
|
|
15
16
|
return config;
|
|
16
17
|
}
|
|
18
|
+
var archDir = infra.arch === 'PRO' ? 'pro' : 'max';
|
|
17
19
|
var iConfigFromPlugins = null;
|
|
18
20
|
try {
|
|
19
|
-
iConfigFromPlugins = require(path.join(nextAsgEnv, 'base', 'pluginConfig.js'));
|
|
21
|
+
iConfigFromPlugins = require(path.join(nextAsgEnv, archDir, 'base', 'pluginConfig.js'));
|
|
20
22
|
} catch (error) {
|
|
21
|
-
printErrorAndExit(
|
|
23
|
+
printErrorAndExit("Failed to load ".concat(archDir, "/base/pluginConfig.js"), "Reason: ".concat(error.message));
|
|
22
24
|
return;
|
|
23
25
|
}
|
|
24
26
|
logStep('The Asgard directory exists, using config from plugins...');
|
package/es/utils/index.js
CHANGED
|
@@ -69,30 +69,42 @@ function pickDependencies(dependencies, isDev) {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
// 安装可选集成模块依赖(切换分支后按需调用)
|
|
73
|
+
// 项目 package.json 声明 "integration": ["snx-editor"] 才会执行
|
|
74
|
+
// 路径:{ASG_DIR}/{arch}/base/integrationDeps.js,PRO 端无此文件时静默跳过
|
|
73
75
|
function addIntegrateDeps(_x2) {
|
|
74
76
|
return _addIntegrateDeps.apply(this, arguments);
|
|
75
|
-
}
|
|
77
|
+
} // 安装基座必装依赖(首次 clone 后调用)
|
|
78
|
+
// 路径:{ASG_DIR}/{arch}/base/dependencies.js
|
|
76
79
|
function _addIntegrateDeps() {
|
|
77
80
|
_addIntegrateDeps = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(cfg) {
|
|
78
|
-
var infra, ASG_DIR, pkgs, integration, dependencies, devDependencies,
|
|
81
|
+
var infra, ASG_DIR, archDir, pkgs, integration, asgDependencies, dependencies, devDependencies, asgDeps, asgDevDeps;
|
|
79
82
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
80
83
|
while (1) switch (_context.prev = _context.next) {
|
|
81
84
|
case 0:
|
|
82
85
|
infra = cfg.infra, ASG_DIR = cfg.ASG_DIR;
|
|
86
|
+
archDir = infra.arch === 'PRO' ? 'pro' : 'max';
|
|
83
87
|
pkgs = require(join(cwd, 'package.json'));
|
|
84
88
|
integration = pkgs.integration || [];
|
|
85
89
|
if (integration.length) {
|
|
86
|
-
_context.next =
|
|
90
|
+
_context.next = 7;
|
|
87
91
|
break;
|
|
88
92
|
}
|
|
89
93
|
logStep('No integration packages are required.');
|
|
90
94
|
return _context.abrupt("return");
|
|
91
|
-
case
|
|
92
|
-
|
|
93
|
-
devDependencies = {};
|
|
95
|
+
case 7:
|
|
96
|
+
asgDependencies = {};
|
|
94
97
|
_context.prev = 8;
|
|
95
|
-
asgDependencies = require(join(ASG_DIR, 'base', 'integrationDeps.js')) || {};
|
|
98
|
+
asgDependencies = require(join(ASG_DIR, archDir, 'base', 'integrationDeps.js')) || {};
|
|
99
|
+
_context.next = 16;
|
|
100
|
+
break;
|
|
101
|
+
case 12:
|
|
102
|
+
_context.prev = 12;
|
|
103
|
+
_context.t0 = _context["catch"](8);
|
|
104
|
+
// integrationDeps.js 不存在时(如 PRO 端)静默跳过,不中断流程
|
|
105
|
+
logStep('No integrationDeps.js found, skipping integration deps.');
|
|
106
|
+
return _context.abrupt("return");
|
|
107
|
+
case 16:
|
|
96
108
|
dependencies = integration.reduce(function (acc, item) {
|
|
97
109
|
var _asgDependencies$item;
|
|
98
110
|
return _objectSpread(_objectSpread({}, acc), ((_asgDependencies$item = asgDependencies[item]) === null || _asgDependencies$item === void 0 ? void 0 : _asgDependencies$item.dependencies) || {});
|
|
@@ -101,17 +113,9 @@ function _addIntegrateDeps() {
|
|
|
101
113
|
var _asgDependencies$item2;
|
|
102
114
|
return _objectSpread(_objectSpread({}, acc), ((_asgDependencies$item2 = asgDependencies[item]) === null || _asgDependencies$item2 === void 0 ? void 0 : _asgDependencies$item2.devDependencies) || {});
|
|
103
115
|
}, {});
|
|
104
|
-
_context.next = 18;
|
|
105
|
-
break;
|
|
106
|
-
case 14:
|
|
107
|
-
_context.prev = 14;
|
|
108
|
-
_context.t0 = _context["catch"](8);
|
|
109
|
-
printErrorAndExit('The Asgard directory does not exist.', "Reason: ".concat(_context.t0.message));
|
|
110
|
-
return _context.abrupt("return");
|
|
111
|
-
case 18:
|
|
112
116
|
asgDeps = pickDependencies(dependencies);
|
|
113
117
|
asgDevDeps = pickDependencies(devDependencies, true);
|
|
114
|
-
if (!((infra
|
|
118
|
+
if (!((infra === null || infra === void 0 ? void 0 : infra.arch) === 'PRO')) {
|
|
115
119
|
_context.next = 31;
|
|
116
120
|
break;
|
|
117
121
|
}
|
|
@@ -134,7 +138,7 @@ function _addIntegrateDeps() {
|
|
|
134
138
|
_context.next = 40;
|
|
135
139
|
break;
|
|
136
140
|
case 31:
|
|
137
|
-
if (!((infra
|
|
141
|
+
if (!((infra === null || infra === void 0 ? void 0 : infra.arch) === 'MAX')) {
|
|
138
142
|
_context.next = 40;
|
|
139
143
|
break;
|
|
140
144
|
}
|
|
@@ -157,7 +161,7 @@ function _addIntegrateDeps() {
|
|
|
157
161
|
case "end":
|
|
158
162
|
return _context.stop();
|
|
159
163
|
}
|
|
160
|
-
}, _callee, null, [[8,
|
|
164
|
+
}, _callee, null, [[8, 12]]);
|
|
161
165
|
}));
|
|
162
166
|
return _addIntegrateDeps.apply(this, arguments);
|
|
163
167
|
}
|
|
@@ -166,74 +170,75 @@ function addAsgDependencies(_x3) {
|
|
|
166
170
|
} //获取允许的环境变量参数
|
|
167
171
|
function _addAsgDependencies() {
|
|
168
172
|
_addAsgDependencies = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(cfg) {
|
|
169
|
-
var infra, ASG_DIR, dependencies, devDependencies, asgDependencies, asgDeps, asgDevDeps;
|
|
173
|
+
var infra, ASG_DIR, archDir, dependencies, devDependencies, asgDependencies, asgDeps, asgDevDeps;
|
|
170
174
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
171
175
|
while (1) switch (_context2.prev = _context2.next) {
|
|
172
176
|
case 0:
|
|
173
177
|
infra = cfg.infra, ASG_DIR = cfg.ASG_DIR;
|
|
178
|
+
archDir = infra.arch === 'PRO' ? 'pro' : 'max';
|
|
174
179
|
dependencies = {};
|
|
175
180
|
devDependencies = {};
|
|
176
|
-
_context2.prev =
|
|
177
|
-
asgDependencies = require(join(ASG_DIR, 'base', 'dependencies.js')) || {};
|
|
181
|
+
_context2.prev = 4;
|
|
182
|
+
asgDependencies = require(join(ASG_DIR, archDir, 'base', 'dependencies.js')) || {};
|
|
178
183
|
dependencies = asgDependencies.dependencies || {};
|
|
179
184
|
devDependencies = asgDependencies.devDependencies || {};
|
|
180
|
-
_context2.next =
|
|
185
|
+
_context2.next = 14;
|
|
181
186
|
break;
|
|
182
|
-
case
|
|
183
|
-
_context2.prev =
|
|
184
|
-
_context2.t0 = _context2["catch"](
|
|
185
|
-
printErrorAndExit(
|
|
187
|
+
case 10:
|
|
188
|
+
_context2.prev = 10;
|
|
189
|
+
_context2.t0 = _context2["catch"](4);
|
|
190
|
+
printErrorAndExit("Failed to load ".concat(archDir, "/base/dependencies.js"), "Reason: ".concat(_context2.t0.message));
|
|
186
191
|
return _context2.abrupt("return");
|
|
187
|
-
case
|
|
192
|
+
case 14:
|
|
188
193
|
asgDeps = pickDependencies(dependencies);
|
|
189
194
|
asgDevDeps = pickDependencies(devDependencies, true);
|
|
190
195
|
if (!((infra === null || infra === void 0 ? void 0 : infra.arch) === 'PRO')) {
|
|
191
|
-
_context2.next =
|
|
196
|
+
_context2.next = 27;
|
|
192
197
|
break;
|
|
193
198
|
}
|
|
194
199
|
_context2.t1 = !!asgDeps.length;
|
|
195
200
|
if (!_context2.t1) {
|
|
196
|
-
_context2.next =
|
|
201
|
+
_context2.next = 21;
|
|
197
202
|
break;
|
|
198
203
|
}
|
|
199
|
-
_context2.next =
|
|
204
|
+
_context2.next = 21;
|
|
200
205
|
return exec('yarn', ['add'].concat(_toConsumableArray(asgDeps)));
|
|
201
|
-
case
|
|
206
|
+
case 21:
|
|
202
207
|
_context2.t2 = !!asgDevDeps.length;
|
|
203
208
|
if (!_context2.t2) {
|
|
204
|
-
_context2.next =
|
|
209
|
+
_context2.next = 25;
|
|
205
210
|
break;
|
|
206
211
|
}
|
|
207
|
-
_context2.next =
|
|
212
|
+
_context2.next = 25;
|
|
208
213
|
return exec('yarn', ['add'].concat(_toConsumableArray(asgDevDeps), ['-D']));
|
|
209
|
-
case
|
|
210
|
-
_context2.next =
|
|
214
|
+
case 25:
|
|
215
|
+
_context2.next = 36;
|
|
211
216
|
break;
|
|
212
|
-
case
|
|
217
|
+
case 27:
|
|
213
218
|
if (!((infra === null || infra === void 0 ? void 0 : infra.arch) === 'MAX')) {
|
|
214
|
-
_context2.next =
|
|
219
|
+
_context2.next = 36;
|
|
215
220
|
break;
|
|
216
221
|
}
|
|
217
222
|
_context2.t3 = !!asgDeps.length;
|
|
218
223
|
if (!_context2.t3) {
|
|
219
|
-
_context2.next =
|
|
224
|
+
_context2.next = 32;
|
|
220
225
|
break;
|
|
221
226
|
}
|
|
222
|
-
_context2.next =
|
|
227
|
+
_context2.next = 32;
|
|
223
228
|
return exec('pnpm', ['add'].concat(_toConsumableArray(asgDeps)));
|
|
224
|
-
case
|
|
229
|
+
case 32:
|
|
225
230
|
_context2.t4 = !!asgDevDeps.length;
|
|
226
231
|
if (!_context2.t4) {
|
|
227
|
-
_context2.next =
|
|
232
|
+
_context2.next = 36;
|
|
228
233
|
break;
|
|
229
234
|
}
|
|
230
|
-
_context2.next =
|
|
235
|
+
_context2.next = 36;
|
|
231
236
|
return exec('pnpm', ['add'].concat(_toConsumableArray(asgDevDeps), ['-D']));
|
|
232
|
-
case
|
|
237
|
+
case 36:
|
|
233
238
|
case "end":
|
|
234
239
|
return _context2.stop();
|
|
235
240
|
}
|
|
236
|
-
}, _callee2, null, [[
|
|
241
|
+
}, _callee2, null, [[4, 10]]);
|
|
237
242
|
}));
|
|
238
243
|
return _addAsgDependencies.apply(this, arguments);
|
|
239
244
|
}
|
|
@@ -255,6 +260,34 @@ function getAllowEnvParams() {
|
|
|
255
260
|
});
|
|
256
261
|
return filteredParams;
|
|
257
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* 检测当前项目的架构类型,按优先级依次判断:
|
|
265
|
+
* 1. package.json infra.arch 显式声明('PRO' | 'MAX')—— 最高优先级
|
|
266
|
+
* 2. npm_config_user_agent 运行时环境变量 —— 反映实际调用的包管理器
|
|
267
|
+
* pnpm → MAX,yarn → PRO
|
|
268
|
+
* 3. 锁文件兜底(pnpm-lock.yaml → MAX,yarn.lock → PRO)
|
|
269
|
+
*/
|
|
270
|
+
function detectArch(infra) {
|
|
271
|
+
var explicitArch = (infra.arch || '').toUpperCase();
|
|
272
|
+
if (explicitArch === 'PRO' || explicitArch === 'MAX') {
|
|
273
|
+
return explicitArch;
|
|
274
|
+
}
|
|
275
|
+
var userAgent = process.env.npm_config_user_agent || '';
|
|
276
|
+
if (userAgent.startsWith('pnpm/')) {
|
|
277
|
+
return 'MAX';
|
|
278
|
+
}
|
|
279
|
+
if (userAgent.startsWith('yarn/')) {
|
|
280
|
+
return 'PRO';
|
|
281
|
+
}
|
|
282
|
+
// 兜底:通过锁文件判断(应对直接执行 node 脚本等不经包管理器的场景)
|
|
283
|
+
if (fs.existsSync(join(cwd, 'pnpm-lock.yaml'))) {
|
|
284
|
+
return 'MAX';
|
|
285
|
+
}
|
|
286
|
+
if (fs.existsSync(join(cwd, 'yarn.lock'))) {
|
|
287
|
+
return 'PRO';
|
|
288
|
+
}
|
|
289
|
+
return 'unknown';
|
|
290
|
+
}
|
|
258
291
|
function getCfg() {
|
|
259
292
|
var args = yParser(process.argv.slice(2));
|
|
260
293
|
var JENKINS_BUILD = args.jenkinsBuild || args.JENKINSBUILD || args.jenkins_build || args.JENKINS_BUILD;
|
|
@@ -276,14 +309,12 @@ function getCfg() {
|
|
|
276
309
|
var ASG_BRANCH = args.asg_branch || args.ASG_BRANCH || '';
|
|
277
310
|
var RESOURCE_URL = '';
|
|
278
311
|
var SUB_APP = '';
|
|
279
|
-
var archStr =
|
|
280
|
-
if (
|
|
281
|
-
archStr = 'PRO';
|
|
282
|
-
} else if (projectUrl.includes('teams-max')) {
|
|
283
|
-
archStr = 'MAX';
|
|
312
|
+
var archStr = detectArch(infra);
|
|
313
|
+
if (archStr === 'MAX') {
|
|
284
314
|
RESOURCE_URL = args.versionUrl || args.RESOURCE_URL || '';
|
|
285
315
|
SUB_APP = args.subApp || args.SUB_APP || '';
|
|
286
316
|
}
|
|
317
|
+
logStep("Detected arch: ".concat(archStr));
|
|
287
318
|
return {
|
|
288
319
|
appKey: appKey,
|
|
289
320
|
subAppKey: subAppKey,
|
|
@@ -333,7 +364,7 @@ function _fetchRemoteRepository() {
|
|
|
333
364
|
break;
|
|
334
365
|
}
|
|
335
366
|
logStep('Cloning the repository from GitHub...');
|
|
336
|
-
execa.sync('git', ['clone', '-b', 'feature-asg', remoteUrl, directory]);
|
|
367
|
+
execa.sync('git', ['clone', '-b', 'feature-asg-one', remoteUrl, directory]);
|
|
337
368
|
logStep('Cloning completed.');
|
|
338
369
|
logStep('Installing dependencies...');
|
|
339
370
|
_context3.next = 11;
|
|
@@ -407,10 +438,10 @@ function _fetchRemoteRepository() {
|
|
|
407
438
|
}).filter(function (b) {
|
|
408
439
|
return !(b.startsWith('origin/HEA') || b.startsWith('origin/app-') || b.startsWith('app-'));
|
|
409
440
|
});
|
|
410
|
-
defaultBrancheIdx = filteredBranches.indexOf('origin/feature-asg');
|
|
441
|
+
defaultBrancheIdx = filteredBranches.indexOf('origin/feature-asg-one');
|
|
411
442
|
if (defaultBrancheIdx !== -1) {
|
|
412
443
|
filteredBranches.splice(defaultBrancheIdx, 1);
|
|
413
|
-
filteredBranches.unshift('origin/feature-asg');
|
|
444
|
+
filteredBranches.unshift('origin/feature-asg-one');
|
|
414
445
|
}
|
|
415
446
|
// 若过滤后分支列表为空,则给出提示并退出
|
|
416
447
|
if (filteredBranches.length === 0) {
|
|
@@ -3,7 +3,7 @@ var path = require("path");
|
|
|
3
3
|
var { logStep, printErrorAndExit, getCfg } = require("./index");
|
|
4
4
|
function defineConfig(config) {
|
|
5
5
|
const cfg = getCfg();
|
|
6
|
-
const { ASG_DIR } = cfg;
|
|
6
|
+
const { infra, ASG_DIR } = cfg;
|
|
7
7
|
const nextAsgEnv = process.env.ASG_DIR || ASG_DIR;
|
|
8
8
|
if (!process.env.ASG_DIR) {
|
|
9
9
|
logStep("Process ASG_DIR not set, and use scoped environment");
|
|
@@ -12,16 +12,18 @@ function defineConfig(config) {
|
|
|
12
12
|
logStep("The Asgard directory does not exist, using default config...");
|
|
13
13
|
return config;
|
|
14
14
|
}
|
|
15
|
+
const archDir = infra.arch === "PRO" ? "pro" : "max";
|
|
15
16
|
let iConfigFromPlugins = null;
|
|
16
17
|
try {
|
|
17
18
|
iConfigFromPlugins = require(path.join(
|
|
18
19
|
nextAsgEnv,
|
|
20
|
+
archDir,
|
|
19
21
|
"base",
|
|
20
22
|
"pluginConfig.js"
|
|
21
23
|
));
|
|
22
24
|
} catch (error) {
|
|
23
25
|
printErrorAndExit(
|
|
24
|
-
|
|
26
|
+
`Failed to load ${archDir}/base/pluginConfig.js`,
|
|
25
27
|
`Reason: ${error.message}`
|
|
26
28
|
);
|
|
27
29
|
return;
|
package/lib/utils/index.js
CHANGED
|
@@ -37,43 +37,34 @@ function pickDependencies(dependencies, isDev) {
|
|
|
37
37
|
}
|
|
38
38
|
async function addIntegrateDeps(cfg) {
|
|
39
39
|
const { infra, ASG_DIR } = cfg;
|
|
40
|
+
const archDir = infra.arch === "PRO" ? "pro" : "max";
|
|
40
41
|
const pkgs = require(join(cwd, "package.json"));
|
|
41
42
|
const integration = pkgs.integration || [];
|
|
42
43
|
if (!integration.length) {
|
|
43
44
|
logStep("No integration packages are required.");
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
|
-
let
|
|
47
|
-
let devDependencies = {};
|
|
47
|
+
let asgDependencies = {};
|
|
48
48
|
try {
|
|
49
|
-
|
|
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
|
-
);
|
|
49
|
+
asgDependencies = require(join(ASG_DIR, archDir, "base", "integrationDeps.js")) || {};
|
|
70
50
|
} catch (error) {
|
|
71
|
-
|
|
72
|
-
"The Asgard directory does not exist.",
|
|
73
|
-
`Reason: ${error.message}`
|
|
74
|
-
);
|
|
51
|
+
logStep("No integrationDeps.js found, skipping integration deps.");
|
|
75
52
|
return;
|
|
76
53
|
}
|
|
54
|
+
const dependencies = integration.reduce(
|
|
55
|
+
(acc, item) => {
|
|
56
|
+
var _a;
|
|
57
|
+
return { ...acc, ...((_a = asgDependencies[item]) == null ? void 0 : _a.dependencies) || {} };
|
|
58
|
+
},
|
|
59
|
+
{}
|
|
60
|
+
);
|
|
61
|
+
const devDependencies = integration.reduce(
|
|
62
|
+
(acc, item) => {
|
|
63
|
+
var _a;
|
|
64
|
+
return { ...acc, ...((_a = asgDependencies[item]) == null ? void 0 : _a.devDependencies) || {} };
|
|
65
|
+
},
|
|
66
|
+
{}
|
|
67
|
+
);
|
|
77
68
|
const asgDeps = pickDependencies(dependencies);
|
|
78
69
|
const asgDevDeps = pickDependencies(devDependencies, true);
|
|
79
70
|
if ((infra == null ? void 0 : infra.arch) === "PRO") {
|
|
@@ -86,15 +77,16 @@ async function addIntegrateDeps(cfg) {
|
|
|
86
77
|
}
|
|
87
78
|
async function addAsgDependencies(cfg) {
|
|
88
79
|
const { infra, ASG_DIR } = cfg;
|
|
80
|
+
const archDir = infra.arch === "PRO" ? "pro" : "max";
|
|
89
81
|
let dependencies = {};
|
|
90
82
|
let devDependencies = {};
|
|
91
83
|
try {
|
|
92
|
-
const asgDependencies = require(join(ASG_DIR, "base", "dependencies.js")) || {};
|
|
84
|
+
const asgDependencies = require(join(ASG_DIR, archDir, "base", "dependencies.js")) || {};
|
|
93
85
|
dependencies = asgDependencies.dependencies || {};
|
|
94
86
|
devDependencies = asgDependencies.devDependencies || {};
|
|
95
87
|
} catch (error) {
|
|
96
88
|
printErrorAndExit(
|
|
97
|
-
|
|
89
|
+
`Failed to load ${archDir}/base/dependencies.js`,
|
|
98
90
|
`Reason: ${error.message}`
|
|
99
91
|
);
|
|
100
92
|
return;
|
|
@@ -126,6 +118,26 @@ function getAllowEnvParams() {
|
|
|
126
118
|
});
|
|
127
119
|
return filteredParams;
|
|
128
120
|
}
|
|
121
|
+
function detectArch(infra) {
|
|
122
|
+
const explicitArch = (infra.arch || "").toUpperCase();
|
|
123
|
+
if (explicitArch === "PRO" || explicitArch === "MAX") {
|
|
124
|
+
return explicitArch;
|
|
125
|
+
}
|
|
126
|
+
const userAgent = process.env.npm_config_user_agent || "";
|
|
127
|
+
if (userAgent.startsWith("pnpm/")) {
|
|
128
|
+
return "MAX";
|
|
129
|
+
}
|
|
130
|
+
if (userAgent.startsWith("yarn/")) {
|
|
131
|
+
return "PRO";
|
|
132
|
+
}
|
|
133
|
+
if (fs.existsSync(join(cwd, "pnpm-lock.yaml"))) {
|
|
134
|
+
return "MAX";
|
|
135
|
+
}
|
|
136
|
+
if (fs.existsSync(join(cwd, "yarn.lock"))) {
|
|
137
|
+
return "PRO";
|
|
138
|
+
}
|
|
139
|
+
return "unknown";
|
|
140
|
+
}
|
|
129
141
|
function getCfg() {
|
|
130
142
|
const args = yParser(process.argv.slice(2));
|
|
131
143
|
const JENKINS_BUILD = args.jenkinsBuild || args.JENKINSBUILD || args.jenkins_build || args.JENKINS_BUILD;
|
|
@@ -144,14 +156,12 @@ function getCfg() {
|
|
|
144
156
|
const ASG_BRANCH = args.asg_branch || args.ASG_BRANCH || "";
|
|
145
157
|
let RESOURCE_URL = "";
|
|
146
158
|
let SUB_APP = "";
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
archStr = "PRO";
|
|
150
|
-
} else if (projectUrl.includes("teams-max")) {
|
|
151
|
-
archStr = "MAX";
|
|
159
|
+
const archStr = detectArch(infra);
|
|
160
|
+
if (archStr === "MAX") {
|
|
152
161
|
RESOURCE_URL = args.versionUrl || args.RESOURCE_URL || "";
|
|
153
162
|
SUB_APP = args.subApp || args.SUB_APP || "";
|
|
154
163
|
}
|
|
164
|
+
logStep(`Detected arch: ${archStr}`);
|
|
155
165
|
return {
|
|
156
166
|
appKey,
|
|
157
167
|
subAppKey,
|
|
@@ -186,7 +196,7 @@ async function fetchRemoteRepository() {
|
|
|
186
196
|
const doesExist = checkDirectoryExistsSync(directory);
|
|
187
197
|
if (!doesExist) {
|
|
188
198
|
logStep("Cloning the repository from GitHub...");
|
|
189
|
-
execa.sync("git", ["clone", "-b", "feature-asg", remoteUrl, directory]);
|
|
199
|
+
execa.sync("git", ["clone", "-b", "feature-asg-one", remoteUrl, directory]);
|
|
190
200
|
logStep("Cloning completed.");
|
|
191
201
|
logStep("Installing dependencies...");
|
|
192
202
|
await addAsgDependencies(cfg);
|
|
@@ -236,10 +246,12 @@ async function fetchRemoteRepository() {
|
|
|
236
246
|
const filteredBranches = infraBranchArray.map((b) => b.trim()).filter(
|
|
237
247
|
(b) => !(b.startsWith("origin/HEA") || b.startsWith("origin/app-") || b.startsWith("app-"))
|
|
238
248
|
);
|
|
239
|
-
const defaultBrancheIdx = filteredBranches.indexOf(
|
|
249
|
+
const defaultBrancheIdx = filteredBranches.indexOf(
|
|
250
|
+
"origin/feature-asg-one"
|
|
251
|
+
);
|
|
240
252
|
if (defaultBrancheIdx !== -1) {
|
|
241
253
|
filteredBranches.splice(defaultBrancheIdx, 1);
|
|
242
|
-
filteredBranches.unshift("origin/feature-asg");
|
|
254
|
+
filteredBranches.unshift("origin/feature-asg-one");
|
|
243
255
|
}
|
|
244
256
|
if (filteredBranches.length === 0) {
|
|
245
257
|
printErrorAndExit("No branches available for selection.");
|