mirror of
https://github.com/clawdbot/clawdbot.git
synced 2026-01-31 19:37:45 +01:00
Adjust UI install for offline pnpm fetch (#568)
* 🤖 codex: make ui build install prod deps for offline pnpm (issue-pnpm-offline) * 🤖 codex: ensure ui:test installs dev deps (issue-pnpm-offline)
This commit is contained in:
6
pnpm-lock.yaml
generated
6
pnpm-lock.yaml
generated
@@ -233,6 +233,9 @@ importers:
|
||||
marked:
|
||||
specifier: ^17.0.1
|
||||
version: 17.0.1
|
||||
vite:
|
||||
specifier: 7.3.1
|
||||
version: 7.3.1(@types/node@25.0.3)(jiti@2.6.1)(lightningcss@1.30.2)(tsx@4.21.0)(yaml@2.8.2)
|
||||
devDependencies:
|
||||
'@vitest/browser-playwright':
|
||||
specifier: 4.0.16
|
||||
@@ -243,9 +246,6 @@ importers:
|
||||
typescript:
|
||||
specifier: ^5.9.3
|
||||
version: 5.9.3
|
||||
vite:
|
||||
specifier: 7.3.1
|
||||
version: 7.3.1(@types/node@25.0.3)(jiti@2.6.1)(lightningcss@1.30.2)(tsx@4.21.0)(yaml@2.8.2)
|
||||
vitest:
|
||||
specifier: 4.0.16
|
||||
version: 4.0.16(@types/node@25.0.3)(@vitest/browser-playwright@4.0.16)(@vitest/browser-preview@4.0.16)(jiti@2.6.1)(lightningcss@1.30.2)(tsx@4.21.0)(yaml@2.8.2)
|
||||
|
||||
@@ -64,21 +64,26 @@ function run(cmd, args) {
|
||||
});
|
||||
}
|
||||
|
||||
function runSync(cmd, args) {
|
||||
function runSync(cmd, args, envOverride) {
|
||||
const result = spawnSync(cmd, args, {
|
||||
cwd: uiDir,
|
||||
stdio: "inherit",
|
||||
env: process.env,
|
||||
env: envOverride ?? process.env,
|
||||
});
|
||||
if (result.signal) process.exit(1);
|
||||
if ((result.status ?? 1) !== 0) process.exit(result.status ?? 1);
|
||||
}
|
||||
|
||||
function depsInstalled() {
|
||||
function depsInstalled(kind) {
|
||||
try {
|
||||
const require = createRequire(path.join(uiDir, "package.json"));
|
||||
require.resolve("vite");
|
||||
require.resolve("dompurify");
|
||||
if (kind === "test") {
|
||||
require.resolve("vitest");
|
||||
require.resolve("@vitest/browser-playwright");
|
||||
require.resolve("playwright");
|
||||
}
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
@@ -118,13 +123,29 @@ if (action !== "install" && !script) {
|
||||
if (runner.kind === "bun") {
|
||||
if (action === "install") run(runner.cmd, ["install", ...rest]);
|
||||
else {
|
||||
if (!depsInstalled()) runSync(runner.cmd, ["install"]);
|
||||
if (!depsInstalled(action === "test" ? "test" : "build")) {
|
||||
const installEnv =
|
||||
action === "build"
|
||||
? { ...process.env, NODE_ENV: "production" }
|
||||
: process.env;
|
||||
const installArgs =
|
||||
action === "build" ? ["install", "--production"] : ["install"];
|
||||
runSync(runner.cmd, installArgs, installEnv);
|
||||
}
|
||||
run(runner.cmd, ["run", script, ...rest]);
|
||||
}
|
||||
} else {
|
||||
if (action === "install") run(runner.cmd, ["install", ...rest]);
|
||||
else {
|
||||
if (!depsInstalled()) runSync(runner.cmd, ["install"]);
|
||||
if (!depsInstalled(action === "test" ? "test" : "build")) {
|
||||
const installEnv =
|
||||
action === "build"
|
||||
? { ...process.env, NODE_ENV: "production" }
|
||||
: process.env;
|
||||
const installArgs =
|
||||
action === "build" ? ["install", "--prod"] : ["install"];
|
||||
runSync(runner.cmd, installArgs, installEnv);
|
||||
}
|
||||
run(runner.cmd, ["run", script, ...rest]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
"dependencies": {
|
||||
"dompurify": "^3.3.1",
|
||||
"lit": "^3.3.2",
|
||||
"marked": "^17.0.1"
|
||||
"marked": "^17.0.1",
|
||||
"vite": "7.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitest/browser-playwright": "4.0.16",
|
||||
"playwright": "^1.57.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "7.3.1",
|
||||
"vitest": "4.0.16"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user