@teams-max/mwsp 2.0.0 → 2.0.2
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/bin/mwsp.js +2 -2
- package/es/cli/build.js +1 -1
- package/es/utils/chalk/package.json +6 -1
- package/es/utils/cross-spawn/package.json +7 -1
- package/es/utils/defineConfig.js +6 -1
- package/es/utils/execa/index.d.ts +41 -11
- package/es/utils/execa/package.json +11 -1
- package/es/utils/index.js +88 -44
- package/es/utils/merge-stream/index.d.ts +3 -1
- package/es/utils/merge-stream/package.json +7 -1
- package/es/utils/yargs-parser/index.d.ts +3 -1
- package/es/utils/yargs-parser/package.json +7 -1
- package/lib/cli/build.js +1 -1
- package/lib/utils/chalk/index.js +56 -13
- package/lib/utils/chalk/package.json +6 -1
- package/lib/utils/cross-spawn/index.js +8 -2
- package/lib/utils/cross-spawn/package.json +7 -1
- package/lib/utils/datetimeFormat.js +4 -1
- package/lib/utils/defineConfig.js +14 -3
- package/lib/utils/execa/index.d.ts +41 -11
- package/lib/utils/execa/index.js +75 -17
- package/lib/utils/execa/package.json +11 -1
- package/lib/utils/getPackages.js +3 -1
- package/lib/utils/git.js +10 -2
- package/lib/utils/index.js +55 -19
- package/lib/utils/merge-stream/index.d.ts +3 -1
- package/lib/utils/merge-stream/package.json +7 -1
- package/lib/utils/yargs-parser/index.d.ts +3 -1
- package/lib/utils/yargs-parser/index.js +17 -3
- package/lib/utils/yargs-parser/package.json +7 -1
- package/package.json +5 -5
|
@@ -182,7 +182,10 @@ module.exports = (() => {
|
|
|
182
182
|
}
|
|
183
183
|
let u;
|
|
184
184
|
try {
|
|
185
|
-
u = s.sync(t3.command, {
|
|
185
|
+
u = s.sync(t3.command, {
|
|
186
|
+
path: n2[o({ env: n2 })],
|
|
187
|
+
pathExt: e3 ? r.delimiter : void 0
|
|
188
|
+
});
|
|
186
189
|
} catch (t4) {
|
|
187
190
|
} finally {
|
|
188
191
|
if (a) {
|
|
@@ -356,7 +359,10 @@ module.exports = (() => {
|
|
|
356
359
|
const i = (t3) => Object.assign(new Error(`not found: ${t3}`), { code: "ENOENT" });
|
|
357
360
|
const a = (t3, e3) => {
|
|
358
361
|
const n2 = e3.colon || o;
|
|
359
|
-
const s2 = t3.match(/\//) || r && t3.match(/\\/) ? [""] : [
|
|
362
|
+
const s2 = t3.match(/\//) || r && t3.match(/\\/) ? [""] : [
|
|
363
|
+
...r ? [process.cwd()] : [],
|
|
364
|
+
...(e3.path || process.env.PATH || "").split(n2)
|
|
365
|
+
];
|
|
360
366
|
const c2 = r ? e3.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
361
367
|
const i2 = r ? c2.split(n2) : [""];
|
|
362
368
|
if (r) {
|
|
@@ -57,7 +57,10 @@ function datetimeFormat(value, format, isCoerce) {
|
|
|
57
57
|
// 毫秒
|
|
58
58
|
};
|
|
59
59
|
if (/(y+)/.test(format)) {
|
|
60
|
-
format = format.replace(
|
|
60
|
+
format = format.replace(
|
|
61
|
+
RegExp.$1,
|
|
62
|
+
(date.getFullYear() + "").substr(4 - RegExp.$1.length)
|
|
63
|
+
);
|
|
61
64
|
}
|
|
62
65
|
const week = {
|
|
63
66
|
0: "\u65E5",
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
// src/utils/defineConfig.js
|
|
2
2
|
var path = require("path");
|
|
3
|
-
var { logStep, printErrorAndExit } = require("./index");
|
|
3
|
+
var { logStep, printErrorAndExit, getCfg } = require("./index");
|
|
4
4
|
function defineConfig(config) {
|
|
5
|
+
const cfg = getCfg();
|
|
6
|
+
const { ASG_DIR } = cfg;
|
|
7
|
+
const env = Object.create(process.env);
|
|
8
|
+
env.ASG_DIR = ASG_DIR;
|
|
5
9
|
if (!process.env.ASG_DIR) {
|
|
6
10
|
logStep("The Asgard directory does not exist, using default config...");
|
|
7
11
|
return config;
|
|
8
12
|
}
|
|
9
13
|
let iConfigFromPlugins = null;
|
|
10
14
|
try {
|
|
11
|
-
iConfigFromPlugins = require(path.join(
|
|
15
|
+
iConfigFromPlugins = require(path.join(
|
|
16
|
+
process.env.ASG_DIR,
|
|
17
|
+
"base",
|
|
18
|
+
"pluginConfig.js"
|
|
19
|
+
));
|
|
12
20
|
} catch (error) {
|
|
13
|
-
printErrorAndExit(
|
|
21
|
+
printErrorAndExit(
|
|
22
|
+
"The Asgard directory does not exist.",
|
|
23
|
+
`Reason: ${error.message}`
|
|
24
|
+
);
|
|
14
25
|
return;
|
|
15
26
|
}
|
|
16
27
|
logStep("The Asgard directory exists, using config from plugins...");
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/// <reference types="node"/>
|
|
2
2
|
import { ChildProcess } from 'child_process';
|
|
3
|
-
import {
|
|
3
|
+
import { Readable as ReadableStream, Stream } from 'stream';
|
|
4
4
|
|
|
5
5
|
declare namespace execa {
|
|
6
|
-
type StdioOption =
|
|
6
|
+
type StdioOption =
|
|
7
|
+
| 'pipe'
|
|
8
|
+
| 'ipc'
|
|
9
|
+
| 'ignore'
|
|
10
|
+
| 'inherit'
|
|
11
|
+
| Stream
|
|
12
|
+
| number
|
|
13
|
+
| undefined;
|
|
7
14
|
|
|
8
15
|
interface CommonOptions<EncodingType> {
|
|
9
16
|
/**
|
|
@@ -220,7 +227,8 @@ declare namespace execa {
|
|
|
220
227
|
readonly input?: string | Buffer | ReadableStream;
|
|
221
228
|
}
|
|
222
229
|
|
|
223
|
-
interface SyncOptions<EncodingType = string>
|
|
230
|
+
interface SyncOptions<EncodingType = string>
|
|
231
|
+
extends CommonOptions<EncodingType> {
|
|
224
232
|
/**
|
|
225
233
|
Write some input to the `stdin` of your binary.
|
|
226
234
|
*/
|
|
@@ -347,7 +355,8 @@ declare namespace execa {
|
|
|
347
355
|
originalMessage?: string;
|
|
348
356
|
}
|
|
349
357
|
|
|
350
|
-
interface ExecaError<StdoutErrorType = string>
|
|
358
|
+
interface ExecaError<StdoutErrorType = string>
|
|
359
|
+
extends ExecaSyncError<StdoutErrorType> {
|
|
351
360
|
/**
|
|
352
361
|
The output of the process with `stdout` and `stderr` interleaved.
|
|
353
362
|
|
|
@@ -376,7 +385,9 @@ declare namespace execa {
|
|
|
376
385
|
|
|
377
386
|
interface ExecaChildPromise<StdoutErrorType> {
|
|
378
387
|
catch<ResultType = never>(
|
|
379
|
-
onRejected?: (
|
|
388
|
+
onRejected?: (
|
|
389
|
+
reason: ExecaError<StdoutErrorType>,
|
|
390
|
+
) => ResultType | PromiseLike<ResultType>,
|
|
380
391
|
): Promise<ExecaReturnValue<StdoutErrorType> | ResultType>;
|
|
381
392
|
|
|
382
393
|
/**
|
|
@@ -438,14 +449,21 @@ declare const execa: {
|
|
|
438
449
|
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
|
|
439
450
|
```
|
|
440
451
|
*/
|
|
441
|
-
(
|
|
452
|
+
(
|
|
453
|
+
file: string,
|
|
454
|
+
arguments?: readonly string[],
|
|
455
|
+
options?: execa.Options,
|
|
456
|
+
): execa.ExecaChildProcess;
|
|
442
457
|
(
|
|
443
458
|
file: string,
|
|
444
459
|
arguments?: readonly string[],
|
|
445
460
|
options?: execa.Options<null>,
|
|
446
461
|
): execa.ExecaChildProcess<Buffer>;
|
|
447
462
|
(file: string, options?: execa.Options): execa.ExecaChildProcess;
|
|
448
|
-
(
|
|
463
|
+
(
|
|
464
|
+
file: string,
|
|
465
|
+
options?: execa.Options<null>,
|
|
466
|
+
): execa.ExecaChildProcess<Buffer>;
|
|
449
467
|
|
|
450
468
|
/**
|
|
451
469
|
Execute a file synchronously.
|
|
@@ -467,7 +485,10 @@ declare const execa: {
|
|
|
467
485
|
options?: execa.SyncOptions<null>,
|
|
468
486
|
): execa.ExecaSyncReturnValue<Buffer>;
|
|
469
487
|
sync(file: string, options?: execa.SyncOptions): execa.ExecaSyncReturnValue;
|
|
470
|
-
sync(
|
|
488
|
+
sync(
|
|
489
|
+
file: string,
|
|
490
|
+
options?: execa.SyncOptions<null>,
|
|
491
|
+
): execa.ExecaSyncReturnValue<Buffer>;
|
|
471
492
|
|
|
472
493
|
/**
|
|
473
494
|
Same as `execa()` except both file and arguments are specified in a single `command` string. For example, `execa('echo', ['unicorns'])` is the same as `execa.command('echo unicorns')`.
|
|
@@ -491,7 +512,10 @@ declare const execa: {
|
|
|
491
512
|
```
|
|
492
513
|
*/
|
|
493
514
|
command(command: string, options?: execa.Options): execa.ExecaChildProcess;
|
|
494
|
-
command(
|
|
515
|
+
command(
|
|
516
|
+
command: string,
|
|
517
|
+
options?: execa.Options<null>,
|
|
518
|
+
): execa.ExecaChildProcess<Buffer>;
|
|
495
519
|
|
|
496
520
|
/**
|
|
497
521
|
Same as `execa.command()` but synchronous.
|
|
@@ -499,7 +523,10 @@ declare const execa: {
|
|
|
499
523
|
@param command - The program/script to execute and its arguments.
|
|
500
524
|
@returns A result `Object` with `stdout` and `stderr` properties.
|
|
501
525
|
*/
|
|
502
|
-
commandSync(
|
|
526
|
+
commandSync(
|
|
527
|
+
command: string,
|
|
528
|
+
options?: execa.SyncOptions,
|
|
529
|
+
): execa.ExecaSyncReturnValue;
|
|
503
530
|
commandSync(
|
|
504
531
|
command: string,
|
|
505
532
|
options?: execa.SyncOptions<null>,
|
|
@@ -528,7 +555,10 @@ declare const execa: {
|
|
|
528
555
|
options?: execa.Options<null>,
|
|
529
556
|
): execa.ExecaChildProcess<Buffer>;
|
|
530
557
|
node(scriptPath: string, options?: execa.Options): execa.ExecaChildProcess;
|
|
531
|
-
node(
|
|
558
|
+
node(
|
|
559
|
+
scriptPath: string,
|
|
560
|
+
options?: execa.Options<null>,
|
|
561
|
+
): execa.ExecaChildProcess<Buffer>;
|
|
532
562
|
};
|
|
533
563
|
|
|
534
564
|
export = execa;
|
package/lib/utils/execa/index.js
CHANGED
|
@@ -102,7 +102,12 @@ module.exports = (() => {
|
|
|
102
102
|
const c = r(82);
|
|
103
103
|
const u = r(187);
|
|
104
104
|
const d = r(166);
|
|
105
|
-
const {
|
|
105
|
+
const {
|
|
106
|
+
spawnedKill: l,
|
|
107
|
+
spawnedCancel: f,
|
|
108
|
+
setupTimeout: p,
|
|
109
|
+
setExitHandler: m
|
|
110
|
+
} = r(819);
|
|
106
111
|
const {
|
|
107
112
|
handleInput: x,
|
|
108
113
|
getSpawnedResult: b,
|
|
@@ -112,7 +117,13 @@ module.exports = (() => {
|
|
|
112
117
|
const { mergePromise: y, getSpawnedPromise: h } = r(814);
|
|
113
118
|
const { joinCommand: S, parseCommand: w } = r(286);
|
|
114
119
|
const I = 1e3 * 1e3 * 100;
|
|
115
|
-
const G = ({
|
|
120
|
+
const G = ({
|
|
121
|
+
env: e3,
|
|
122
|
+
extendEnv: t3,
|
|
123
|
+
preferLocal: r2,
|
|
124
|
+
localDir: n2,
|
|
125
|
+
execPath: o2
|
|
126
|
+
}) => {
|
|
116
127
|
const i2 = t3 ? { ...process.env, ...e3 } : e3;
|
|
117
128
|
if (r2) {
|
|
118
129
|
return a.env({ env: i2, cwd: n2, execPath: o2 });
|
|
@@ -185,11 +196,7 @@ module.exports = (() => {
|
|
|
185
196
|
a2.kill = l.bind(null, a2.kill.bind(a2));
|
|
186
197
|
a2.cancel = f.bind(null, a2, I2);
|
|
187
198
|
const G2 = async () => {
|
|
188
|
-
const [{ error: e4, exitCode: t4, signal: r3, timedOut: o2 }, i2, c2, d3] = await b(
|
|
189
|
-
a2,
|
|
190
|
-
n2.options,
|
|
191
|
-
w2
|
|
192
|
-
);
|
|
199
|
+
const [{ error: e4, exitCode: t4, signal: r3, timedOut: o2 }, i2, c2, d3] = await b(a2, n2.options, w2);
|
|
193
200
|
const l2 = E(n2.options, i2);
|
|
194
201
|
const f2 = E(n2.options, c2);
|
|
195
202
|
const p2 = E(n2.options, d3);
|
|
@@ -296,7 +303,10 @@ module.exports = (() => {
|
|
|
296
303
|
t3 = [];
|
|
297
304
|
}
|
|
298
305
|
const n2 = d.node(r2);
|
|
299
|
-
const {
|
|
306
|
+
const {
|
|
307
|
+
nodePath: o2 = process.execPath,
|
|
308
|
+
nodeOptions: i2 = process.execArgv
|
|
309
|
+
} = r2;
|
|
300
310
|
return C(o2, [...i2, e3, ...Array.isArray(t3) ? t3 : []], {
|
|
301
311
|
...r2,
|
|
302
312
|
stdin: void 0,
|
|
@@ -500,7 +510,12 @@ ${i2.message}` : b;
|
|
|
500
510
|
i2();
|
|
501
511
|
});
|
|
502
512
|
};
|
|
503
|
-
e2.exports = {
|
|
513
|
+
e2.exports = {
|
|
514
|
+
spawnedKill: s,
|
|
515
|
+
spawnedCancel: l,
|
|
516
|
+
setupTimeout: p,
|
|
517
|
+
setExitHandler: m
|
|
518
|
+
};
|
|
504
519
|
},
|
|
505
520
|
814: (e2) => {
|
|
506
521
|
"use strict";
|
|
@@ -642,10 +657,17 @@ ${i2.message}` : b;
|
|
|
642
657
|
};
|
|
643
658
|
const l = ({ input: e3 }) => {
|
|
644
659
|
if (n(e3)) {
|
|
645
|
-
throw new TypeError(
|
|
660
|
+
throw new TypeError(
|
|
661
|
+
"The `input` option cannot be a stream in sync mode"
|
|
662
|
+
);
|
|
646
663
|
}
|
|
647
664
|
};
|
|
648
|
-
e2.exports = {
|
|
665
|
+
e2.exports = {
|
|
666
|
+
handleInput: s,
|
|
667
|
+
makeAllStream: a,
|
|
668
|
+
getSpawnedResult: d,
|
|
669
|
+
validateInputSync: l
|
|
670
|
+
};
|
|
649
671
|
},
|
|
650
672
|
585: (e2, t2, r) => {
|
|
651
673
|
"use strict";
|
|
@@ -774,8 +796,20 @@ ${i2.message}` : b;
|
|
|
774
796
|
description: "Debugger breakpoint",
|
|
775
797
|
standard: "posix"
|
|
776
798
|
},
|
|
777
|
-
{
|
|
778
|
-
|
|
799
|
+
{
|
|
800
|
+
name: "SIGABRT",
|
|
801
|
+
number: 6,
|
|
802
|
+
action: "core",
|
|
803
|
+
description: "Aborted",
|
|
804
|
+
standard: "ansi"
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
name: "SIGIOT",
|
|
808
|
+
number: 6,
|
|
809
|
+
action: "core",
|
|
810
|
+
description: "Aborted",
|
|
811
|
+
standard: "bsd"
|
|
812
|
+
},
|
|
779
813
|
{
|
|
780
814
|
name: "SIGBUS",
|
|
781
815
|
number: 7,
|
|
@@ -1010,7 +1044,15 @@ ${i2.message}` : b;
|
|
|
1010
1044
|
const e3 = (0, o.getSignals)();
|
|
1011
1045
|
return e3.reduce(a, {});
|
|
1012
1046
|
};
|
|
1013
|
-
const a = function(e3, {
|
|
1047
|
+
const a = function(e3, {
|
|
1048
|
+
name: t3,
|
|
1049
|
+
number: r2,
|
|
1050
|
+
description: n2,
|
|
1051
|
+
supported: o2,
|
|
1052
|
+
action: i2,
|
|
1053
|
+
forced: s2,
|
|
1054
|
+
standard: a2
|
|
1055
|
+
}) {
|
|
1014
1056
|
return {
|
|
1015
1057
|
...e3,
|
|
1016
1058
|
[t3]: {
|
|
@@ -1037,7 +1079,14 @@ ${i2.message}` : b;
|
|
|
1037
1079
|
if (r2 === void 0) {
|
|
1038
1080
|
return {};
|
|
1039
1081
|
}
|
|
1040
|
-
const {
|
|
1082
|
+
const {
|
|
1083
|
+
name: n2,
|
|
1084
|
+
description: o2,
|
|
1085
|
+
supported: i2,
|
|
1086
|
+
action: s2,
|
|
1087
|
+
forced: a2,
|
|
1088
|
+
standard: c2
|
|
1089
|
+
} = r2;
|
|
1041
1090
|
return {
|
|
1042
1091
|
[e3]: {
|
|
1043
1092
|
name: n2,
|
|
@@ -1144,7 +1193,12 @@ ${i2.message}` : b;
|
|
|
1144
1193
|
const n = r(622);
|
|
1145
1194
|
const o = r(278);
|
|
1146
1195
|
const i = (e3) => {
|
|
1147
|
-
e3 = {
|
|
1196
|
+
e3 = {
|
|
1197
|
+
cwd: process.cwd(),
|
|
1198
|
+
path: process.env[o()],
|
|
1199
|
+
execPath: process.execPath,
|
|
1200
|
+
...e3
|
|
1201
|
+
};
|
|
1148
1202
|
let t3;
|
|
1149
1203
|
let r2 = n.resolve(e3.cwd);
|
|
1150
1204
|
const i2 = [];
|
|
@@ -1359,7 +1413,11 @@ ${i2.message}` : b;
|
|
|
1359
1413
|
a.infinite = true;
|
|
1360
1414
|
}
|
|
1361
1415
|
e2.exports = function(e3, t3) {
|
|
1362
|
-
n.equal(
|
|
1416
|
+
n.equal(
|
|
1417
|
+
typeof e3,
|
|
1418
|
+
"function",
|
|
1419
|
+
"a callback must be provided for exit handler"
|
|
1420
|
+
);
|
|
1363
1421
|
if (u === false) {
|
|
1364
1422
|
load();
|
|
1365
1423
|
}
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "execa",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "Sindre Sorhus",
|
|
6
|
+
"email": "sindresorhus@gmail.com",
|
|
7
|
+
"url": "https://sindresorhus.com"
|
|
8
|
+
},
|
|
9
|
+
"main": "index.js",
|
|
10
|
+
"types": "index.d.ts"
|
|
11
|
+
}
|
package/lib/utils/getPackages.js
CHANGED
|
@@ -2,5 +2,7 @@
|
|
|
2
2
|
var { readdirSync } = require("fs");
|
|
3
3
|
var { join } = require("path");
|
|
4
4
|
module.exports = function getPackages() {
|
|
5
|
-
return readdirSync(join(__dirname, "../../packages")).filter(
|
|
5
|
+
return readdirSync(join(__dirname, "../../packages")).filter(
|
|
6
|
+
(pkg) => pkg.charAt(0) !== "."
|
|
7
|
+
);
|
|
6
8
|
};
|
package/lib/utils/git.js
CHANGED
|
@@ -5,7 +5,11 @@ exports.latestTag = async () => {
|
|
|
5
5
|
return stdout;
|
|
6
6
|
};
|
|
7
7
|
var firstCommit = async () => {
|
|
8
|
-
const { stdout } = await execa("git", [
|
|
8
|
+
const { stdout } = await execa("git", [
|
|
9
|
+
"rev-list",
|
|
10
|
+
"--max-parents=0",
|
|
11
|
+
"HEAD"
|
|
12
|
+
]);
|
|
9
13
|
return stdout;
|
|
10
14
|
};
|
|
11
15
|
exports.latestTagOrFirstCommit = async () => {
|
|
@@ -18,6 +22,10 @@ exports.latestTagOrFirstCommit = async () => {
|
|
|
18
22
|
return latest;
|
|
19
23
|
};
|
|
20
24
|
exports.commitLogFromRevision = async (revision) => {
|
|
21
|
-
const { stdout } = await execa("git", [
|
|
25
|
+
const { stdout } = await execa("git", [
|
|
26
|
+
"log",
|
|
27
|
+
"--format=%s %h",
|
|
28
|
+
`${revision}..HEAD`
|
|
29
|
+
]);
|
|
22
30
|
return stdout;
|
|
23
31
|
};
|
package/lib/utils/index.js
CHANGED
|
@@ -22,6 +22,16 @@ function printErrorAndExit(...args) {
|
|
|
22
22
|
printError(args);
|
|
23
23
|
process.exit(1);
|
|
24
24
|
}
|
|
25
|
+
function pickDependencies(dependencies, isDev) {
|
|
26
|
+
const pkgs = require(join(cwd, "package.json"));
|
|
27
|
+
return dependencies.filter((p) => {
|
|
28
|
+
if (isDev) {
|
|
29
|
+
return !pkgs.devDependencies[p];
|
|
30
|
+
} else {
|
|
31
|
+
return !pkgs.dependencies[p];
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
25
35
|
function getCfg() {
|
|
26
36
|
const pkgs = require(join(cwd, "package.json"));
|
|
27
37
|
const { infra = {}, appKey } = pkgs;
|
|
@@ -79,43 +89,65 @@ async function fetchRemoteRepository() {
|
|
|
79
89
|
logStep("Cloning completed.");
|
|
80
90
|
logStep("Installing dependencies...");
|
|
81
91
|
if ((infra == null ? void 0 : infra.arch) === "PRO") {
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
const proDevDeps = pickDependencies(
|
|
93
|
+
["snb-mock-middleware", "lodash-webpack-plugin"],
|
|
94
|
+
true
|
|
95
|
+
);
|
|
96
|
+
!!proDevDeps.length && await exec("yarn", ["add", ...proDevDeps, "-D"]);
|
|
97
|
+
const proDeps = pickDependencies(["@teams-max/skynet", "history"]);
|
|
98
|
+
!!proDeps.length && await exec("yarn", ["add", ...proDeps]);
|
|
84
99
|
} else if ((infra == null ? void 0 : infra.arch) === "MAX") {
|
|
85
|
-
|
|
86
|
-
await exec("pnpm", ["add",
|
|
100
|
+
const maxDevDeps = pickDependencies(["axios"], true);
|
|
101
|
+
!!maxDevDeps.length && await exec("pnpm", ["add", ...maxDevDeps, "-D"]);
|
|
102
|
+
const maxDeps = pickDependencies([
|
|
103
|
+
"@teams-max/skynet",
|
|
104
|
+
"classnames",
|
|
105
|
+
"qs",
|
|
106
|
+
"uuid",
|
|
107
|
+
"react-draggable",
|
|
108
|
+
"lodash",
|
|
109
|
+
"moment",
|
|
110
|
+
"dayjs"
|
|
111
|
+
]);
|
|
112
|
+
!!maxDeps.length && await exec("pnpm", ["add", ...maxDeps]);
|
|
87
113
|
}
|
|
88
114
|
logStep("Installation completed.");
|
|
89
115
|
} else if (JENKINS_BUILD && !ASG_BRAHCH) {
|
|
90
116
|
logStep("Jenkins build detected. Skipping sync up.");
|
|
91
117
|
return;
|
|
92
118
|
} else {
|
|
93
|
-
|
|
94
|
-
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
119
|
+
if (!JENKINS_BUILD) {
|
|
120
|
+
const { syncUp } = await inquirer.prompt([
|
|
121
|
+
{
|
|
122
|
+
type: "confirm",
|
|
123
|
+
name: "syncUp",
|
|
124
|
+
message: "\u540C\u6B65\u8FDC\u7AEF\u4ED3\u5E93",
|
|
125
|
+
default: "Y"
|
|
126
|
+
}
|
|
127
|
+
]);
|
|
128
|
+
if (!syncUp)
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
103
131
|
}
|
|
104
132
|
if (!doesExist && JENKINS_BUILD && !ASG_BRAHCH) {
|
|
105
|
-
printErrorAndExit(
|
|
133
|
+
printErrorAndExit(
|
|
134
|
+
"Jenkins build detected. The branch parameter is missing!"
|
|
135
|
+
);
|
|
106
136
|
return;
|
|
107
137
|
}
|
|
108
138
|
logStep("Synchronizing with the remote repository...");
|
|
109
139
|
process.chdir(directory);
|
|
110
140
|
try {
|
|
111
|
-
execa.sync("git", ["
|
|
141
|
+
execa.sync("git", ["fetch", "origin", "--prune"]);
|
|
112
142
|
if (JENKINS_BUILD && ASG_BRAHCH) {
|
|
113
143
|
execa.sync("git", ["checkout", ASG_BRAHCH]);
|
|
114
144
|
logStep(`Anto switched to branch:`, ASG_BRAHCH);
|
|
115
145
|
} else {
|
|
116
146
|
const infraBranchsOutput = execa.sync("git", ["branch", "-r"]).stdout;
|
|
117
147
|
const infraBranchArray = infraBranchsOutput.trim().split("\n");
|
|
118
|
-
const filteredBranches = infraBranchArray.map((b) => b.trim()).filter(
|
|
148
|
+
const filteredBranches = infraBranchArray.map((b) => b.trim()).filter(
|
|
149
|
+
(b) => !(b.startsWith("origin/HEA") || b.startsWith("origin/app-") || b.startsWith("app-"))
|
|
150
|
+
);
|
|
119
151
|
const defaultBrancheIdx = filteredBranches.indexOf("origin/feature-asg");
|
|
120
152
|
if (defaultBrancheIdx !== -1) {
|
|
121
153
|
filteredBranches.splice(defaultBrancheIdx, 1);
|
|
@@ -142,11 +174,15 @@ async function fetchRemoteRepository() {
|
|
|
142
174
|
execa.sync("git", ["checkout", "-q", questions.branch]);
|
|
143
175
|
logStep(`Switched to branch:`, questions.branch);
|
|
144
176
|
} catch (error) {
|
|
145
|
-
printErrorAndExit(
|
|
177
|
+
printErrorAndExit(
|
|
178
|
+
`Failed to switch to branch '${questions.branch}'. Reason: ${error.message}`
|
|
179
|
+
);
|
|
146
180
|
}
|
|
147
181
|
}
|
|
148
182
|
} catch (error) {
|
|
149
|
-
printErrorAndExit(
|
|
183
|
+
printErrorAndExit(
|
|
184
|
+
`An error occurred while fetching remote branches: ${error.message}`
|
|
185
|
+
);
|
|
150
186
|
}
|
|
151
187
|
process.chdir(cwd);
|
|
152
188
|
}
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
/// <reference types="node"/>
|
|
10
10
|
|
|
11
11
|
interface MergedStream extends NodeJS.ReadWriteStream {
|
|
12
|
-
add(
|
|
12
|
+
add(
|
|
13
|
+
source: NodeJS.ReadableStream | ReadonlyArray<NodeJS.ReadableStream>,
|
|
14
|
+
): MergedStream;
|
|
13
15
|
isEmpty(): boolean;
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "merge-stream",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"author": "Stephen Sugden <me@stephensugden.com>",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts"
|
|
7
|
+
}
|
|
@@ -74,7 +74,9 @@ declare namespace yargsParser {
|
|
|
74
74
|
* Indicate that keys should be parsed as an array and coerced to booleans / numbers:
|
|
75
75
|
* { array: [ { key: 'foo', boolean: true }, {key: 'bar', number: true} ] }`.
|
|
76
76
|
*/
|
|
77
|
-
array?:
|
|
77
|
+
array?:
|
|
78
|
+
| string[]
|
|
79
|
+
| Array<{ key: string; boolean?: boolean; number?: boolean }>;
|
|
78
80
|
/** Arguments should be parsed as booleans: `{ boolean: ['x', 'y'] }`. */
|
|
79
81
|
boolean?: string[];
|
|
80
82
|
/** Indicate a key that represents a path to a configuration file (this file will be loaded and parsed). */
|
|
@@ -123,7 +123,11 @@ module.exports = (() => {
|
|
|
123
123
|
[].concat(n3.array).filter(Boolean).forEach(function(s4) {
|
|
124
124
|
const n4 = s4.key || s4;
|
|
125
125
|
const t3 = Object.keys(s4).map(function(s5) {
|
|
126
|
-
return {
|
|
126
|
+
return {
|
|
127
|
+
boolean: "bools",
|
|
128
|
+
string: "strings",
|
|
129
|
+
number: "numbers"
|
|
130
|
+
}[s5];
|
|
127
131
|
}).filter(Boolean).pop();
|
|
128
132
|
if (t3) {
|
|
129
133
|
O[t3][n4] = true;
|
|
@@ -778,10 +782,20 @@ module.exports = (() => {
|
|
|
778
782
|
function checkConfiguration() {
|
|
779
783
|
Object.keys(O.counts).find((s4) => {
|
|
780
784
|
if (checkAllAliases(s4, O.arrays)) {
|
|
781
|
-
_ = Error(
|
|
785
|
+
_ = Error(
|
|
786
|
+
b(
|
|
787
|
+
"Invalid configuration: %s, opts.count excludes opts.array.",
|
|
788
|
+
s4
|
|
789
|
+
)
|
|
790
|
+
);
|
|
782
791
|
return true;
|
|
783
792
|
} else if (checkAllAliases(s4, O.nargs)) {
|
|
784
|
-
_ = Error(
|
|
793
|
+
_ = Error(
|
|
794
|
+
b(
|
|
795
|
+
"Invalid configuration: %s, opts.count excludes opts.narg.",
|
|
796
|
+
s4
|
|
797
|
+
)
|
|
798
|
+
);
|
|
785
799
|
return true;
|
|
786
800
|
}
|
|
787
801
|
});
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teams-max/mwsp",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "@teams-max/mwsp",
|
|
5
5
|
"homepage": "https://gitlab.daikuan.qihoo.net/efficacy-fe/teams-max/-/tree/master/packages/mwsp",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://gitlab.daikuan.qihoo.net/efficacy-fe/teams-max"
|
|
9
9
|
},
|
|
10
|
+
"license": "ISC",
|
|
10
11
|
"main": "lib/index.js",
|
|
11
12
|
"types": "lib/index.d.ts",
|
|
12
13
|
"bin": {
|
|
@@ -22,14 +23,13 @@
|
|
|
22
23
|
"build:deps": "max-scripts bundleDeps",
|
|
23
24
|
"dev": "max-scripts father dev"
|
|
24
25
|
},
|
|
25
|
-
"publishConfig": {
|
|
26
|
-
"access": "public"
|
|
27
|
-
},
|
|
28
|
-
"license": "ISC",
|
|
29
26
|
"dependencies": {
|
|
30
27
|
"inquirer": "7.3.3",
|
|
31
28
|
"v8-compile-cache": "2.3.0"
|
|
32
29
|
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
33
|
"authors": [
|
|
34
34
|
"zhangxiaoyang <zhangxiaoyang-jk@360shuke.com> (https://v.src.corp.qihoo.net/j-zhangxiaoyang-jk)",
|
|
35
35
|
"liuxiangdong <liuxiangdong1-jk@360shuke.com> (https://v.src.corp.qihoo.net/j-liuxiangdong1-jk)"
|