Something went wrong. Try again.
Original-language reader for Kant, Aristotle & more: select any passage to gloss, translate, or hear it read aloud, with exact citations.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465import { execSync } from "node:child_process"import { checkCache, inputHash } from "./build-cache"
/** * Cached deploy (node_modules/.cache). Skips the convex + wrangler upload when * nothing that affects the deployed artifacts changed since the last successful * deploy. The digest covers the corpus sources and ingest code (which produce * the served `public/corpus/`), the convex functions, the frontend (`src`, * `index.html`, the static `public/` assets), and the build/deploy config. The * derived `public/corpus/` and the external `public/facsimile/` scans are * excluded — the former is captured via its sources, the latter ships to R2 on a * separate flow. Set DEPLOY_FORCE=1 to deploy regardless of the cache. */const FORCE = process.env.DEPLOY_FORCE === "1"
const CACHE_INPUTS = { paths: [ "sources", "scripts", "src", "convex", "index.html", "public", "vite.config.ts", "wrangler.jsonc", "package.json", "bun.lock", "tsconfig.json", "tsconfig.app.json", "tsconfig.node.json", "components.json", ], exclude: ["convex/_generated", "public/corpus", "public/facsimile"],}
function run(cmd: string): void { console.log(`$ ${cmd}`) execSync(cmd, { stdio: "inherit" })}
function main(): void { const cache = checkCache("deploy", inputHash(CACHE_INPUTS)) if (!FORCE && cache.hit) { console.log( "↩ No changes since the last successful deploy; skipping upload. " + "Set DEPLOY_FORCE=1 to deploy anyway." ) return }
try { run("convex deploy --cmd 'bun run build'") run("bunx wrangler deploy") } catch { // The failing command already printed its own diagnostics (stdio inherit); // leave the cache unsaved so the next run retries. process.exit(1) }
cache.save() console.log("✓ Deploy complete.")}
main()