chore: Remove SvelteKit, modernise frontend to Svelte 5 + Vite#427
chore: Remove SvelteKit, modernise frontend to Svelte 5 + Vite#427
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR removes the SvelteKit framework from the captive portal frontend (which never used SSR or routing features) and replaces it with plain Svelte 5 + Vite. The build output is a single index.html inlined via vite-plugin-singlefile for serving from ESP32 LittleFS. All state management is modernized from Svelte 4 writable stores to Svelte 5 $state/$derived rune classes, and shadcn-svelte UI components are upgraded to newer versions compatible with bits-ui v2.
Changes:
- Replaced SvelteKit with plain Svelte 5 + Vite, moving the app entry from
src/routes/+layout.svelte++page.sveltetosrc/App.svelte+src/main.ts, and updating all build/config files accordingly. - Migrated all stores (
HubStateStore,UsedPinsStore,ColorSchemeStore) fromsvelte/storewritables to Svelte 5$state/$derivedrune classes in.svelte.tsfiles, replacing all$storesubscriptions with direct property access. - Upgraded shadcn-svelte UI components (dialog, dropdown-menu, button, input, label, scroll-area, sonner) to newer patterns—moved utility types from
bits-uito$lib/utils/shadcn.ts, addeddata-slotattributes, and updated Tailwind CSS from v3 HSL variable theme to v4 OKLCH inline theme.
Reviewed changes
Copilot reviewed 86 out of 88 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
frontend/vite.config.ts |
Replaced SvelteKit plugin with standalone Svelte/Vite config, added singlefile, license, and visualizer plugins |
frontend/tsconfig.json |
Self-contained config with explicit $lib path alias, removing SvelteKit extends |
frontend/tailwind.config.ts |
Deleted — theme config moved to app.css using Tailwind v4 syntax |
frontend/svelte.config.js |
Stripped SvelteKit adapter/kit config; kept compiler options for runes mode |
frontend/src/routes/* |
Deleted all SvelteKit route files |
frontend/src/main.ts |
New Vite entry point using Svelte mount() |
frontend/src/App.svelte |
Consolidated layout + page into single root component |
frontend/src/lib/stores/*.svelte.ts |
Migrated all stores to Svelte 5 $state/$derived rune classes |
frontend/src/lib/WebSocketClient.ts |
Removed $app/environment and $app/stores imports |
frontend/src/lib/MessageHandlers/index.ts |
Updated all store references from HubStateStore methods to direct hubState property access |
frontend/src/lib/MessageHandlers/WifiNetworkEventHandler.ts |
Same store reference updates |
frontend/src/lib/components/*.svelte |
Updated store access patterns from $HubStateStore.x to hubState.x |
frontend/src/lib/components/LightSwitch.svelte |
Updated to use ColorScheme enum and colorScheme instance |
frontend/src/lib/utils/shadcn.ts |
New file hosting cn() and utility types moved from bits-ui |
frontend/src/lib/typeguards/ |
Renamed from type_guards, added isBoolean, isDate, isStringOrNull |
frontend/src/app.css |
Replaced HSL variables with OKLCH values, Tailwind v4 @theme inline syntax |
frontend/src/app.d.ts |
Replaced SvelteKit App namespace with Navigator and ObjectConstructor augmentations |
frontend/index.html |
Standard Vite HTML entry replacing SvelteKit template placeholders |
frontend/src/lib/components/ui/** |
Updated shadcn-svelte components with data-slot attributes, new import paths |
frontend/package.json |
Removed SvelteKit dependencies, added new plugins, updated all versions |
frontend/eslint.config.js |
Updated for flat config with defineConfig, removed SvelteKit-specific rules |
frontend/components.json |
Updated shadcn-svelte registry and utility paths |
frontend/.prettierrc |
Added prettier-plugin-organize-imports |
frontend/playwright.config.ts |
Updated to use pnpm, added reporter and trace config |
frontend/src/lib/Serializers/*.ts |
Import reordering only |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The captive portal frontend used SvelteKit as a build tool only - none of its server-side features (SSR, routing, load functions, form actions, API routes) were in use. The entire app is a single-page, purely client-side WebSocket UI served statically from ESP32 LittleFS. This PR removes SvelteKit entirely and replaces it with plain Svelte 5 + Vite, then modernises all state management to native Svelte 5 runes.
Bundle impact
index.htmlrawindex.htmlgzippedDependency changes
Removed:
@sveltejs/kit@sveltejs/adapter-staticAdded:
vite-plugin-singlefile- replacesbundleStrategy: 'inline'from the old adapter, inlining all JS/CSS into a singleindex.html(required for LittleFS)Updated:
@sveltejs/vite-plugin-svelte^5→^6Structural changes
src/routes/+layout.svelte++page.sveltesrc/App.sveltesrc/app.html(SvelteKit template)index.html(Vite standard)src/main.ts(implicit SvelteKit entry)src/main.tsusingmount()svelte.config.jswithadapter-statickit configsvelte.config.jswith compiler options onlytsconfig.jsonextending.svelte-kit/tsconfig.jsontsconfig.jsonwith explicit$libpathssvelte-kit syncinprepare/checkscriptsStore modernisation (Svelte 4 → Svelte 5)
All stores migrated from
svelte/storewritable/subscribe pattern to Svelte 5$state/$derivedrune classes:HubStateStore.ts→HubStateStore.svelte.ts-$statefields per property;wifiNetworkGroupsis now$derived.byfromwifiNetworks(was manually recomputed after every mutation); exported ashubStateinstanceUsedPinsStore.ts→UsedPinsStore.svelte.ts- private$stateMap with typed accessor; exported asusedPinsinstanceColorSchemeStore.ts→ColorSchemeStore.svelte.ts- existing$stateclass, removedbrowserSSR guard (always runs in browser)$HubStateStore.x/$UsedPinsStore.xtemplate subscriptions replaced with plainhubState.x/usedPins.xHubStateStore.update((s) => { ... })batch mutation pattern replaced with direct property assignmentOther cleanup
WebSocketClient: removed$app/environment(browser) guard and$app/stores(page) import - replaced withwindow.location.hostnameHeader.svelte: removeddata-sveltekit-preload-data="hover"attributeapp.d.ts: removed empty SvelteKitAppnamespaceeslint.config.js: removedsvelte/no-navigation-without-resolve(SvelteKit-only rule)pnpm-lock.yaml: overrides forcookieandjs-yaml(SvelteKit transitive deps) removed