diff --git a/README.md b/README.md index 6e2f375..1c44222 100644 --- a/README.md +++ b/README.md @@ -30,4 +30,32 @@ npm run build You can preview the production build with `npm run preview`. -> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. +## Deploying + +The site runs on Cloudflare Workers, not Pages. `@sveltejs/adapter-cloudflare` +writes a worker and its static assets to `.svelte-kit/cloudflare`, and +`wrangler.jsonc` points at both. + +Pushes to `main` go through Workers Builds. Dashboard settings: + +| Setting | Value | +| -------------- | --------------------- | +| Build command | `npm run build` | +| Deploy command | `npx wrangler deploy` | +| Root directory | `/` | + +There is no build output directory to configure. Wrangler takes the paths from +`wrangler.jsonc`, so if the adapter ever changes where it writes, update `main` +and `assets.directory` to match. + +To deploy by hand: + +```sh +npx wrangler login +npm run deploy +``` + +Do not connect this repo to Pages. The Pages pipeline wants +`pages_build_output_dir` in the wrangler config, finds Workers keys instead, +skips the file, and then fails looking for a `dist` directory that nothing +creates. diff --git a/package.json b/package.json index a95bf12..c8ec45f 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "dev": "vite dev", "build": "vite build", "preview": "vite preview", + "deploy": "vite build && wrangler deploy", "prepare": "svelte-kit sync || echo ''", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",