clone

a deno framework for local-first web apps that open instantly, work offline and sync when users choose

feat/prf-provision-custody
lofi / package / commands / dev.ts
dev.ts 1.6K
1#!/usr/bin/env -S deno run -A23/**4 * The `deno task dev` command: runs the Astro development server after lofi5 * preflight checks and diagnostics.6 *7 * @module8 */910import { relative } from "node:path";11import { runDenoStatus } from "../tooling/process.ts";12import { prepareLofiAstroConfig } from "../astro/mod.ts";13import { validatedCommandEnvironment } from "./shared.ts";1415const environment = await validatedCommandEnvironment();16environment.ASTRO_DEV_BACKGROUND = "1";1718console.log("lofi dev");19console.log("Storage: OPFS durable requested; browser gate required");20console.log("Persistence: pending browser check");21console.log(22 "Identity: local-first account; opens immediately, back up + sync via AccountGate",23);24console.log(25 `Sync: ${26 environment.JAZZ_APP_ID27 ? "managed configured; users elect to back up and sync per account"28 : "local-only"29 }`,30);31console.log(`PWA: development service worker disabled; base ${environment.LOFI_BASE_PATH}`);32console.log("Device: stable HTTPS URL not configured; device preview graduates in M3");3334const forwarded = Deno.args[0] === "--" ? Deno.args.slice(1) : Deno.args;35const astroConfig = relative(Deno.cwd(), await prepareLofiAstroConfig());36const status = await runDenoStatus(37 ["run", "-A", "npm:astro@7.0.9", "dev", "--config", astroConfig, ...forwarded],38 environment,39);40if (status.forwardedSignal) {41 Deno.exit(0);42}43if (status.code !== 0) {44 console.error(45 "error: development server stopped; application impact: no local URL is available. Run `deno task doctor`, apply the first action, then rerun `deno task dev`.",46 );47 Deno.exit(status.code);48}