spacetime db ci change

This commit is contained in:
Aadesh Kheria 2026-04-10 11:24:52 -07:00
parent e16040c908
commit a07dbab3a6
2 changed files with 24 additions and 1 deletions

View File

@ -4,7 +4,7 @@
"version": "2.8.80",
"type": "module",
"scripts": {
"dev": "pnpm spacetime:publish:local && next dev --turbopack --port ${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}41",
"dev": "node scripts/pre-dev.mjs && next dev --turbopack --port ${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}41",
"build": "next build",
"start": "next start --port ${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}41",
"typecheck": "tsc --noEmit",

View File

@ -0,0 +1,23 @@
#!/usr/bin/env node
// Runs before `next dev`. Publishes the SpacetimeDB module to the local server
// if the spacetime CLI is installed. Otherwise, warns and continues so the
// dev server still starts (useful in CI and for contributors who haven't
// installed the CLI yet).
import { spawnSync } from "node:child_process";
const which = spawnSync(process.platform === "win32" ? "where" : "which", ["spacetime"], {
stdio: "ignore",
});
if (which.status !== 0) {
console.warn("\n[internal-tool] spacetime CLI not found, skipping publish.");
console.warn("[internal-tool] To install it: curl -sSf https://install.spacetimedb.com | sh\n");
process.exit(0);
}
const publish = spawnSync("pnpm", ["spacetime:publish:local"], {
stdio: "inherit",
});
process.exit(publish.status ?? 1);