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

- run sv migrate sveltekit-3: config moves into vite.config.ts, $lib becomes
  #lib, $env/dynamic becomes $app/env/private via src/env.ts, $app/environment
  becomes $app/env, hook types move to @sveltejs/kit/hooks
- env vars stay optional (the migrator defaulted them to ''), and BANCHO_MODE,
  which it missed, is declared and passed to simulatorEnabled
- handleError only logs and masks unknown errors; Kit 3 now routes 404s and
  error(...) through it too
- json()/text() become Response.json()/new Response(); goto keepFocus/noScroll
  becomes reset: false; invalidateAll becomes refreshAll; page.url is copied
  before mutating
- replace adapter-node with @sveltejs/adapter-bun; prod-server.ts wraps
  Bun.serve to add native WebSockets (bunSockets) for /ws paths, since the
  generated server has no websocket option
- drop the Kit readdir patch: Kit 3 sorts route entries itself
- match view and broadcast pages use the live score modules

BREAKING CHANGE: requires SvelteKit 3, TypeScript 6 and Bun 1.4; the build
output is build/index.js from adapter-bun, started through prod-server.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-18 22:02:53 +00:00
parent 54444a77f0
commit d5448d9a94
239 changed files with 1650 additions and 1360 deletions

View File

@@ -10,7 +10,7 @@ import {
uniqueIndex
} from 'drizzle-orm/pg-core';
import { jsonb } from './jsonb';
import type { ConnectionProfile } from '$lib/auth-identity';
import type { ConnectionProfile } from '#lib/auth-identity.js';
export const user = pgTable('user', {
id: text('id').primaryKey(),

View File

@@ -1,14 +1,14 @@
import * as schema from './schema';
import { building } from '$app/environment';
import { building } from '$app/env';
import { SQL } from 'bun';
import { drizzle } from 'drizzle-orm/bun-sql';
import { env } from '$env/dynamic/private';
import { log } from '$lib/server/logger';
import { singleton } from '$lib/server/singleton';
import { DATABASE_URL, DB_URL, LOG_SQL } from '$app/env/private';
import { log } from '#lib/server/logger.js';
import { singleton } from '#lib/server/singleton.js';
function createDb() {
if (building) return null!;
const databaseUrl = env.DATABASE_URL || env.DB_URL;
const databaseUrl = DATABASE_URL || DB_URL;
if (!databaseUrl) throw new Error('DATABASE_URL or DB_URL is not set');
// One pool per process: the shared Postgres server allows 100 connections
// across every app and environment on the VM.
@@ -17,8 +17,10 @@ function createDb() {
client,
schema,
logger:
env.LOG_SQL === '1'
? { logQuery: (query) => log.db.debug({ query: query.slice(0, 300) }, 'query') }
LOG_SQL === '1'
? {
logQuery: (query) => log.db.debug({ query: query.slice(0, 300) }, 'query')
}
: false
});
}

View File

@@ -708,7 +708,7 @@ export const broadcastDestination = pgTable(
platform: text('platform').notNull(),
label: text('label').notNull(),
ingestUrl: text('ingest_url').notNull(),
/** Encrypted; see $lib/server/secrets. */
/** Encrypted; see #lib/server/secrets. */
streamKey: text('stream_key').notNull(),
enabled: boolean('enabled').default(true).notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull()