@dd-code/uni-tools 1.0.14 → 1.0.15
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/dist/cli.js +78 -36
- package/dist/cli.mjs.js +78 -36
- package/dist/index.js +289 -33
- package/dist/index.mjs.js +289 -33
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -9,6 +9,7 @@ require('crypto');
|
|
|
9
9
|
require('chokidar');
|
|
10
10
|
var child_process = require('child_process');
|
|
11
11
|
var inquirer = require('inquirer');
|
|
12
|
+
var yaml = require('js-yaml');
|
|
12
13
|
|
|
13
14
|
/******************************************************************************
|
|
14
15
|
Copyright (c) Microsoft Corporation.
|
|
@@ -65,6 +66,16 @@ function __generator(thisArg, body) {
|
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
function __spreadArray(to, from, pack) {
|
|
70
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
71
|
+
if (ar || !(i in from)) {
|
|
72
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
73
|
+
ar[i] = from[i];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
77
|
+
}
|
|
78
|
+
|
|
68
79
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
69
80
|
var e = new Error(message);
|
|
70
81
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -100,6 +111,9 @@ function uniReadFile(filaPath) {
|
|
|
100
111
|
* @returns {void}
|
|
101
112
|
*/
|
|
102
113
|
function writeFiles(filaPath, content) {
|
|
114
|
+
if (typeof content === "object" && content) {
|
|
115
|
+
content = JSON.stringify(content, null, 2);
|
|
116
|
+
}
|
|
103
117
|
// 检查文件路径是否存在
|
|
104
118
|
var dir = path.dirname(filaPath);
|
|
105
119
|
if (!fs.existsSync(dir)) {
|
|
@@ -132,7 +146,7 @@ var unlinkDeepDirOrFile = function (filePath) {
|
|
|
132
146
|
};
|
|
133
147
|
|
|
134
148
|
// 项目 Git 子模块路径
|
|
135
|
-
var PROJECT_GIT_PATH = "
|
|
149
|
+
var PROJECT_GIT_PATH = "./sub-repo";
|
|
136
150
|
// CDN 文件保存路径
|
|
137
151
|
path.join(process.cwd(), "node_modules/@dd-code/uni-files");
|
|
138
152
|
path.join(process.cwd(), "node_modules/@dd-code/__main-pwd.txt");
|
|
@@ -201,30 +215,6 @@ var excuteUniCommand = function (command, opt) { return __awaiter(void 0, void 0
|
|
|
201
215
|
process.env.MFE_TARGET_DIR = (opt === null || opt === void 0 ? void 0 : opt.buildDir) || "";
|
|
202
216
|
_a = opt || {}, isRoot = _a.isRoot, appCode = _a.appCode;
|
|
203
217
|
cmd = "".concat(command, " ").concat(!isRoot ? "--subpackage=".concat(appCode) : "");
|
|
204
|
-
// if (isRoot) {
|
|
205
|
-
// const mfeJson = getMfeJson();
|
|
206
|
-
// const apps = mfeJson.apps?.map((i) => i.appCode) || [];
|
|
207
|
-
// apps.forEach((appCode) => {
|
|
208
|
-
// const appCodeDir = appCode.replace(/\//g, "_");
|
|
209
|
-
// // console.log(appCodeDir, 'appCodeDir');
|
|
210
|
-
// const childPath = path.join(process.cwd(), PROJECT_GIT_PATH, appCodeDir);
|
|
211
|
-
// console.log(existsSync(appCodeDir), childPath, "childPath");
|
|
212
|
-
// // if (existsSync(appCodeDir)) {
|
|
213
|
-
// // excuteUniCommand(`cd ${childPath} && ${command}`, {
|
|
214
|
-
// // appCode,
|
|
215
|
-
// // target: appCodeDir,
|
|
216
|
-
// // });
|
|
217
|
-
// // 开一个子线程启动
|
|
218
|
-
// // execSync(cmd, {
|
|
219
|
-
// // stdio: "inherit",
|
|
220
|
-
// // });
|
|
221
|
-
// // }
|
|
222
|
-
// });
|
|
223
|
-
// // setTimeout(() => {
|
|
224
|
-
// // console.log(process.env.UNI_OUTPUT_DIR, "process.env.UNI_OUTPUT_DIR");
|
|
225
|
-
// // });
|
|
226
|
-
// }
|
|
227
|
-
// console.log(cmd, "-------");
|
|
228
218
|
child_process.execSync(cmd, {
|
|
229
219
|
stdio: "inherit",
|
|
230
220
|
});
|
|
@@ -236,14 +226,59 @@ var excuteUniCommand = function (command, opt) { return __awaiter(void 0, void 0
|
|
|
236
226
|
var inquirerPrompt = ((inquirer === null || inquirer === void 0 ? void 0 : inquirer.default) ||
|
|
237
227
|
inquirer);
|
|
238
228
|
|
|
229
|
+
var parseYaml = function (content) {
|
|
230
|
+
try {
|
|
231
|
+
return yaml.load(content, { json: true });
|
|
232
|
+
}
|
|
233
|
+
catch (e) {
|
|
234
|
+
return '';
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
var dumpYaml = function (content) {
|
|
238
|
+
try {
|
|
239
|
+
return yaml.dump(content, {
|
|
240
|
+
// 可选配置:保证中文等 Unicode 字符正常显示(不转义)
|
|
241
|
+
skipInvalid: true,
|
|
242
|
+
encoding: 'utf8',
|
|
243
|
+
// 可选:设置缩进空格数,增强可读性
|
|
244
|
+
indent: 2
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
catch (e) {
|
|
248
|
+
return '';
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
var writeChildWorkspace = function (content) {
|
|
253
|
+
var configPath = path.join(process.cwd(), "pnpm-workspace.yaml");
|
|
254
|
+
var fileContent = parseYaml(uniReadFile(configPath));
|
|
255
|
+
if (!fileContent) {
|
|
256
|
+
// fileContent = "packages:\n";
|
|
257
|
+
fileContent = {
|
|
258
|
+
packages: [
|
|
259
|
+
'.',
|
|
260
|
+
]
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
var packages = new Set(__spreadArray(__spreadArray([], fileContent.packages, true), [content + '/*'], false));
|
|
264
|
+
fileContent.packages = Array.from(packages);
|
|
265
|
+
var str = dumpYaml(fileContent);
|
|
266
|
+
writeFiles(configPath, str);
|
|
267
|
+
};
|
|
239
268
|
var fetchAppsRepo = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
240
|
-
var mfeJson, apps, answers, selectedApps, selectedGitApps;
|
|
269
|
+
var mfeJson, apps, answers, selectedApps, childPath, selectedGitApps;
|
|
241
270
|
return __generator(this, function (_a) {
|
|
242
271
|
switch (_a.label) {
|
|
243
272
|
case 0:
|
|
244
273
|
mfeJson = getMfeJson();
|
|
245
274
|
apps = (mfeJson === null || mfeJson === void 0 ? void 0 : mfeJson.apps) || [];
|
|
246
275
|
return [4 /*yield*/, inquirerPrompt.prompt([
|
|
276
|
+
{
|
|
277
|
+
type: 'input',
|
|
278
|
+
name: "dir",
|
|
279
|
+
message: "请输入子模块路径:",
|
|
280
|
+
default: PROJECT_GIT_PATH,
|
|
281
|
+
},
|
|
247
282
|
{
|
|
248
283
|
type: "checkbox",
|
|
249
284
|
name: "selectedApps",
|
|
@@ -257,19 +292,24 @@ var fetchAppsRepo = function () { return __awaiter(void 0, void 0, void 0, funct
|
|
|
257
292
|
case 1:
|
|
258
293
|
answers = _a.sent();
|
|
259
294
|
selectedApps = answers.selectedApps;
|
|
295
|
+
childPath = answers.dir;
|
|
260
296
|
selectedGitApps = apps.filter(function (app) { return selectedApps.includes(app.appCode) && app.repoUrl; });
|
|
261
|
-
console.log("选择的应用仓库:", selectedGitApps);
|
|
297
|
+
// console.log("选择的应用仓库:", selectedGitApps);
|
|
262
298
|
// 执行拉取操作
|
|
263
299
|
selectedGitApps.forEach(function (_a) {
|
|
264
300
|
var appCode = _a.appCode, repoUrl = _a.repoUrl;
|
|
265
301
|
if (repoUrl) {
|
|
266
302
|
var fileName = appCode.replace(/\//g, "_");
|
|
267
|
-
var dir =
|
|
303
|
+
var dir = childPath;
|
|
268
304
|
unlinkDeepDirOrFile(path.join(dir, fileName));
|
|
269
305
|
checkAndgenreDir(dir);
|
|
270
306
|
child_process.execSync("cd ".concat(dir, " && git clone ").concat(repoUrl, " ").concat(fileName), {
|
|
271
307
|
stdio: "inherit",
|
|
272
308
|
});
|
|
309
|
+
writeChildWorkspace(dir);
|
|
310
|
+
// execSync(`cd ${dir} && git clone ${repoUrl} ${fileName}`, {
|
|
311
|
+
// stdio: "inherit",
|
|
312
|
+
// });
|
|
273
313
|
}
|
|
274
314
|
});
|
|
275
315
|
return [2 /*return*/];
|
|
@@ -278,20 +318,22 @@ var fetchAppsRepo = function () { return __awaiter(void 0, void 0, void 0, funct
|
|
|
278
318
|
}); };
|
|
279
319
|
|
|
280
320
|
var runParallelAllUni = function (cmd) { return __awaiter(void 0, void 0, void 0, function () {
|
|
281
|
-
var configPath;
|
|
282
321
|
return __generator(this, function (_a) {
|
|
283
|
-
configPath = path.join(process.cwd(), "pnpm-workspace.yaml");
|
|
284
|
-
writeFiles(configPath, "packages:\n - '*'\n - 'src/subtree/*'");
|
|
285
322
|
// pnpm -r --parallel --workspace-root --filter=* run dev:mp-weixin --b root
|
|
286
323
|
child_process.execSync("pnpm -r --parallel --workspace-root --filter=* run ".concat(cmd, " --b root"), {
|
|
287
324
|
stdio: "inherit",
|
|
288
325
|
});
|
|
289
|
-
// 删除文件
|
|
290
|
-
fs.unlinkSync(configPath);
|
|
291
326
|
return [2 /*return*/];
|
|
292
327
|
});
|
|
293
328
|
}); };
|
|
294
329
|
|
|
330
|
+
/**
|
|
331
|
+
* CLI 命令
|
|
332
|
+
* - serve:开发态运行,支持 `-p` 平台、`--mode` 模式、`--b` 目标路径
|
|
333
|
+
* - build:生产构建,支持平台/模式;mp-weixin 下根据 isRoot/appCode 进行差异化参数
|
|
334
|
+
* - fetch:交互式拉取子应用仓库(选择 apps 列表并 clone 到本地)
|
|
335
|
+
* - runAll:并行启动所有 mp-weixin 项目
|
|
336
|
+
*/
|
|
295
337
|
var addUniOptions = function (program) {
|
|
296
338
|
return program
|
|
297
339
|
.option("-p <platform>", "平台", "h5")
|
|
@@ -319,11 +361,11 @@ fetchGit.action(function () { return __awaiter(void 0, void 0, void 0, function
|
|
|
319
361
|
// pushCdn.option("--mode <mode>", "模式", "dev").action(({ mode }) => {
|
|
320
362
|
// pushDistToCdn(mode);
|
|
321
363
|
// });
|
|
322
|
-
addUniOptions(runAll).action(function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
323
|
-
_b.mode; var platform = _b.p
|
|
364
|
+
addUniOptions(runAll).option("--cmd <execCmd>", "启动命令", "dev:mp-weixin").action(function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
365
|
+
_b.mode; var platform = _b.p, cmd = _b.cmd;
|
|
324
366
|
return __generator(this, function (_c) {
|
|
325
367
|
if (platform === 'mp-weixin') {
|
|
326
|
-
runParallelAllUni(
|
|
368
|
+
runParallelAllUni(cmd);
|
|
327
369
|
}
|
|
328
370
|
return [2 /*return*/];
|
|
329
371
|
});
|
package/dist/cli.mjs.js
CHANGED
|
@@ -7,6 +7,7 @@ import 'crypto';
|
|
|
7
7
|
import 'chokidar';
|
|
8
8
|
import { execSync } from 'child_process';
|
|
9
9
|
import inquirer from 'inquirer';
|
|
10
|
+
import yaml from 'js-yaml';
|
|
10
11
|
|
|
11
12
|
/******************************************************************************
|
|
12
13
|
Copyright (c) Microsoft Corporation.
|
|
@@ -63,6 +64,16 @@ function __generator(thisArg, body) {
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
function __spreadArray(to, from, pack) {
|
|
68
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
69
|
+
if (ar || !(i in from)) {
|
|
70
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
71
|
+
ar[i] = from[i];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
75
|
+
}
|
|
76
|
+
|
|
66
77
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
67
78
|
var e = new Error(message);
|
|
68
79
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -98,6 +109,9 @@ function uniReadFile(filaPath) {
|
|
|
98
109
|
* @returns {void}
|
|
99
110
|
*/
|
|
100
111
|
function writeFiles(filaPath, content) {
|
|
112
|
+
if (typeof content === "object" && content) {
|
|
113
|
+
content = JSON.stringify(content, null, 2);
|
|
114
|
+
}
|
|
101
115
|
// 检查文件路径是否存在
|
|
102
116
|
var dir = path.dirname(filaPath);
|
|
103
117
|
if (!fs.existsSync(dir)) {
|
|
@@ -130,7 +144,7 @@ var unlinkDeepDirOrFile = function (filePath) {
|
|
|
130
144
|
};
|
|
131
145
|
|
|
132
146
|
// 项目 Git 子模块路径
|
|
133
|
-
var PROJECT_GIT_PATH = "
|
|
147
|
+
var PROJECT_GIT_PATH = "./sub-repo";
|
|
134
148
|
// CDN 文件保存路径
|
|
135
149
|
path.join(process.cwd(), "node_modules/@dd-code/uni-files");
|
|
136
150
|
path.join(process.cwd(), "node_modules/@dd-code/__main-pwd.txt");
|
|
@@ -199,30 +213,6 @@ var excuteUniCommand = function (command, opt) { return __awaiter(void 0, void 0
|
|
|
199
213
|
process.env.MFE_TARGET_DIR = (opt === null || opt === void 0 ? void 0 : opt.buildDir) || "";
|
|
200
214
|
_a = opt || {}, isRoot = _a.isRoot, appCode = _a.appCode;
|
|
201
215
|
cmd = "".concat(command, " ").concat(!isRoot ? "--subpackage=".concat(appCode) : "");
|
|
202
|
-
// if (isRoot) {
|
|
203
|
-
// const mfeJson = getMfeJson();
|
|
204
|
-
// const apps = mfeJson.apps?.map((i) => i.appCode) || [];
|
|
205
|
-
// apps.forEach((appCode) => {
|
|
206
|
-
// const appCodeDir = appCode.replace(/\//g, "_");
|
|
207
|
-
// // console.log(appCodeDir, 'appCodeDir');
|
|
208
|
-
// const childPath = path.join(process.cwd(), PROJECT_GIT_PATH, appCodeDir);
|
|
209
|
-
// console.log(existsSync(appCodeDir), childPath, "childPath");
|
|
210
|
-
// // if (existsSync(appCodeDir)) {
|
|
211
|
-
// // excuteUniCommand(`cd ${childPath} && ${command}`, {
|
|
212
|
-
// // appCode,
|
|
213
|
-
// // target: appCodeDir,
|
|
214
|
-
// // });
|
|
215
|
-
// // 开一个子线程启动
|
|
216
|
-
// // execSync(cmd, {
|
|
217
|
-
// // stdio: "inherit",
|
|
218
|
-
// // });
|
|
219
|
-
// // }
|
|
220
|
-
// });
|
|
221
|
-
// // setTimeout(() => {
|
|
222
|
-
// // console.log(process.env.UNI_OUTPUT_DIR, "process.env.UNI_OUTPUT_DIR");
|
|
223
|
-
// // });
|
|
224
|
-
// }
|
|
225
|
-
// console.log(cmd, "-------");
|
|
226
216
|
execSync(cmd, {
|
|
227
217
|
stdio: "inherit",
|
|
228
218
|
});
|
|
@@ -234,14 +224,59 @@ var excuteUniCommand = function (command, opt) { return __awaiter(void 0, void 0
|
|
|
234
224
|
var inquirerPrompt = ((inquirer === null || inquirer === void 0 ? void 0 : inquirer.default) ||
|
|
235
225
|
inquirer);
|
|
236
226
|
|
|
227
|
+
var parseYaml = function (content) {
|
|
228
|
+
try {
|
|
229
|
+
return yaml.load(content, { json: true });
|
|
230
|
+
}
|
|
231
|
+
catch (e) {
|
|
232
|
+
return '';
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
var dumpYaml = function (content) {
|
|
236
|
+
try {
|
|
237
|
+
return yaml.dump(content, {
|
|
238
|
+
// 可选配置:保证中文等 Unicode 字符正常显示(不转义)
|
|
239
|
+
skipInvalid: true,
|
|
240
|
+
encoding: 'utf8',
|
|
241
|
+
// 可选:设置缩进空格数,增强可读性
|
|
242
|
+
indent: 2
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
catch (e) {
|
|
246
|
+
return '';
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
var writeChildWorkspace = function (content) {
|
|
251
|
+
var configPath = path.join(process.cwd(), "pnpm-workspace.yaml");
|
|
252
|
+
var fileContent = parseYaml(uniReadFile(configPath));
|
|
253
|
+
if (!fileContent) {
|
|
254
|
+
// fileContent = "packages:\n";
|
|
255
|
+
fileContent = {
|
|
256
|
+
packages: [
|
|
257
|
+
'.',
|
|
258
|
+
]
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
var packages = new Set(__spreadArray(__spreadArray([], fileContent.packages, true), [content + '/*'], false));
|
|
262
|
+
fileContent.packages = Array.from(packages);
|
|
263
|
+
var str = dumpYaml(fileContent);
|
|
264
|
+
writeFiles(configPath, str);
|
|
265
|
+
};
|
|
237
266
|
var fetchAppsRepo = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
238
|
-
var mfeJson, apps, answers, selectedApps, selectedGitApps;
|
|
267
|
+
var mfeJson, apps, answers, selectedApps, childPath, selectedGitApps;
|
|
239
268
|
return __generator(this, function (_a) {
|
|
240
269
|
switch (_a.label) {
|
|
241
270
|
case 0:
|
|
242
271
|
mfeJson = getMfeJson();
|
|
243
272
|
apps = (mfeJson === null || mfeJson === void 0 ? void 0 : mfeJson.apps) || [];
|
|
244
273
|
return [4 /*yield*/, inquirerPrompt.prompt([
|
|
274
|
+
{
|
|
275
|
+
type: 'input',
|
|
276
|
+
name: "dir",
|
|
277
|
+
message: "请输入子模块路径:",
|
|
278
|
+
default: PROJECT_GIT_PATH,
|
|
279
|
+
},
|
|
245
280
|
{
|
|
246
281
|
type: "checkbox",
|
|
247
282
|
name: "selectedApps",
|
|
@@ -255,19 +290,24 @@ var fetchAppsRepo = function () { return __awaiter(void 0, void 0, void 0, funct
|
|
|
255
290
|
case 1:
|
|
256
291
|
answers = _a.sent();
|
|
257
292
|
selectedApps = answers.selectedApps;
|
|
293
|
+
childPath = answers.dir;
|
|
258
294
|
selectedGitApps = apps.filter(function (app) { return selectedApps.includes(app.appCode) && app.repoUrl; });
|
|
259
|
-
console.log("选择的应用仓库:", selectedGitApps);
|
|
295
|
+
// console.log("选择的应用仓库:", selectedGitApps);
|
|
260
296
|
// 执行拉取操作
|
|
261
297
|
selectedGitApps.forEach(function (_a) {
|
|
262
298
|
var appCode = _a.appCode, repoUrl = _a.repoUrl;
|
|
263
299
|
if (repoUrl) {
|
|
264
300
|
var fileName = appCode.replace(/\//g, "_");
|
|
265
|
-
var dir =
|
|
301
|
+
var dir = childPath;
|
|
266
302
|
unlinkDeepDirOrFile(path.join(dir, fileName));
|
|
267
303
|
checkAndgenreDir(dir);
|
|
268
304
|
execSync("cd ".concat(dir, " && git clone ").concat(repoUrl, " ").concat(fileName), {
|
|
269
305
|
stdio: "inherit",
|
|
270
306
|
});
|
|
307
|
+
writeChildWorkspace(dir);
|
|
308
|
+
// execSync(`cd ${dir} && git clone ${repoUrl} ${fileName}`, {
|
|
309
|
+
// stdio: "inherit",
|
|
310
|
+
// });
|
|
271
311
|
}
|
|
272
312
|
});
|
|
273
313
|
return [2 /*return*/];
|
|
@@ -276,20 +316,22 @@ var fetchAppsRepo = function () { return __awaiter(void 0, void 0, void 0, funct
|
|
|
276
316
|
}); };
|
|
277
317
|
|
|
278
318
|
var runParallelAllUni = function (cmd) { return __awaiter(void 0, void 0, void 0, function () {
|
|
279
|
-
var configPath;
|
|
280
319
|
return __generator(this, function (_a) {
|
|
281
|
-
configPath = path.join(process.cwd(), "pnpm-workspace.yaml");
|
|
282
|
-
writeFiles(configPath, "packages:\n - '*'\n - 'src/subtree/*'");
|
|
283
320
|
// pnpm -r --parallel --workspace-root --filter=* run dev:mp-weixin --b root
|
|
284
321
|
execSync("pnpm -r --parallel --workspace-root --filter=* run ".concat(cmd, " --b root"), {
|
|
285
322
|
stdio: "inherit",
|
|
286
323
|
});
|
|
287
|
-
// 删除文件
|
|
288
|
-
fs.unlinkSync(configPath);
|
|
289
324
|
return [2 /*return*/];
|
|
290
325
|
});
|
|
291
326
|
}); };
|
|
292
327
|
|
|
328
|
+
/**
|
|
329
|
+
* CLI 命令
|
|
330
|
+
* - serve:开发态运行,支持 `-p` 平台、`--mode` 模式、`--b` 目标路径
|
|
331
|
+
* - build:生产构建,支持平台/模式;mp-weixin 下根据 isRoot/appCode 进行差异化参数
|
|
332
|
+
* - fetch:交互式拉取子应用仓库(选择 apps 列表并 clone 到本地)
|
|
333
|
+
* - runAll:并行启动所有 mp-weixin 项目
|
|
334
|
+
*/
|
|
293
335
|
var addUniOptions = function (program) {
|
|
294
336
|
return program
|
|
295
337
|
.option("-p <platform>", "平台", "h5")
|
|
@@ -317,11 +359,11 @@ fetchGit.action(function () { return __awaiter(void 0, void 0, void 0, function
|
|
|
317
359
|
// pushCdn.option("--mode <mode>", "模式", "dev").action(({ mode }) => {
|
|
318
360
|
// pushDistToCdn(mode);
|
|
319
361
|
// });
|
|
320
|
-
addUniOptions(runAll).action(function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
321
|
-
_b.mode; var platform = _b.p
|
|
362
|
+
addUniOptions(runAll).option("--cmd <execCmd>", "启动命令", "dev:mp-weixin").action(function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
363
|
+
_b.mode; var platform = _b.p, cmd = _b.cmd;
|
|
322
364
|
return __generator(this, function (_c) {
|
|
323
365
|
if (platform === 'mp-weixin') {
|
|
324
|
-
runParallelAllUni(
|
|
366
|
+
runParallelAllUni(cmd);
|
|
325
367
|
}
|
|
326
368
|
return [2 /*return*/];
|
|
327
369
|
});
|