@oipage/cli 0.2.1 → 0.3.0-alpha.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/.github/FUNDING.yml +11 -11
- package/AUTHORS.txt +6 -6
- package/CHANGELOG +40 -21
- package/LICENSE +20 -20
- package/README.md +132 -132
- package/bin/WebSocket/decodeWsFrame.js +43 -43
- package/bin/WebSocket/encodeWsFrame.js +28 -28
- package/bin/WebSocket/headersToJSON.js +26 -26
- package/bin/WebSocket/index.js +106 -83
- package/bin/data/mineTypes.json +104 -104
- package/bin/disk.js +42 -42
- package/bin/help.js +53 -50
- package/bin/intercept.js +15 -15
- package/bin/network.js +21 -21
- package/bin/notebook/index.js +9 -0
- package/bin/proxy.js +82 -75
- package/bin/run +142 -134
- package/bin/serve.js +245 -195
- package/bin/template/404.html +184 -184
- package/bin/tools/deleteEmptyFolder.js +33 -33
- package/bin/tools/format.js +75 -75
- package/bin/tools/network.js +42 -42
- package/bin/tools/openBrowser.js +34 -25
- package/bin/tools/resolve404.js +98 -83
- package/bin/tools/resolveImport.js +89 -88
- package/bin/website-htmls/components/ui-select-file/index.html +8 -8
- package/bin/website-htmls/components/ui-select-file/index.js +42 -42
- package/bin/website-htmls/components/ui-select-file/index.scss +44 -44
- package/bin/website-htmls/dialogs/imageSize/index.html +54 -54
- package/bin/website-htmls/dialogs/imageSize/index.js +53 -53
- package/bin/website-htmls/dialogs/imageSize/index.scss +140 -140
- package/bin/website-htmls/dialogs/index.js +52 -52
- package/bin/website-htmls/images/addFile.svg +1 -1
- package/bin/website-htmls/images/img-to-pdf.svg +1 -1
- package/bin/website-htmls/index.html +17 -17
- package/bin/website-htmls/main.js +13 -13
- package/bin/website-htmls/pages/App/index.html +6 -6
- package/bin/website-htmls/pages/App/index.js +22 -22
- package/bin/website-htmls/pages/App/index.scss +43 -43
- package/bin/website-htmls/pages/appStore/index.html +7 -7
- package/bin/website-htmls/pages/appStore/index.js +19 -19
- package/bin/website-htmls/pages/appStore/index.scss +54 -54
- package/bin/website-htmls/pages/chart/index.html +8 -8
- package/bin/website-htmls/pages/chart/index.js +72 -72
- package/bin/website-htmls/pages/chart/index.scss +71 -71
- package/bin/website-htmls/pages/home/index.html +19 -19
- package/bin/website-htmls/pages/home/index.js +19 -19
- package/bin/website-htmls/pages/home/index.scss +87 -87
- package/bin/website-htmls/pages/image-editor/index.html +27 -27
- package/bin/website-htmls/pages/image-editor/index.js +106 -106
- package/bin/website-htmls/pages/image-editor/index.scss +69 -69
- package/bin/website-htmls/pages/img-to-pdf/index.html +3 -3
- package/bin/website-htmls/pages/img-to-pdf/index.js +44 -44
- package/bin/website-htmls/pages/img-to-pdf/index.scss +9 -9
- package/bin/website-htmls/pages/recorder-screen/index.html +15 -15
- package/bin/website-htmls/pages/recorder-screen/index.js +227 -227
- package/bin/website-htmls/pages/recorder-screen/index.scss +52 -52
- package/bin/website-htmls/router.config.js +29 -29
- package/bin/website-htmls/styles/common.css +44 -44
- package/bin/website-htmls/styles/normalize.css +94 -94
- package/bin/website-plugins/intercept/chart.js +33 -33
- package/bin/website-plugins/intercept/getPackage.js +17 -17
- package/bin/website-plugins/intercept/head.js +8 -8
- package/bin/website-plugins/intercept/index.js +8 -8
- package/bin/website-plugins/intercept/oipage-vislite-intercept.js +55 -55
- package/bin/website-plugins/intercept/oipage-zipaper-intercept.js +36 -36
- package/bin/website-plugins/loader/index.js +11 -11
- package/bin/website-plugins/loader/oipage-html-loader.js +7 -7
- package/bin/website-plugins/loader/oipage-scss-loader.js +149 -149
- package/docs/config.md +84 -84
- package/package.json +42 -42
- package/src/index.js +28 -28
- package/types/serve.d.ts +76 -76
package/bin/network.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const networkInfo = require("./tools/network");
|
|
2
|
-
|
|
3
|
-
module.exports = function (config) {
|
|
4
|
-
let info = networkInfo(true);
|
|
5
|
-
|
|
6
|
-
// 执行一个个任务
|
|
7
|
-
for (let i = 0; i < config.value.length; i++) {
|
|
8
|
-
|
|
9
|
-
// 打印信息
|
|
10
|
-
if (config.value[i].name === "--log") {
|
|
11
|
-
|
|
12
|
-
for (let iptype of ["IPv4", "IPv6"]) {
|
|
13
|
-
console.log("\n" + iptype);
|
|
14
|
-
for (let i = 0; i < info[iptype].length; i++) {
|
|
15
|
-
console.log(" \x1b[1m\x1b[32m" + info[iptype][i].address + "\x1b[0m " + info[iptype][i].mac);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
console.log("");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
const networkInfo = require("./tools/network");
|
|
2
|
+
|
|
3
|
+
module.exports = function (config) {
|
|
4
|
+
let info = networkInfo(true);
|
|
5
|
+
|
|
6
|
+
// 执行一个个任务
|
|
7
|
+
for (let i = 0; i < config.value.length; i++) {
|
|
8
|
+
|
|
9
|
+
// 打印信息
|
|
10
|
+
if (config.value[i].name === "--log") {
|
|
11
|
+
|
|
12
|
+
for (let iptype of ["IPv4", "IPv6"]) {
|
|
13
|
+
console.log("\n" + iptype);
|
|
14
|
+
for (let i = 0; i < info[iptype].length; i++) {
|
|
15
|
+
console.log(" \x1b[1m\x1b[32m" + info[iptype][i].address + "\x1b[0m " + info[iptype][i].mac);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
console.log("");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
22
|
};
|
package/bin/proxy.js
CHANGED
|
@@ -1,75 +1,82 @@
|
|
|
1
|
-
const https = require('https');
|
|
2
|
-
const http = require('http');
|
|
3
|
-
|
|
4
|
-
module.exports = function (args, proxy) {
|
|
5
|
-
|
|
6
|
-
let intercept = [];
|
|
7
|
-
for (let key in proxy) {
|
|
8
|
-
intercept.push({
|
|
9
|
-
test: new RegExp("^" + key),
|
|
10
|
-
handler(request, response) {
|
|
11
|
-
let proxyItem = proxy[key];
|
|
12
|
-
|
|
13
|
-
let throwError = function (err) {
|
|
14
|
-
response.writeHead(500, {
|
|
15
|
-
'Content-Type': "text/plain;charset=utf-8",
|
|
16
|
-
'Access-Control-Allow-Origin': '*',
|
|
17
|
-
'Server': 'Powered by ' + args.name + "@" + args.version + ' proxy'
|
|
18
|
-
});
|
|
19
|
-
response.write(err);
|
|
20
|
-
response.end();
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
let headers = request.headers;
|
|
24
|
-
let url
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const http = require('http');
|
|
3
|
+
|
|
4
|
+
module.exports = function (args, proxy) {
|
|
5
|
+
|
|
6
|
+
let intercept = [];
|
|
7
|
+
for (let key in proxy) {
|
|
8
|
+
intercept.push({
|
|
9
|
+
test: new RegExp("^" + key),
|
|
10
|
+
handler(request, response) {
|
|
11
|
+
let proxyItem = proxy[key];
|
|
12
|
+
|
|
13
|
+
let throwError = function (err) {
|
|
14
|
+
response.writeHead(500, {
|
|
15
|
+
'Content-Type': "text/plain;charset=utf-8",
|
|
16
|
+
'Access-Control-Allow-Origin': '*',
|
|
17
|
+
'Server': 'Powered by ' + args.name + "@" + args.version + ' proxy'
|
|
18
|
+
});
|
|
19
|
+
response.write(err);
|
|
20
|
+
response.end();
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
let headers = request.headers;
|
|
24
|
+
let url
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
url = decodeURIComponent(request.url);
|
|
28
|
+
} catch (e) {
|
|
29
|
+
console.log("decodeURIComponent error: ", e);
|
|
30
|
+
throw e;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (proxyItem.pathRewrite) {
|
|
34
|
+
for (let pathRewrite_key in proxyItem.pathRewrite) {
|
|
35
|
+
url = url.replace(new RegExp(pathRewrite_key), proxyItem.pathRewrite[pathRewrite_key]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let fullUrl = proxy[key].target + url;
|
|
40
|
+
|
|
41
|
+
let handler = /^https/.test(url) ? https : http;
|
|
42
|
+
|
|
43
|
+
let execArray = /https*:\/\/([^\/]+)(.+)?/.exec(fullUrl);
|
|
44
|
+
let hostport = execArray[1].split(":");
|
|
45
|
+
|
|
46
|
+
// 创建与目标服务器的连接
|
|
47
|
+
const req = handler.request({
|
|
48
|
+
hostname: hostport[0],
|
|
49
|
+
port: hostport[1] || 80,
|
|
50
|
+
path: execArray[2] || "/",
|
|
51
|
+
method: request.method,
|
|
52
|
+
headers
|
|
53
|
+
}, (res) => {
|
|
54
|
+
|
|
55
|
+
let resHeaders = {
|
|
56
|
+
...res.headers
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// 标记响应服务器
|
|
60
|
+
delete resHeaders["server"];
|
|
61
|
+
resHeaders["Server"] = 'Powered by ' + args.name + "@" + args.version + ' proxy';
|
|
62
|
+
|
|
63
|
+
// 设置响应头
|
|
64
|
+
response.writeHead(res.statusCode, resHeaders);
|
|
65
|
+
// 流式传输响应体
|
|
66
|
+
res.pipe(response);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// 错误处理
|
|
70
|
+
req.on('error', (e) => {
|
|
71
|
+
throwError(e.message);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// 将原始请求体传递给目标服务器
|
|
75
|
+
request.pipe(req);
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return intercept;
|
|
82
|
+
};
|
package/bin/run
CHANGED
|
@@ -1,134 +1,142 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
process.title = '@oipage/cli';
|
|
6
|
-
|
|
7
|
-
const { spawn } = require('child_process');
|
|
8
|
-
const { join } = require("path");
|
|
9
|
-
const { existsSync, lstatSync } = require("fs");
|
|
10
|
-
const { mergeOption } = require("oipage/nodejs/option/index");
|
|
11
|
-
const { formatArgv } = require("./tools/format.js");
|
|
12
|
-
|
|
13
|
-
// 开发服务器
|
|
14
|
-
if (process.argv[2] === "serve") {
|
|
15
|
-
|
|
16
|
-
let argvObj = formatArgv(process.argv, {
|
|
17
|
-
"-p": "--port",
|
|
18
|
-
"-c": "--config"
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
let config = {
|
|
22
|
-
devServer: {
|
|
23
|
-
port: 8080,
|
|
24
|
-
baseUrl: "./",
|
|
25
|
-
open: false,
|
|
26
|
-
cache: true,
|
|
27
|
-
proxy: {},
|
|
28
|
-
intercept: [],
|
|
29
|
-
404: null,
|
|
30
|
-
website: true
|
|
31
|
-
},
|
|
32
|
-
module: {
|
|
33
|
-
rules: []
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
if (argvObj["--proxy"] && argvObj["--proxy"].length === 2) {
|
|
38
|
-
config.devServer.proxy[argvObj["--proxy"][0]] = {
|
|
39
|
-
target: argvObj["--proxy"][1],
|
|
40
|
-
pathRewrite: { ['^' + argvObj["--proxy"][0]]: '' }
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// 如果设置了配置文件
|
|
45
|
-
if (argvObj["--config"]) {
|
|
46
|
-
let configPath = join(process.cwd(), argvObj["--config"][0] || "./oipage.config.js");
|
|
47
|
-
if (existsSync(configPath) && !lstatSync(configPath).isDirectory()) {
|
|
48
|
-
let configValue = require(configPath);
|
|
49
|
-
mergeOption(config, configValue);
|
|
50
|
-
} else {
|
|
51
|
-
console.log("\x1b[0m\x1b[31m" + configPath + "\x1b[0m");
|
|
52
|
-
throw new Error("OIPage: The configuration file does not exist or is not a file.");
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (argvObj["--port"]) config.devServer.port = argvObj["--port"][0];
|
|
57
|
-
if (argvObj["--baseUrl"]) config.devServer.baseUrl = argvObj["--baseUrl"][0];
|
|
58
|
-
if (argvObj["--cache"]) config.devServer.cache = argvObj["--cache"][0] === "true";
|
|
59
|
-
if (argvObj["--open"]) config.devServer.open = argvObj["--open"][0] || true;
|
|
60
|
-
if (argvObj["--website"]) config.devServer.website = argvObj["--website"][0] === "true";
|
|
61
|
-
|
|
62
|
-
require("./serve.js")(config);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// 磁盘操作
|
|
66
|
-
else if (process.argv[2] === "disk") {
|
|
67
|
-
|
|
68
|
-
let argvObj = formatArgv(process.argv, {
|
|
69
|
-
"-f": "--force",
|
|
70
|
-
"-d": "--delete",
|
|
71
|
-
"-m": "--move",
|
|
72
|
-
"-c": "--copy",
|
|
73
|
-
"-l": "--link"
|
|
74
|
-
}, true);
|
|
75
|
-
|
|
76
|
-
require("./disk.js")(argvObj);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// 运行多命令
|
|
80
|
-
else if (process.argv[2] === "run") {
|
|
81
|
-
|
|
82
|
-
let argvObj = formatArgv(process.argv, {});
|
|
83
|
-
|
|
84
|
-
let tasks = [], runArgs = [];
|
|
85
|
-
for (let index = 0; index < argvObj.args.length; index++) {
|
|
86
|
-
|
|
87
|
-
// 参数
|
|
88
|
-
if (/^:/.test(argvObj.args[index])) {
|
|
89
|
-
runArgs.push(argvObj.args[index].replace(/^:/, ""));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// 任务
|
|
93
|
-
else {
|
|
94
|
-
tasks.push(argvObj.args[index]);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
for (let index = 0; index < tasks.length; index++) {
|
|
99
|
-
|
|
100
|
-
// 补充动态参数的支持
|
|
101
|
-
// npm run bug:issue5 ":-p 9090"
|
|
102
|
-
// 2025年12月1日 于南京
|
|
103
|
-
let task = (tasks[index] + (runArgs[index] ? (" " + runArgs[index]) : "")).split(" ");
|
|
104
|
-
let command = task.shift();
|
|
105
|
-
|
|
106
|
-
// 修复exec无法正常使用logform问题
|
|
107
|
-
// npm run bug:issue4
|
|
108
|
-
// 2025年12月2日 于南京
|
|
109
|
-
spawn(command, task, {
|
|
110
|
-
|
|
111
|
-
// https://nodejs.org/api/child_process.html#child_process_options_stdio
|
|
112
|
-
stdio: 'inherit',
|
|
113
|
-
|
|
114
|
-
// 修复https://github.com/oi-contrib/OIPage/issues/8
|
|
115
|
-
// 在Unix系统中使用`/bin/sh`,在Windows系统中使用`process.env.ComSpec`
|
|
116
|
-
// 2025年12月28日 于南京
|
|
117
|
-
shell: true
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// 网络相关
|
|
124
|
-
else if (process.argv[2] === "network") {
|
|
125
|
-
|
|
126
|
-
let argvObj = formatArgv(process.argv, {}, true);
|
|
127
|
-
|
|
128
|
-
require("./network.js")(argvObj);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
//
|
|
132
|
-
else {
|
|
133
|
-
|
|
134
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
process.title = '@oipage/cli';
|
|
6
|
+
|
|
7
|
+
const { spawn } = require('child_process');
|
|
8
|
+
const { join } = require("path");
|
|
9
|
+
const { existsSync, lstatSync } = require("fs");
|
|
10
|
+
const { mergeOption } = require("oipage/nodejs/option/index");
|
|
11
|
+
const { formatArgv } = require("./tools/format.js");
|
|
12
|
+
|
|
13
|
+
// 开发服务器
|
|
14
|
+
if (process.argv[2] === "serve") {
|
|
15
|
+
|
|
16
|
+
let argvObj = formatArgv(process.argv, {
|
|
17
|
+
"-p": "--port",
|
|
18
|
+
"-c": "--config"
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
let config = {
|
|
22
|
+
devServer: {
|
|
23
|
+
port: 8080,
|
|
24
|
+
baseUrl: "./",
|
|
25
|
+
open: false,
|
|
26
|
+
cache: true,
|
|
27
|
+
proxy: {},
|
|
28
|
+
intercept: [],
|
|
29
|
+
404: null,
|
|
30
|
+
website: true
|
|
31
|
+
},
|
|
32
|
+
module: {
|
|
33
|
+
rules: []
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
if (argvObj["--proxy"] && argvObj["--proxy"].length === 2) {
|
|
38
|
+
config.devServer.proxy[argvObj["--proxy"][0]] = {
|
|
39
|
+
target: argvObj["--proxy"][1],
|
|
40
|
+
pathRewrite: { ['^' + argvObj["--proxy"][0]]: '' }
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 如果设置了配置文件
|
|
45
|
+
if (argvObj["--config"]) {
|
|
46
|
+
let configPath = join(process.cwd(), argvObj["--config"][0] || "./oipage.config.js");
|
|
47
|
+
if (existsSync(configPath) && !lstatSync(configPath).isDirectory()) {
|
|
48
|
+
let configValue = require(configPath);
|
|
49
|
+
mergeOption(config, configValue);
|
|
50
|
+
} else {
|
|
51
|
+
console.log("\x1b[0m\x1b[31m" + configPath + "\x1b[0m");
|
|
52
|
+
throw new Error("OIPage: The configuration file does not exist or is not a file.");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (argvObj["--port"]) config.devServer.port = argvObj["--port"][0];
|
|
57
|
+
if (argvObj["--baseUrl"]) config.devServer.baseUrl = argvObj["--baseUrl"][0];
|
|
58
|
+
if (argvObj["--cache"]) config.devServer.cache = argvObj["--cache"][0] === "true";
|
|
59
|
+
if (argvObj["--open"]) config.devServer.open = argvObj["--open"][0] || true;
|
|
60
|
+
if (argvObj["--website"]) config.devServer.website = argvObj["--website"][0] === "true";
|
|
61
|
+
|
|
62
|
+
require("./serve.js")(config);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 磁盘操作
|
|
66
|
+
else if (process.argv[2] === "disk") {
|
|
67
|
+
|
|
68
|
+
let argvObj = formatArgv(process.argv, {
|
|
69
|
+
"-f": "--force",
|
|
70
|
+
"-d": "--delete",
|
|
71
|
+
"-m": "--move",
|
|
72
|
+
"-c": "--copy",
|
|
73
|
+
"-l": "--link"
|
|
74
|
+
}, true);
|
|
75
|
+
|
|
76
|
+
require("./disk.js")(argvObj);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 运行多命令
|
|
80
|
+
else if (process.argv[2] === "run") {
|
|
81
|
+
|
|
82
|
+
let argvObj = formatArgv(process.argv, {});
|
|
83
|
+
|
|
84
|
+
let tasks = [], runArgs = [];
|
|
85
|
+
for (let index = 0; index < argvObj.args.length; index++) {
|
|
86
|
+
|
|
87
|
+
// 参数
|
|
88
|
+
if (/^:/.test(argvObj.args[index])) {
|
|
89
|
+
runArgs.push(argvObj.args[index].replace(/^:/, ""));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// 任务
|
|
93
|
+
else {
|
|
94
|
+
tasks.push(argvObj.args[index]);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for (let index = 0; index < tasks.length; index++) {
|
|
99
|
+
|
|
100
|
+
// 补充动态参数的支持
|
|
101
|
+
// npm run bug:issue5 ":-p 9090"
|
|
102
|
+
// 2025年12月1日 于南京
|
|
103
|
+
let task = (tasks[index] + (runArgs[index] ? (" " + runArgs[index]) : "")).split(" ");
|
|
104
|
+
let command = task.shift();
|
|
105
|
+
|
|
106
|
+
// 修复exec无法正常使用logform问题
|
|
107
|
+
// npm run bug:issue4
|
|
108
|
+
// 2025年12月2日 于南京
|
|
109
|
+
spawn(command, task, {
|
|
110
|
+
|
|
111
|
+
// https://nodejs.org/api/child_process.html#child_process_options_stdio
|
|
112
|
+
stdio: 'inherit',
|
|
113
|
+
|
|
114
|
+
// 修复https://github.com/oi-contrib/OIPage/issues/8
|
|
115
|
+
// 在Unix系统中使用`/bin/sh`,在Windows系统中使用`process.env.ComSpec`
|
|
116
|
+
// 2025年12月28日 于南京
|
|
117
|
+
shell: true
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// 网络相关
|
|
124
|
+
else if (process.argv[2] === "network") {
|
|
125
|
+
|
|
126
|
+
let argvObj = formatArgv(process.argv, {}, true);
|
|
127
|
+
|
|
128
|
+
require("./network.js")(argvObj);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// 快速笔记
|
|
132
|
+
else if (process.argv[2] === "notebook") {
|
|
133
|
+
|
|
134
|
+
let argvObj = formatArgv(process.argv, {}, true);
|
|
135
|
+
|
|
136
|
+
require("./notebook/index.js")(argvObj);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// 默认,帮助
|
|
140
|
+
else {
|
|
141
|
+
require("./help.js")();
|
|
142
|
+
}
|