feat: upgrade to SvelteKit 3 and adapter-bun
Some checks failed
Test and deploy staging / staging (push) Failing after 43s

Run the sveltekit-3 migration and finish its manual tasks:

- Move kit config into the sveltekit() Vite plugin; drop svelte.config.js
- Replace $lib with #lib subpath imports
- Declare env vars in src/env.ts and import them from $app/env/{private,public}
- Consolidate param matchers into src/params.ts
- Use error(status, message), Response.json, refreshAll and goto reset/shallow
- Fall back to a full page load when goto rejects a login return path

Switch from adapter-node to adapter-bun: the build script runs Vite under
Bun (the adapter requires it) and the image starts with `bun ./build`.
Runtime env names (PORT, BODY_SIZE_LIMIT, ADDRESS_HEADER, ...) are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-18 22:17:30 +00:00
parent b52e9188f4
commit 54924b39f0
240 changed files with 894 additions and 944 deletions

27
src/env.ts Normal file
View File

@@ -0,0 +1,27 @@
import { defineEnvVars } from '@sveltejs/kit/env';
// Every variable is optional and falls back to '' (falsy, like an unset $env/dynamic
// value used to be); the code that uses each one checks whether it is configured.
export const variables = defineEnvVars({
PUBLIC_MAPTILER_API_KEY: { public: true, schema: (input) => input ?? '' },
R2_PUBLIC_URL: { schema: (input) => input ?? '' },
ORIGIN: { schema: (input) => input ?? '' },
BETTER_AUTH_SECRET: { schema: (input) => input ?? '' },
BETTER_AUTH_URL: { schema: (input) => input ?? '' },
GOOGLE_CLIENT_ID: { schema: (input) => input ?? '' },
GOOGLE_CLIENT_SECRET: { schema: (input) => input ?? '' },
OSU_CLIENT_ID: { schema: (input) => input ?? '' },
OSU_CLIENT_SECRET: { schema: (input) => input ?? '' },
ANTHROPIC_API_KEY: { schema: (input) => input ?? '' },
HOUSE_WORKER_TOKEN: { schema: (input) => input ?? '' },
HOUSE_DISCORD_WEBHOOK_URL: { schema: (input) => input ?? '' },
HOUSE_NTFY_URL: { schema: (input) => input ?? '' },
HOUSE_NTFY_TOKEN: { schema: (input) => input ?? '' },
R2_ACCESS_KEY_ID: { schema: (input) => input ?? '' },
R2_SECRET_ACCESS_KEY: { schema: (input) => input ?? '' },
R2_ACCOUNT_ID: { schema: (input) => input ?? '' },
R2_BUCKET: { schema: (input) => input ?? '' },
SPOTIFY_CLIENT_ID: { schema: (input) => input ?? '' },
SPOTIFY_CLIENT_SECRET: { schema: (input) => input ?? '' },
DB_URL: { schema: (input) => input ?? '' }
});