mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 02:36:01 -10:00
build(studio): make studio skips the frontend and kernel steps when nothing they read is newer than what they made
STUDIO_REBUILD=1 forces both. The comparison is a small Node script because the launcher runs under a Git Bash that may have no GNU find.
This commit is contained in:
1 parent
bd62832a62
commit
5a0cf3f6ea
2 files changed
+57
-4
No files matched your search
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
|
||||
// Exit 0 when the artifact is missing or any file under the given paths is
|
||||
// newer than it, 1 when it is up to date. run-studio.sh asks this before
|
||||
// rebuilding; the shell has no portable `find` on every platform it runs on.
|
||||
const [artifact, ...inputs] = process.argv.slice(2);
|
||||
if (!artifact) process.exit(2);
|
||||
|
||||
let built;
|
||||
try {
|
||||
built = fs.statSync(artifact).mtimeMs;
|
||||
} catch {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const SKIP = new Set(["node_modules", ".git", "dist"]);
|
||||
|
||||
function newer(entry) {
|
||||
let info;
|
||||
try {
|
||||
info = fs.statSync(entry);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
if (!info.isDirectory()) return info.mtimeMs > built;
|
||||
for (const name of fs.readdirSync(entry)) {
|
||||
if (SKIP.has(name)) continue;
|
||||
if (newer(path.join(entry, name))) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
process.exit(inputs.some(newer) ? 0 : 1);
|
||||
@@ -12,11 +12,29 @@ if [ ! -d "$here/node_modules" ]; then
|
||||
(cd "$here" && pnpm install --frozen-lockfile)
|
||||
fi
|
||||
|
||||
echo "==> frontend"
|
||||
(cd "$here/../frontend-next" && pnpm install --frozen-lockfile >/dev/null && pnpm build >/dev/null)
|
||||
# A step is skipped when nothing it reads is newer than what it produced;
|
||||
# STUDIO_REBUILD=1 forces every step.
|
||||
stale() {
|
||||
[ -n "${STUDIO_REBUILD:-}" ] || node "$here/packaging/stale.js" "$@"
|
||||
}
|
||||
|
||||
echo "==> kernel"
|
||||
(cd "$here" && pnpm build:host)
|
||||
root="$here/../.."
|
||||
web="$here/../frontend-next"
|
||||
host=$(ls "$here"/bin/reasonix-studio-host* 2>/dev/null | head -n 1 || true)
|
||||
|
||||
if stale "$web/dist/index.html" "$web/src" "$web/public" "$web/index.html" "$web/package.json" "$web/pnpm-lock.yaml" "$web/vite.config.ts" "$web/tsconfig.json"; then
|
||||
echo "==> frontend"
|
||||
(cd "$web" && pnpm install --frozen-lockfile >/dev/null && pnpm build >/dev/null)
|
||||
else
|
||||
echo "==> frontend (up to date)"
|
||||
fi
|
||||
|
||||
if [ -z "$host" ] || stale "$host" "$root/internal" "$root/cmd" "$root/go.mod" "$root/go.sum" "$here/packaging"; then
|
||||
echo "==> kernel"
|
||||
(cd "$here" && pnpm build:host)
|
||||
else
|
||||
echo "==> kernel (up to date)"
|
||||
fi
|
||||
|
||||
echo "==> studio"
|
||||
cd "$here" && exec pnpm start
|
||||
Reference in new issue
Block a user