@tego/devkit 1.3.51 → 1.3.53
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/lib/commands/build.mjs +0 -2
- package/lib/commands/clean.mjs +1 -5
- package/lib/commands/dev.mjs +99 -4
- package/lib/commands/global.mjs +10 -14
- package/lib/commands/index.mjs +2 -2
- package/lib/commands/install.mjs +3 -6
- package/lib/commands/p-test.mjs +0 -1
- package/lib/commands/postinstall.mjs +1 -16
- package/lib/commands/tar.mjs +0 -2
- package/lib/commands/ui.mjs +160 -0
- package/lib/commands/upgrade.mjs +3 -6
- package/lib/util.mjs +35 -138
- package/package.json +25 -19
- package/lib/commands/test.mjs +0 -70
package/lib/commands/build.mjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// src/commands/build.ts
|
|
2
2
|
import { TachybaseBuilder } from "../builder/index.mjs";
|
|
3
|
-
import { nodeCheck } from "../util.mjs";
|
|
4
3
|
var build_default = (cli) => {
|
|
5
4
|
cli.command("build").allowUnknownOption().argument("[packages...]").option("-r, --retry", "retry the last failed package").option("-s, --sourcemap", "generate server sourcemap").option("--no-dts", "not generate dts").option("--tar", "tar the package").option("--only-tar", "only tar the package").option("--development", "development mode").action(async (pkgs, options) => {
|
|
6
|
-
nodeCheck();
|
|
7
5
|
const tachybaseBuilder = new TachybaseBuilder({
|
|
8
6
|
dts: options.dts,
|
|
9
7
|
sourcemap: options.sourcemap,
|
package/lib/commands/clean.mjs
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
// src/commands/clean.ts
|
|
2
2
|
import { rimrafSync } from "rimraf";
|
|
3
|
-
import { isDev } from "../util.mjs";
|
|
4
3
|
var clean_default = (cli) => {
|
|
5
4
|
cli.command("clean").option("--all").allowUnknownOption().action((opts) => {
|
|
6
|
-
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
rimrafSync("{packages}/*/{lib,esm,es,dist,node_modules}", { glob: true });
|
|
5
|
+
rimrafSync("packages/*/{lib,esm,es,dist,node_modules}", { glob: true });
|
|
10
6
|
if (opts.all) {
|
|
11
7
|
rimrafSync("node_modules", { glob: true });
|
|
12
8
|
}
|
package/lib/commands/dev.mjs
CHANGED
|
@@ -1,15 +1,108 @@
|
|
|
1
1
|
// src/commands/dev.ts
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { confirm, input, select } from "@inquirer/prompts";
|
|
2
5
|
import { createRsbuild, loadConfig } from "@rsbuild/core";
|
|
3
6
|
import { getPortPromise } from "portfinder";
|
|
4
|
-
import
|
|
7
|
+
import simpleGit from "simple-git";
|
|
8
|
+
import { fsExists, postCheck, promptForTs, run, runAppCommand } from "../util.mjs";
|
|
9
|
+
async function prepare() {
|
|
10
|
+
const git = simpleGit();
|
|
11
|
+
const branch = (await git.branch()).current;
|
|
12
|
+
let runtime = branch.replace(/\//g, "__");
|
|
13
|
+
let runtimeDir = path.resolve(process.env.TEGO_HOME, runtime);
|
|
14
|
+
let settingsFile = path.join(runtimeDir, "settings.js");
|
|
15
|
+
console.log(process.env.TEGO_HOME);
|
|
16
|
+
const result = [];
|
|
17
|
+
const rootDir = process.env.TEGO_HOME;
|
|
18
|
+
let runtimeIncludes = false;
|
|
19
|
+
for (const entry of fs.readdirSync(rootDir)) {
|
|
20
|
+
const fullPath = path.join(rootDir, entry);
|
|
21
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
22
|
+
const settingsPath = path.join(fullPath, "settings.js");
|
|
23
|
+
if (fs.existsSync(settingsPath)) {
|
|
24
|
+
if (fullPath === runtimeDir) {
|
|
25
|
+
runtimeIncludes = true;
|
|
26
|
+
}
|
|
27
|
+
result.push(entry);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (fs.existsSync(path.join(process.cwd(), "storage"))) {
|
|
32
|
+
result.push(process.cwd());
|
|
33
|
+
}
|
|
34
|
+
if (!runtimeIncludes) {
|
|
35
|
+
result.push("\u4EE5\u5F53\u524D\u5206\u652F\u521B\u5EFA\u76EE\u5F55");
|
|
36
|
+
}
|
|
37
|
+
result.push("\u521B\u5EFA\u65B0\u7684\u914D\u7F6E\u76EE\u5F55\uFF0C\u8BF7\u6307\u5B9A");
|
|
38
|
+
const selected = await select({
|
|
39
|
+
message: "\u8BF7\u9009\u62E9\u4E00\u4E2A\u76EE\u5F55",
|
|
40
|
+
default: runtimeIncludes ? runtime : process.cwd(),
|
|
41
|
+
choices: result.map((item) => ({
|
|
42
|
+
name: item,
|
|
43
|
+
value: item
|
|
44
|
+
}))
|
|
45
|
+
});
|
|
46
|
+
if (selected === runtime) {
|
|
47
|
+
process.env.TEGO_RUNTIME_NAME = runtime;
|
|
48
|
+
process.env.TEGO_RUNTIME_HOME = runtimeDir;
|
|
49
|
+
return;
|
|
50
|
+
} else if (selected === "\u521B\u5EFA\u65B0\u7684\u914D\u7F6E\u76EE\u5F55\uFF0C\u8BF7\u6307\u5B9A") {
|
|
51
|
+
runtime = await input({
|
|
52
|
+
message: "\u8BF7\u8F93\u5165\u65B0\u7684\u914D\u7F6E\u76EE\u5F55"
|
|
53
|
+
});
|
|
54
|
+
if (!runtime) {
|
|
55
|
+
console.log("\u8BF7\u8F93\u5165\u65B0\u7684\u914D\u7F6E\u76EE\u5F55");
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
runtimeDir = path.resolve(process.env.TEGO_HOME, runtime);
|
|
59
|
+
settingsFile = path.join(runtimeDir, "settings.js");
|
|
60
|
+
} else if (selected === "\u4EE5\u5F53\u524D\u5206\u652F\u521B\u5EFA\u76EE\u5F55") {
|
|
61
|
+
} else if (selected === process.cwd()) {
|
|
62
|
+
process.env.TEGO_RUNTIME_NAME = "__NO_RUNTIME_NAME__";
|
|
63
|
+
process.env.TEGO_RUNTIME_HOME = process.cwd();
|
|
64
|
+
} else {
|
|
65
|
+
process.env.TEGO_RUNTIME_NAME = selected;
|
|
66
|
+
process.env.TEGO_RUNTIME_HOME = path.join(process.env.TEGO_HOME, selected);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (!fs.existsSync(settingsFile)) {
|
|
70
|
+
const answer = await confirm({
|
|
71
|
+
message: `\u73AF\u5883 "${runtime}" \u5C1A\u672A\u521D\u59CB\u5316\uFF0C\u662F\u5426\u8981\u521D\u59CB\u5316\uFF1F`,
|
|
72
|
+
default: true
|
|
73
|
+
});
|
|
74
|
+
if (!answer) {
|
|
75
|
+
console.log("\u5DF2\u53D6\u6D88\u521D\u59CB\u5316");
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
process.env.TEGO_RUNTIME_NAME = runtime;
|
|
79
|
+
process.env.TEGO_RUNTIME_HOME = runtimeDir;
|
|
80
|
+
await runAppCommand("init", []);
|
|
81
|
+
const ok = await confirm({
|
|
82
|
+
message: `\u8BF7\u4FEE\u6539 ${settingsFile}\uFF0C\u8C03\u6574\u76F8\u5173\u914D\u7F6E\uFF0C\u786E\u8BA4\u540E\u4E0B\u4E00\u6B65`,
|
|
83
|
+
default: true
|
|
84
|
+
});
|
|
85
|
+
if (!ok) {
|
|
86
|
+
console.log("\u8BF7\u5B8C\u6210\u4FEE\u6539\u540E\u518D\u8FD0\u884C pnpm dev");
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
await runAppCommand("install", ["-f"]);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
5
92
|
var dev_default = (cli) => {
|
|
6
|
-
cli.command("dev").option("-p, --port [port]").option("--proxy-port [port]").option("--client").option("--server").option("--rs").option("-w, --wait-server").option("--no-open").option("--db-sync").option("--inspect [port]").allowUnknownOption().action(async (opts) => {
|
|
93
|
+
cli.command("dev").option("--no-prepare", "skip prepare").option("-p, --port [port]").option("--proxy-port [port]").option("--client").option("--server").option("--rs").option("-w, --wait-server").option("--no-open").option("--db-sync").option("--inspect [port]").allowUnknownOption().action(async (opts) => {
|
|
7
94
|
promptForTs();
|
|
8
95
|
const { APP_SERVER_ROOT, APP_CLIENT_ROOT, SERVER_TSCONFIG_PATH } = process.env;
|
|
9
|
-
process.env.IS_DEV_CMD = true;
|
|
10
96
|
if (!SERVER_TSCONFIG_PATH) {
|
|
11
97
|
throw new Error("SERVER_TSCONFIG_PATH is not set.");
|
|
12
98
|
}
|
|
99
|
+
try {
|
|
100
|
+
if (opts.prepare) {
|
|
101
|
+
await prepare();
|
|
102
|
+
}
|
|
103
|
+
} catch (error) {
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
13
106
|
if (process.argv.includes("-h") || process.argv.includes("--help")) {
|
|
14
107
|
run("tsx", [
|
|
15
108
|
"--tsconfig",
|
|
@@ -31,7 +124,6 @@ var dev_default = (cli) => {
|
|
|
31
124
|
if (APP_PORT) {
|
|
32
125
|
clientPort = Number(APP_PORT);
|
|
33
126
|
}
|
|
34
|
-
nodeCheck();
|
|
35
127
|
await postCheck(opts);
|
|
36
128
|
if (server) {
|
|
37
129
|
serverPort = Number(APP_PORT);
|
|
@@ -78,6 +170,9 @@ var dev_default = (cli) => {
|
|
|
78
170
|
runDevServer();
|
|
79
171
|
}
|
|
80
172
|
if (client || !server) {
|
|
173
|
+
if (!APP_CLIENT_ROOT || !await fsExists(APP_CLIENT_ROOT)) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
81
176
|
const runClient = async () => {
|
|
82
177
|
const getDevEnvironment = (clientPort2, proxyPort2) => ({
|
|
83
178
|
PORT: clientPort2 + "",
|
package/lib/commands/global.mjs
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
// src/commands/global.ts
|
|
2
|
-
import {
|
|
2
|
+
import { promptForTs, run } from "../util.mjs";
|
|
3
3
|
var global_default = (cli) => {
|
|
4
4
|
const { APP_SERVER_ROOT, SERVER_TSCONFIG_PATH } = process.env;
|
|
5
5
|
cli.allowUnknownOption().option("-h, --help").action((options) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
]);
|
|
16
|
-
} else if (isProd()) {
|
|
17
|
-
run("node", [`${APP_SERVER_ROOT}/lib/index.js`, ...process.argv.slice(2)]);
|
|
18
|
-
}
|
|
6
|
+
promptForTs();
|
|
7
|
+
run("tsx", [
|
|
8
|
+
"--tsconfig",
|
|
9
|
+
SERVER_TSCONFIG_PATH ?? "",
|
|
10
|
+
"-r",
|
|
11
|
+
"tsconfig-paths/register",
|
|
12
|
+
`${APP_SERVER_ROOT}/src/index.ts`,
|
|
13
|
+
...process.argv.slice(2)
|
|
14
|
+
]);
|
|
19
15
|
});
|
|
20
16
|
};
|
|
21
17
|
export {
|
package/lib/commands/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import global from "./global.mjs";
|
|
|
10
10
|
import install from "./install.mjs";
|
|
11
11
|
import postinstall from "./postinstall.mjs";
|
|
12
12
|
import tar from "./tar.mjs";
|
|
13
|
-
import
|
|
13
|
+
import ui from "./ui.mjs";
|
|
14
14
|
import upgrade from "./upgrade.mjs";
|
|
15
15
|
var commands_default = async (cli) => {
|
|
16
16
|
generateAppDir();
|
|
@@ -19,9 +19,9 @@ var commands_default = async (cli) => {
|
|
|
19
19
|
build(cli);
|
|
20
20
|
tar(cli);
|
|
21
21
|
dev(cli);
|
|
22
|
+
ui(cli);
|
|
22
23
|
e2e(cli);
|
|
23
24
|
clean(cli);
|
|
24
|
-
test(cli);
|
|
25
25
|
upgrade(cli);
|
|
26
26
|
install(cli);
|
|
27
27
|
postinstall(cli);
|
package/lib/commands/install.mjs
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
// src/commands/install.ts
|
|
2
|
-
import {
|
|
2
|
+
import { promptForTs, runAppCommand } from "../util.mjs";
|
|
3
3
|
var install_default = (cli) => {
|
|
4
|
-
cli.command("install").allowUnknownOption().
|
|
5
|
-
|
|
6
|
-
promptForTs();
|
|
7
|
-
}
|
|
8
|
-
process.env.IS_DEV_CMD = "true";
|
|
4
|
+
cli.command("install").allowUnknownOption().action(async (options) => {
|
|
5
|
+
promptForTs();
|
|
9
6
|
await runAppCommand("install", process.argv.slice(2));
|
|
10
7
|
});
|
|
11
8
|
};
|
package/lib/commands/p-test.mjs
CHANGED
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
// src/commands/postinstall.ts
|
|
2
|
-
import {
|
|
3
|
-
import { readFile, writeFile } from "fs/promises";
|
|
4
|
-
import { resolve } from "path";
|
|
5
|
-
import { generatePlaywrightPath, isDev } from "../util.mjs";
|
|
2
|
+
import { generatePlaywrightPath } from "../util.mjs";
|
|
6
3
|
var postinstall_default = (cli) => {
|
|
7
4
|
cli.command("postinstall").allowUnknownOption().action(async () => {
|
|
8
5
|
generatePlaywrightPath(true);
|
|
9
|
-
if (!isDev()) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const cwd = process.cwd();
|
|
13
|
-
if (!existsSync(resolve(cwd, ".env")) && existsSync(resolve(cwd, ".env.example"))) {
|
|
14
|
-
const content = await readFile(resolve(cwd, ".env.example"), "utf-8");
|
|
15
|
-
await writeFile(resolve(cwd, ".env"), content, "utf-8");
|
|
16
|
-
}
|
|
17
|
-
if (!existsSync(resolve(cwd, ".env.test")) && existsSync(resolve(cwd, ".env.test.example"))) {
|
|
18
|
-
const content = await readFile(resolve(cwd, ".env.test.example"), "utf-8");
|
|
19
|
-
await writeFile(resolve(cwd, ".env.test"), content, "utf-8");
|
|
20
|
-
}
|
|
21
6
|
});
|
|
22
7
|
};
|
|
23
8
|
export {
|
package/lib/commands/tar.mjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// src/commands/tar.ts
|
|
2
2
|
import { TachybaseBuilder } from "../builder/index.mjs";
|
|
3
|
-
import { nodeCheck } from "../util.mjs";
|
|
4
3
|
var tar_default = (cli) => {
|
|
5
4
|
cli.command("tar").allowUnknownOption().argument("[packages...]").action(async (pkgs) => {
|
|
6
|
-
nodeCheck();
|
|
7
5
|
const tachybaseBuilder = new TachybaseBuilder({
|
|
8
6
|
onlyTar: true
|
|
9
7
|
});
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// src/commands/ui.ts
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
import { confirm, input } from "@inquirer/prompts";
|
|
4
|
+
import { execa } from "execa";
|
|
5
|
+
var require2 = createRequire(import.meta.url);
|
|
6
|
+
var term = require2("terminal-kit").terminal;
|
|
7
|
+
var ui_default = (cli) => {
|
|
8
|
+
cli.command("ui").action(async () => {
|
|
9
|
+
const DEFAULTS = {
|
|
10
|
+
inspect: false,
|
|
11
|
+
port: 3e3,
|
|
12
|
+
dbSync: false
|
|
13
|
+
};
|
|
14
|
+
let proc;
|
|
15
|
+
let opts = { ...DEFAULTS };
|
|
16
|
+
let mouseEnabled = false;
|
|
17
|
+
let logLines = [];
|
|
18
|
+
let scrollPos = 0;
|
|
19
|
+
console.log(term);
|
|
20
|
+
function draw() {
|
|
21
|
+
term.clear();
|
|
22
|
+
const width = term.width;
|
|
23
|
+
const height = term.height;
|
|
24
|
+
const logHeight = height - 2;
|
|
25
|
+
for (let i = 0; i < logHeight; i++) {
|
|
26
|
+
const line = logLines[scrollPos + i] ?? "";
|
|
27
|
+
term.moveTo(1, 1 + i);
|
|
28
|
+
term.eraseLine();
|
|
29
|
+
term(line);
|
|
30
|
+
}
|
|
31
|
+
term.moveTo(1, height - 1);
|
|
32
|
+
term.gray("\u2500".repeat(width));
|
|
33
|
+
term.moveTo(1, height);
|
|
34
|
+
term.cyan("tegod> ");
|
|
35
|
+
}
|
|
36
|
+
function log(txt) {
|
|
37
|
+
txt.split("\n").forEach((l) => {
|
|
38
|
+
logLines.push(l);
|
|
39
|
+
});
|
|
40
|
+
scrollPos = Math.max(0, logLines.length - (term.height - 2));
|
|
41
|
+
draw();
|
|
42
|
+
}
|
|
43
|
+
function startProc() {
|
|
44
|
+
const args = [
|
|
45
|
+
"watch",
|
|
46
|
+
...opts.inspect ? [`--inspect=${opts.inspect === true ? 9229 : opts.inspect}`] : [],
|
|
47
|
+
"--ignore=./storage/plugins/**",
|
|
48
|
+
"--tsconfig",
|
|
49
|
+
process.env.SERVER_TSCONFIG_PATH,
|
|
50
|
+
"-r",
|
|
51
|
+
"tsconfig-paths/register",
|
|
52
|
+
`${process.env.APP_SERVER_ROOT}/src/index.ts`,
|
|
53
|
+
"start",
|
|
54
|
+
`--port=${opts.port}`
|
|
55
|
+
];
|
|
56
|
+
if (opts.dbSync) args.push("--db-sync");
|
|
57
|
+
log(`[dev] starting ${args.join(" ")}`);
|
|
58
|
+
proc = execa("node", ["./node_modules/tsx/dist/cli.mjs", ...args], {
|
|
59
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
60
|
+
shell: true,
|
|
61
|
+
env: { ...process.env, APP_PORT: String(opts.port), FORCE_COLOR: "1" }
|
|
62
|
+
});
|
|
63
|
+
proc.stdout?.on("data", (d) => log(d.toString()));
|
|
64
|
+
proc.stderr?.on("data", (d) => log(d.toString()));
|
|
65
|
+
proc.on("exit", (code) => {
|
|
66
|
+
if (code === 100) {
|
|
67
|
+
log("[dev] exited 100, restarting...");
|
|
68
|
+
startProc();
|
|
69
|
+
} else {
|
|
70
|
+
log(`[dev] exited (${code})`);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
async function handleCommand(cmd) {
|
|
75
|
+
cmd = cmd.trim();
|
|
76
|
+
if (cmd === "restart") {
|
|
77
|
+
log("[dev] restarting...");
|
|
78
|
+
proc?.kill();
|
|
79
|
+
startProc();
|
|
80
|
+
} else if (cmd === "exit") {
|
|
81
|
+
proc?.kill();
|
|
82
|
+
process.exit(0);
|
|
83
|
+
} else if (cmd === "help") {
|
|
84
|
+
log("Commands: restart, setup, help, exit, togglemouse");
|
|
85
|
+
} else if (cmd === "setup") {
|
|
86
|
+
const port = await input({ message: "Server port", default: String(opts.port) });
|
|
87
|
+
const inspect = await confirm({ message: "Enable inspect?", default: Boolean(opts.inspect) });
|
|
88
|
+
const dbSync = await confirm({ message: "Enable dbSync?", default: opts.dbSync });
|
|
89
|
+
opts = { port: Number(port), inspect: inspect ? 9229 : false, dbSync };
|
|
90
|
+
log("[setup] updated config. restarting...");
|
|
91
|
+
proc?.kill();
|
|
92
|
+
startProc();
|
|
93
|
+
} else if (cmd === "togglemouse") {
|
|
94
|
+
mouseEnabled = !mouseEnabled;
|
|
95
|
+
log(`[info] mouse support ${mouseEnabled ? "enabled" : "disabled"}`);
|
|
96
|
+
} else {
|
|
97
|
+
log(`[unknown] ${cmd}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
draw();
|
|
101
|
+
startProc();
|
|
102
|
+
const onMouse = (name, data) => {
|
|
103
|
+
if (name === "MOUSE_WHEEL_UP") {
|
|
104
|
+
scrollPos = Math.max(0, scrollPos - 1);
|
|
105
|
+
}
|
|
106
|
+
if (name === "MOUSE_WHEEL_DOWN") {
|
|
107
|
+
scrollPos = Math.min(Math.max(0, logLines.length - (term.height - 2)), scrollPos + 1);
|
|
108
|
+
}
|
|
109
|
+
draw();
|
|
110
|
+
};
|
|
111
|
+
function toggleMouse() {
|
|
112
|
+
mouseEnabled = !mouseEnabled;
|
|
113
|
+
if (mouseEnabled) {
|
|
114
|
+
term.grabInput({ mouse: "motion" });
|
|
115
|
+
term.on("mouse", onMouse);
|
|
116
|
+
log("[info] Mouse wheel scroll enabled");
|
|
117
|
+
} else {
|
|
118
|
+
term.grabInput({ mouse: "off" });
|
|
119
|
+
term.off("mouse", onMouse);
|
|
120
|
+
log("[info] Mouse wheel scroll disabled");
|
|
121
|
+
}
|
|
122
|
+
draw();
|
|
123
|
+
}
|
|
124
|
+
term.grabInput({ mouse: "motion" });
|
|
125
|
+
term.on("key", async (name, matches, data) => {
|
|
126
|
+
log(`[DEBUG] ${name}`);
|
|
127
|
+
if (name === "CTRL_L") {
|
|
128
|
+
toggleMouse();
|
|
129
|
+
}
|
|
130
|
+
if (name === "PAGE_UP") {
|
|
131
|
+
scrollPos = Math.max(0, scrollPos - 3);
|
|
132
|
+
draw();
|
|
133
|
+
}
|
|
134
|
+
if (name === "PAGE_DOWN") {
|
|
135
|
+
scrollPos = Math.min(Math.max(0, logLines.length - (term.height - 2)), scrollPos + 3);
|
|
136
|
+
draw();
|
|
137
|
+
}
|
|
138
|
+
if (name === "CTRL_C") {
|
|
139
|
+
proc?.kill();
|
|
140
|
+
term.processExit();
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
async function inputLoop() {
|
|
144
|
+
term.moveTo("tegod> ".length + 1, term.height);
|
|
145
|
+
term.inputField(
|
|
146
|
+
{ cancelable: true, autoComplete: ["exit", "restart", "setup", "help", "exit", "togglemouse"] },
|
|
147
|
+
async (err, value) => {
|
|
148
|
+
if (value !== void 0) {
|
|
149
|
+
await handleCommand(value);
|
|
150
|
+
}
|
|
151
|
+
inputLoop();
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
inputLoop();
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
export {
|
|
159
|
+
ui_default as default
|
|
160
|
+
};
|
package/lib/commands/upgrade.mjs
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
// src/commands/upgrade.ts
|
|
2
|
-
import {
|
|
2
|
+
import { promptForTs, runAppCommand } from "../util.mjs";
|
|
3
3
|
var upgrade_default = (cli) => {
|
|
4
|
-
cli.command("upgrade").allowUnknownOption().
|
|
5
|
-
|
|
6
|
-
promptForTs();
|
|
7
|
-
}
|
|
8
|
-
process.env.IS_DEV_CMD = "true";
|
|
4
|
+
cli.command("upgrade").allowUnknownOption().action(async (options) => {
|
|
5
|
+
promptForTs();
|
|
9
6
|
await runAppCommand("upgrade");
|
|
10
7
|
});
|
|
11
8
|
};
|
package/lib/util.mjs
CHANGED
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
// src/util.ts
|
|
2
|
-
import { createHash } from "crypto";
|
|
3
2
|
import {
|
|
4
3
|
cpSync as _cpSync,
|
|
5
4
|
existsSync as _existsSync,
|
|
6
5
|
writeFileSync as _writeFileSync,
|
|
7
|
-
createWriteStream,
|
|
8
|
-
existsSync,
|
|
9
6
|
readFileSync,
|
|
10
7
|
rmSync,
|
|
11
|
-
symlinkSync,
|
|
12
|
-
unlinkSync,
|
|
13
8
|
writeFileSync
|
|
14
9
|
} from "fs";
|
|
15
|
-
import {
|
|
10
|
+
import { readFile, stat, writeFile } from "fs/promises";
|
|
16
11
|
import { createRequire } from "module";
|
|
17
12
|
import { Socket } from "net";
|
|
18
13
|
import os from "os";
|
|
19
14
|
import { dirname, join, resolve, sep } from "path";
|
|
20
|
-
import { pipeline } from "stream/promises";
|
|
21
15
|
import chalk from "chalk";
|
|
22
16
|
import { config } from "dotenv";
|
|
23
17
|
import { execa } from "execa";
|
|
24
18
|
import fastGlob from "fast-glob";
|
|
25
|
-
import packageJson from "package-json";
|
|
26
|
-
import * as tar from "tar";
|
|
27
19
|
import { DEFAULT_DEV_HOST } from "./constants.mjs";
|
|
28
20
|
var require2 = createRequire(import.meta.url);
|
|
29
21
|
async function fsExists(path) {
|
|
@@ -34,72 +26,7 @@ async function fsExists(path) {
|
|
|
34
26
|
return false;
|
|
35
27
|
}
|
|
36
28
|
}
|
|
37
|
-
function isPackageValid(pkg) {
|
|
38
|
-
try {
|
|
39
|
-
require2.resolve(pkg);
|
|
40
|
-
return true;
|
|
41
|
-
} catch (error) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async function downloadTar(packageName, target) {
|
|
46
|
-
const info = await packageJson(packageName, { fullMetadata: true });
|
|
47
|
-
const url = info.dist.tarball;
|
|
48
|
-
const tarballFile = join(target, "..", `${createHash("md5").update(packageName).digest("hex")}-tarball.gz`);
|
|
49
|
-
await mkdir(dirname(tarballFile), { recursive: true });
|
|
50
|
-
const writer = createWriteStream(tarballFile);
|
|
51
|
-
const response = await fetch(url);
|
|
52
|
-
if (!response.ok || !response.body) {
|
|
53
|
-
throw new Error(`Failed to fetch tarball: ${response.statusText}`);
|
|
54
|
-
}
|
|
55
|
-
await pipeline(response.body, writer);
|
|
56
|
-
await mkdir(target, { recursive: true });
|
|
57
|
-
await tar.x({
|
|
58
|
-
file: tarballFile,
|
|
59
|
-
gzip: true,
|
|
60
|
-
cwd: target,
|
|
61
|
-
strip: 1,
|
|
62
|
-
k: true
|
|
63
|
-
});
|
|
64
|
-
await unlink(tarballFile);
|
|
65
|
-
}
|
|
66
|
-
function hasCorePackages() {
|
|
67
|
-
const coreDir = resolve(process.cwd(), "apps/build");
|
|
68
|
-
return existsSync(coreDir);
|
|
69
|
-
}
|
|
70
|
-
function hasTsNode() {
|
|
71
|
-
return isPackageValid("tsx");
|
|
72
|
-
}
|
|
73
|
-
function isDev() {
|
|
74
|
-
if (process.env.APP_ENV === "production") {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
return hasTsNode();
|
|
78
|
-
}
|
|
79
|
-
var isProd = () => {
|
|
80
|
-
const { APP_SERVER_ROOT } = process.env;
|
|
81
|
-
const file = `${APP_SERVER_ROOT}/lib/index.js`;
|
|
82
|
-
if (!existsSync(resolve(process.cwd(), file))) {
|
|
83
|
-
console.log("For production environment, please build the code first.");
|
|
84
|
-
console.log();
|
|
85
|
-
console.log(chalk.yellow("$ pnpm build"));
|
|
86
|
-
console.log();
|
|
87
|
-
process.exit(1);
|
|
88
|
-
}
|
|
89
|
-
return true;
|
|
90
|
-
};
|
|
91
|
-
function nodeCheck() {
|
|
92
|
-
if (!hasTsNode()) {
|
|
93
|
-
console.log("Please install all dependencies");
|
|
94
|
-
console.log(chalk.yellow("$ pnpm install"));
|
|
95
|
-
process.exit(1);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
29
|
function run(command, args, options) {
|
|
99
|
-
if (command === "tsx") {
|
|
100
|
-
command = "node";
|
|
101
|
-
args = ["./node_modules/tsx/dist/cli.mjs"].concat(args || []);
|
|
102
|
-
}
|
|
103
30
|
return execa(command, args, {
|
|
104
31
|
shell: true,
|
|
105
32
|
stdio: "inherit",
|
|
@@ -142,48 +69,49 @@ async function postCheck(opts) {
|
|
|
142
69
|
process.exit(1);
|
|
143
70
|
}
|
|
144
71
|
}
|
|
72
|
+
async function runWithTsx(argv, options) {
|
|
73
|
+
try {
|
|
74
|
+
await run("tsx", argv, options);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
if (error.code === "ENOENT") {
|
|
77
|
+
const tsxCliPath = require2.resolve("tsx/dist/cli.mjs");
|
|
78
|
+
await run("node", [tsxCliPath, ...argv], options);
|
|
79
|
+
} else {
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
145
84
|
async function runInstall() {
|
|
146
85
|
const { APP_SERVER_ROOT, SERVER_TSCONFIG_PATH } = process.env;
|
|
147
86
|
if (!SERVER_TSCONFIG_PATH) {
|
|
148
87
|
throw new Error("SERVER_TSCONFIG_PATH is empty.");
|
|
149
88
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
await run("tsx", argv);
|
|
161
|
-
} else if (isProd()) {
|
|
162
|
-
const file = `${APP_SERVER_ROOT}/lib/index.js`;
|
|
163
|
-
const argv = [file, "install", "-s"];
|
|
164
|
-
await run("node", argv);
|
|
165
|
-
}
|
|
89
|
+
const argv = [
|
|
90
|
+
"--tsconfig",
|
|
91
|
+
SERVER_TSCONFIG_PATH,
|
|
92
|
+
"-r",
|
|
93
|
+
"tsconfig-paths/register",
|
|
94
|
+
`${APP_SERVER_ROOT}/src/index.ts`,
|
|
95
|
+
"install",
|
|
96
|
+
"-s"
|
|
97
|
+
];
|
|
98
|
+
await runWithTsx(argv);
|
|
166
99
|
}
|
|
167
100
|
async function runAppCommand(command, args = []) {
|
|
168
101
|
const { APP_SERVER_ROOT, SERVER_TSCONFIG_PATH } = process.env;
|
|
169
102
|
if (!SERVER_TSCONFIG_PATH) {
|
|
170
103
|
throw new Error("SERVER_TSCONFIG_PATH is not set");
|
|
171
104
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
await run("tsx", argv);
|
|
183
|
-
} else if (isProd()) {
|
|
184
|
-
const argv = [`${APP_SERVER_ROOT}/lib/index.js`, command, ...args];
|
|
185
|
-
await run("node", argv);
|
|
186
|
-
}
|
|
105
|
+
const argv = [
|
|
106
|
+
"--tsconfig",
|
|
107
|
+
SERVER_TSCONFIG_PATH,
|
|
108
|
+
"-r",
|
|
109
|
+
"tsconfig-paths/register",
|
|
110
|
+
`${APP_SERVER_ROOT}/src/index.ts`,
|
|
111
|
+
command,
|
|
112
|
+
...args
|
|
113
|
+
];
|
|
114
|
+
await runWithTsx(argv);
|
|
187
115
|
}
|
|
188
116
|
function promptForTs() {
|
|
189
117
|
console.log(chalk.green("WAIT: ") + "TypeScript compiling...");
|
|
@@ -200,15 +128,6 @@ function generateAppDir() {
|
|
|
200
128
|
process.env.APP_CLIENT_ROOT = process.env.APP_CLIENT_ROOT || defaultClientRoot;
|
|
201
129
|
}
|
|
202
130
|
async function genTsConfigPaths() {
|
|
203
|
-
try {
|
|
204
|
-
unlinkSync(resolve(process.cwd(), "node_modules/.bin/tsx"));
|
|
205
|
-
symlinkSync(
|
|
206
|
-
resolve(process.cwd(), "node_modules/tsx/dist/cli.mjs"),
|
|
207
|
-
resolve(process.cwd(), "node_modules/.bin/tsx"),
|
|
208
|
-
"file"
|
|
209
|
-
);
|
|
210
|
-
} catch (error) {
|
|
211
|
-
}
|
|
212
131
|
const cwd = process.cwd();
|
|
213
132
|
const cwdLength = cwd.length;
|
|
214
133
|
const paths = {};
|
|
@@ -251,17 +170,6 @@ function generatePlaywrightPath(clean = false) {
|
|
|
251
170
|
} catch (error) {
|
|
252
171
|
}
|
|
253
172
|
}
|
|
254
|
-
function parseEnv(name) {
|
|
255
|
-
if (name === "DB_UNDERSCORED") {
|
|
256
|
-
if (process.env.DB_UNDERSCORED === "true") {
|
|
257
|
-
return "true";
|
|
258
|
-
}
|
|
259
|
-
if (process.env.DB_UNDERSCORED) {
|
|
260
|
-
return "true";
|
|
261
|
-
}
|
|
262
|
-
return "false";
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
173
|
function initEnv() {
|
|
266
174
|
const env = {
|
|
267
175
|
APP_ENV: "development",
|
|
@@ -269,9 +177,7 @@ function initEnv() {
|
|
|
269
177
|
APP_PORT: 3e3,
|
|
270
178
|
API_BASE_PATH: "/api/",
|
|
271
179
|
DB_DIALECT: "sqlite",
|
|
272
|
-
DB_STORAGE: "storage/db/tachybase.sqlite",
|
|
273
180
|
DB_TIMEZONE: "+00:00",
|
|
274
|
-
DB_UNDERSCORED: parseEnv("DB_UNDERSCORED"),
|
|
275
181
|
DEFAULT_STORAGE_TYPE: "local",
|
|
276
182
|
LOCAL_STORAGE_DEST: "storage/uploads",
|
|
277
183
|
PLUGIN_STORAGE_PATH: "storage/plugins",
|
|
@@ -281,14 +187,12 @@ function initEnv() {
|
|
|
281
187
|
PLUGIN_PACKAGE_PREFIX: "@tachybase/plugin-,@tachybase/module-",
|
|
282
188
|
SERVER_TSCONFIG_PATH: "./tsconfig.server.json",
|
|
283
189
|
PLAYWRIGHT_AUTH_FILE: "storage/playwright/.auth/admin.json",
|
|
284
|
-
CACHE_DEFAULT_STORE: "memory",
|
|
285
|
-
CACHE_MEMORY_MAX: 2e3,
|
|
286
190
|
PLUGIN_STATICS_PATH: "/static/plugins/",
|
|
287
|
-
LOGGER_BASE_PATH: "storage/logs",
|
|
288
191
|
APP_SERVER_BASE_URL: "",
|
|
289
192
|
APP_PUBLIC_PATH: "/",
|
|
290
193
|
TEGO_HOME: join(os.homedir(), ".tego"),
|
|
291
|
-
TEGO_RUNTIME_NAME: "current"
|
|
194
|
+
TEGO_RUNTIME_NAME: "current",
|
|
195
|
+
IS_DEV_CMD: "1"
|
|
292
196
|
};
|
|
293
197
|
if (!process.env.APP_ENV_PATH && process.argv[2] && ["test", "test:client", "test:server"].includes(process.argv[2])) {
|
|
294
198
|
if (_existsSync(resolve(process.cwd(), ".env.test"))) {
|
|
@@ -354,20 +258,13 @@ var castArray = (arr) => {
|
|
|
354
258
|
};
|
|
355
259
|
export {
|
|
356
260
|
castArray,
|
|
357
|
-
downloadTar,
|
|
358
261
|
fsExists,
|
|
359
262
|
genTsConfigPaths,
|
|
360
263
|
generateAppDir,
|
|
361
264
|
generatePlaywrightPath,
|
|
362
265
|
getHostInUrl,
|
|
363
|
-
hasCorePackages,
|
|
364
|
-
hasTsNode,
|
|
365
266
|
initEnv,
|
|
366
|
-
isDev,
|
|
367
|
-
isPackageValid,
|
|
368
267
|
isPortReachable,
|
|
369
|
-
isProd,
|
|
370
|
-
nodeCheck,
|
|
371
268
|
postCheck,
|
|
372
269
|
promptForTs,
|
|
373
270
|
run,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tego/devkit",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.53",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
".": "./lib/index.mjs"
|
|
9
9
|
},
|
|
10
10
|
"bin": {
|
|
11
|
-
"
|
|
11
|
+
"tegod": "./bin/cli.js"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"assets",
|
|
@@ -19,39 +19,44 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@hapi/topo": "^6.0.2",
|
|
22
|
-
"@
|
|
22
|
+
"@inquirer/prompts": "^7.8.6",
|
|
23
|
+
"@npmcli/arborist": "^9.1.4",
|
|
23
24
|
"@pnpm/workspace.find-packages": "^1.1.12",
|
|
24
|
-
"@rsbuild/core": "^1.
|
|
25
|
-
"@rsbuild/plugin-less": "^1.
|
|
26
|
-
"@rsbuild/plugin-react": "^1.3.
|
|
27
|
-
"@rslib/core": "^0.
|
|
25
|
+
"@rsbuild/core": "^1.5.10",
|
|
26
|
+
"@rsbuild/plugin-less": "^1.5.0",
|
|
27
|
+
"@rsbuild/plugin-react": "^1.3.5",
|
|
28
|
+
"@rslib/core": "^0.13.2",
|
|
28
29
|
"@types/fs-extra": "^11.0.4",
|
|
29
|
-
"@
|
|
30
|
+
"@types/terminal-kit": "^2.5.7",
|
|
31
|
+
"@umijs/utils": "^4.5.3",
|
|
30
32
|
"@vercel/ncc": "^0.38.3",
|
|
31
|
-
"@vitejs/plugin-react": "^
|
|
32
|
-
"chalk": "^5.
|
|
33
|
+
"@vitejs/plugin-react": "^5.0.2",
|
|
34
|
+
"chalk": "^5.5.0",
|
|
33
35
|
"commander": "^12.1.0",
|
|
34
36
|
"dotenv": "16.6.1",
|
|
35
37
|
"execa": "^8.0.1",
|
|
36
38
|
"fast-glob": "^3.3.3",
|
|
37
|
-
"fs-extra": "^11.3.
|
|
39
|
+
"fs-extra": "^11.3.2",
|
|
38
40
|
"lodash": "^4.17.21",
|
|
39
|
-
"npm-packlist": "^10.0.
|
|
41
|
+
"npm-packlist": "^10.0.2",
|
|
40
42
|
"open": "^10.2.0",
|
|
41
43
|
"p-all": "^3.0.0",
|
|
42
44
|
"package-json": "^10.0.1",
|
|
43
|
-
"portfinder": "^1.0.
|
|
45
|
+
"portfinder": "^1.0.38",
|
|
44
46
|
"rimraf": "^6.0.1",
|
|
45
47
|
"semver": "^7.7.2",
|
|
46
|
-
"
|
|
48
|
+
"simple-git": "^3.28.0",
|
|
49
|
+
"tar": "^7.5.1",
|
|
50
|
+
"terminal-kit": "^3.1.2",
|
|
47
51
|
"tree-kill": "^1.2.2",
|
|
48
52
|
"tsconfig-paths": "^4.2.0",
|
|
49
53
|
"tsup": "^8.5.0",
|
|
50
|
-
"tsx": "^4.20.
|
|
51
|
-
"typescript": "^5.
|
|
54
|
+
"tsx": "^4.20.5",
|
|
55
|
+
"typescript": "^5.9.2",
|
|
52
56
|
"update-notifier": "^7.3.1",
|
|
53
|
-
"vite": "^7.
|
|
54
|
-
"vite-plugin-css-injected-by-js": "^3.5.2"
|
|
57
|
+
"vite": "^7.1.10",
|
|
58
|
+
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
59
|
+
"@tachybase/test": "1.3.53"
|
|
55
60
|
},
|
|
56
61
|
"devDependencies": {
|
|
57
62
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -59,13 +64,14 @@
|
|
|
59
64
|
"@types/node": "20.17.10",
|
|
60
65
|
"@types/npm-packlist": "^7.0.3",
|
|
61
66
|
"@types/npmcli__arborist": "^6.3.1",
|
|
62
|
-
"@types/semver": "^7.7.
|
|
67
|
+
"@types/semver": "^7.7.1",
|
|
63
68
|
"@types/tar": "^6.1.13",
|
|
64
69
|
"@types/update-notifier": "^6.0.8",
|
|
65
70
|
"esbuild-plugin-file-path-extensions": "^2.1.4"
|
|
66
71
|
},
|
|
67
72
|
"scripts": {
|
|
68
73
|
"build": "tsup",
|
|
74
|
+
"dev": "tsup --watch",
|
|
69
75
|
"typecheck": "tsc --noEmit"
|
|
70
76
|
}
|
|
71
77
|
}
|
package/lib/commands/test.mjs
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// src/commands/test.ts
|
|
2
|
-
import { sep } from "path";
|
|
3
|
-
import { run } from "../util.mjs";
|
|
4
|
-
function addTestCommand(name, cli) {
|
|
5
|
-
return cli.command(name).option("-w, --watch").option("--run").option("--allowOnly").option("--bail").option("-h, --help").option("--single-thread [singleThread]").arguments("[paths...]").allowUnknownOption().action(async (paths, opts) => {
|
|
6
|
-
process.argv.push("--disable-console-intercept");
|
|
7
|
-
if (name === "test:server") {
|
|
8
|
-
process.env.TEST_ENV = "server-side";
|
|
9
|
-
} else if (name === "test:client") {
|
|
10
|
-
process.env.TEST_ENV = "client-side";
|
|
11
|
-
}
|
|
12
|
-
if (opts.server) {
|
|
13
|
-
process.env.TEST_ENV = "server-side";
|
|
14
|
-
process.argv.splice(process.argv.indexOf("--server"), 1);
|
|
15
|
-
}
|
|
16
|
-
if (opts.client) {
|
|
17
|
-
process.env.TEST_ENV = "client-side";
|
|
18
|
-
process.argv.splice(process.argv.indexOf("--client"), 1);
|
|
19
|
-
}
|
|
20
|
-
process.env.NODE_ENV = "test";
|
|
21
|
-
if (!opts.watch && !opts.run) {
|
|
22
|
-
process.argv.push("--run");
|
|
23
|
-
}
|
|
24
|
-
const first = paths?.[0];
|
|
25
|
-
if (!process.env.TEST_ENV && first) {
|
|
26
|
-
const key = first.split(sep).join("/");
|
|
27
|
-
if (key.includes("/client/")) {
|
|
28
|
-
process.env.TEST_ENV = "client-side";
|
|
29
|
-
} else {
|
|
30
|
-
process.env.TEST_ENV = "server-side";
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (process.env.TEST_ENV === "server-side" && opts.singleThread !== "false") {
|
|
34
|
-
process.argv.push("--poolOptions.threads.singleThread=true");
|
|
35
|
-
}
|
|
36
|
-
if (opts.singleThread === "false") {
|
|
37
|
-
process.argv.splice(process.argv.indexOf("--single-thread=false"), 1);
|
|
38
|
-
}
|
|
39
|
-
const cliArgs = ["--max_old_space_size=14096", "./node_modules/.bin/vitest", ...process.argv.slice(3)];
|
|
40
|
-
if (process.argv.includes("-h") || process.argv.includes("--help")) {
|
|
41
|
-
await run("node", cliArgs);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (process.env.TEST_ENV) {
|
|
45
|
-
console.log("process.env.TEST_ENV", process.env.TEST_ENV, cliArgs);
|
|
46
|
-
await run("node", cliArgs);
|
|
47
|
-
} else {
|
|
48
|
-
await Promise.all([
|
|
49
|
-
run("node", cliArgs, {
|
|
50
|
-
env: {
|
|
51
|
-
TEST_ENV: "client-side"
|
|
52
|
-
}
|
|
53
|
-
}),
|
|
54
|
-
run("node", cliArgs, {
|
|
55
|
-
env: {
|
|
56
|
-
TEST_ENV: "server-side"
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
]);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
var test_default = (cli) => {
|
|
64
|
-
addTestCommand("test:server", cli);
|
|
65
|
-
addTestCommand("test:client", cli);
|
|
66
|
-
addTestCommand("test", cli).option("--client").option("--server");
|
|
67
|
-
};
|
|
68
|
-
export {
|
|
69
|
-
test_default as default
|
|
70
|
-
};
|