Skip to content

Commit b0b3212

Browse files
committed
Add Svelte frontends and installer packaging
1 parent 155e693 commit b0b3212

39 files changed

Lines changed: 2074 additions & 41 deletions

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Added
6+
7+
- Adds `--frontend svelte` and `--frontend sveltekit` renderer modes with prompts, CLI help, manifest/schema support, generated templates, and validation coverage.
8+
- Adds `--packaging installers` for generated AppImage, deb, DMG collection, and NSIS packaging helpers around Electrobun release artifacts.
9+
310
## 1.1.0
411

512
### Added

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Node version](https://img.shields.io/node/v/create-electrobun-stack.svg)](https://www.npmjs.com/package/create-electrobun-stack)
66
[![Bun >=1.3.0](https://img.shields.io/badge/Bun-%3E%3D1.3.0-000?logo=bun&logoColor=white)](https://bun.sh)
77

8-
Scaffold a production-minded Electrobun desktop app with Bun, React or Preact, TypeScript, Vite, Biome, typed Electrobun RPC, and a small set of optional integrations that can be enabled at create time or added later.
8+
Scaffold a production-minded Electrobun desktop app with Bun, React, Preact, Svelte, or SvelteKit, TypeScript, Vite, Biome, typed Electrobun RPC, optional native utilities, and optional installer packaging helpers that can be enabled at create time or added later.
99

1010
The generator is intentionally explicit: every selected stack option is written to `ces.json`, the generated project README explains what was scaffolded, and the `add` command can use that manifest to enable missing features without asking you to remember the original command.
1111

@@ -70,6 +70,7 @@ bunx create-electrobun-stack my-app \
7070
--db-setup none \
7171
--settings none \
7272
--package-manager bun \
73+
--packaging none \
7374
--testing bun \
7475
--addons none \
7576
--examples rpc \
@@ -116,6 +117,22 @@ bunx create-electrobun-stack my-app \
116117
--router none
117118
```
118119

120+
Create a Svelte renderer:
121+
122+
```bash
123+
bunx create-electrobun-stack my-app \
124+
--frontend svelte \
125+
--router none
126+
```
127+
128+
Create a static SvelteKit renderer:
129+
130+
```bash
131+
bunx create-electrobun-stack my-app \
132+
--frontend sveltekit \
133+
--router none
134+
```
135+
119136
Create with JSON-file persistence and desktop smoke tests:
120137

121138
```bash
@@ -131,6 +148,12 @@ Add file dialogs and clipboard utilities:
131148
bunx create-electrobun-stack my-app --native-utils desktop-kit
132149
```
133150

151+
Add AppImage, deb, DMG, and NSIS packaging helpers:
152+
153+
```bash
154+
bunx create-electrobun-stack my-app --packaging installers
155+
```
156+
134157
Start small and add a feature later:
135158

136159
```bash
@@ -153,7 +176,7 @@ bun run format
153176
bun test
154177
```
155178

156-
Some options add commands. For example, `--addons turborepo` adds `bun run check`, and `--orm drizzle` adds Drizzle scripts.
179+
Some options add commands. For example, `--addons turborepo` adds `bun run check`, `--orm drizzle` adds Drizzle scripts, and `--packaging installers` adds `bun run package:release` plus platform-specific packaging commands.
157180

158181
## Docs
159182

docs/ces.schema.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
},
5454
"frontend": {
5555
"items": {
56-
"enum": ["react", "preact"]
56+
"enum": ["react", "preact", "svelte", "sveltekit"]
5757
},
5858
"type": "array"
5959
},
@@ -75,6 +75,9 @@
7575
"packageName": {
7676
"type": "string"
7777
},
78+
"packaging": {
79+
"enum": ["none", "installers"]
80+
},
7881
"projectName": {
7982
"type": "string"
8083
},
@@ -140,6 +143,7 @@
140143
"examples",
141144
"auth",
142145
"packageManager",
146+
"packaging",
143147
"dbSetup",
144148
"api",
145149
"navigation",

docs/guides/add-command.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Supported additive changes include:
5656
- `--query none` to `--query tanstack-query`
5757
- `--router none` to `--router tanstack-router` or `--router react-router`
5858
- `--addons none` to `--addons turborepo`
59+
- `--packaging none` to `--packaging installers`
5960

6061
The command does not remove features. It also does not change `frontend`, `runtime`, `packageManager`, `buildEnv`, or `buildTargets`.
6162

@@ -107,6 +108,12 @@ Add the native file dialog RPC utility:
107108
bunx create-electrobun-stack add --native-utils file-dialogs
108109
```
109110

111+
Add installer packaging helpers:
112+
113+
```bash
114+
bunx create-electrobun-stack add --packaging installers
115+
```
116+
110117
## Conflict Behavior
111118

112119
The add command protects existing generated projects from destructive stack changes. These are rejected:

docs/guides/generated-project.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ my-app/
1515
vite.config.ts
1616
biome.json
1717
tsconfig.json
18+
scripts/
19+
package-electrobun.ts
1820
tests/
1921
manifest.test.ts
2022
desktop-smoke.test.ts
@@ -49,7 +51,7 @@ my-app/
4951
app.css
5052
```
5153

52-
That layout matches the default stack with the optional desktop smoke test shown for reference. The default stack is TanStack Router, Electrobun RPC, app menu, local navigation rules, Tailwind CSS, and Bun tests. Options can add files such as `src/bun/db/client.ts`, `src/bun/settings/store.ts`, `tests/desktop-smoke.test.ts`, `components.json`, and `turbo.json`, or omit default files when you choose alternatives like `--router none`, `--app-menu none`, or `--testing none`.
54+
That layout matches the default stack with optional desktop smoke and installer packaging files shown for reference. The default stack is TanStack Router, Electrobun RPC, app menu, local navigation rules, Tailwind CSS, and Bun tests. Options can add files such as `src/bun/db/client.ts`, `src/bun/settings/store.ts`, `tests/desktop-smoke.test.ts`, `scripts/package-electrobun.ts`, `components.json`, and `turbo.json`, or omit default files when you choose alternatives like `--router none`, `--app-menu none`, `--packaging none`, or `--testing none`.
5355

5456
## Runtime Model
5557

@@ -110,13 +112,15 @@ Add RPC contract types in `src/shared/rpc/schema.ts`, handler implementation in
110112

111113
With `--frontend react`, all router choices are available.
112114

113-
With `--frontend preact`, use `--router none`; the generated Preact renderer mounts `Home` directly.
115+
With `--frontend preact` or `--frontend svelte`, use `--router none`; the generated renderer mounts `Home` directly.
116+
117+
With `--frontend sveltekit`, use `--router none`; the generated SvelteKit app uses SvelteKit file routing under `src/views/main/routes`.
114118

115119
With `--router tanstack-router`, edit files under `src/views/main/routes`. The generated route tree is produced by the TanStack Router Vite plugin.
116120

117121
With `--router react-router`, edit routes in `src/views/main/app.tsx`.
118122

119-
With `--router none`, the app renders `Home` directly from `src/views/main/app.tsx`.
123+
With `--router none`, React and Preact apps render `Home` directly from `src/views/main/app.tsx`; Svelte apps render `Home` from `src/views/main/App.svelte`.
120124

121125
### RPC
122126

@@ -158,6 +162,21 @@ With `--native-utils desktop-kit`, both native utility examples are enabled.
158162

159163
With `--testing desktop-smoke`, `tests/desktop-smoke.test.ts` mocks `electrobun/bun`, imports the generated window code, creates the main window, and verifies launch options without opening a real OS window.
160164

165+
### Installer Packaging
166+
167+
With `--packaging installers`, `scripts/package-electrobun.ts` wraps Electrobun's release artifacts with extra distribution formats. It copies Electrobun artifacts, reuses Electrobun's generated DMG on macOS, builds AppImage and deb packages on Linux, and builds an NSIS wrapper around Electrobun's Windows setup executable on Windows.
168+
169+
The generated packaging commands are:
170+
171+
```bash
172+
bun run package:release
173+
bun run package:linux
174+
bun run package:mac
175+
bun run package:windows
176+
```
177+
178+
These commands expect non-dev Electrobun artifacts. Use `package:release` for a stable build, or run `bun run build` with a canary/stable build channel before a platform-specific packaging command. Linux AppImage packaging requires `appimagetool`, Linux deb packaging requires `dpkg-deb`, and Windows packaging requires `makensis`.
179+
161180
## Manifest
162181

163182
`ces.json` is part of the project contract. Keep it in source control.
@@ -182,6 +201,7 @@ Before distributing an app generated by this stack:
182201
- Choose build targets intentionally.
183202
- Run `bun run typecheck`, `bun run lint`, and `bun test` when present.
184203
- Run `bun run build` on the platform you are packaging for.
204+
- If `--packaging installers` is enabled, run the package command on the matching OS runner and inspect `dist/installers`.
185205
- Review local persistence paths and database behavior for your release model.
186206

187207
## Troubleshooting

docs/internals/templates.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ templates/minimal/
6464
`base` is always rendered. It contains the common Electrobun app:
6565

6666
- Bun entrypoint and window creation.
67-
- React or Preact renderer entrypoint.
67+
- Shared renderer styles and framework-neutral renderer support files.
6868
- Shared constants and types.
6969
- Optional RPC, router, query, settings, and styling branches controlled by Handlebars data.
7070
- Generated README tailored to selected stack flags.
@@ -82,6 +82,22 @@ Adds `turbo.json` and enables Turbo scripts/dependency through the base `package
8282

8383
Adds `src/bun/menu.ts`. The base Bun entrypoint calls it when `--app-menu edit` is selected.
8484

85+
### `frontend/jsx`
86+
87+
Adds the React/Preact Vite renderer entrypoint, `App`, `Home`, and `index.html`.
88+
89+
### `frontend/svelte-common`
90+
91+
Adds the shared Svelte `Home.svelte` renderer used by both Svelte frontend modes.
92+
93+
### `frontend/svelte`
94+
95+
Adds the direct Svelte Vite entrypoint, `App.svelte`, and `index.html`.
96+
97+
### `frontend/sveltekit`
98+
99+
Adds SvelteKit static adapter config and routes under `src/views/main/routes`.
100+
85101
### `database/sqlite`
86102

87103
Adds a Bun SQLite client and database status surface.
@@ -114,6 +130,10 @@ Adds Tailwind-specific style overlays.
114130

115131
Plain CSS is handled by the base style templates.
116132

133+
### `packaging/installers`
134+
135+
Adds `scripts/package-electrobun.ts`. The base package, TypeScript, and README templates add packaging commands and references when `--packaging installers` is selected.
136+
117137
### `testing/bun`
118138

119139
Adds `tests/manifest.test.ts`. The base package and TypeScript templates add the script and include path when testing is enabled.
@@ -137,6 +157,9 @@ Template data is built in `src/scaffold.ts`. Important booleans include:
137157
- `hasTanstackQuery`
138158
- `hasPreactFrontend`
139159
- `hasReactFrontend`
160+
- `hasSvelteFrontend`
161+
- `hasSvelteKitFrontend`
162+
- `hasSvelteFamilyFrontend`
140163
- `hasTailwind`
141164
- `hasShadcn`
142165
- `hasDatabase`
@@ -147,6 +170,7 @@ Template data is built in `src/scaffold.ts`. Important booleans include:
147170
- `hasDatabaseSettings`
148171
- `hasNativeClipboard`
149172
- `hasNativeFileDialogs`
173+
- `hasInstallerPackaging`
150174
- `hasDesktopSmokeTest`
151175
- `hasAppMenu`
152176
- `hasNavigationGuard`

docs/llm.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
create-electrobun-stack LLM guide
22

33
Purpose:
4-
Scaffold an Electrobun desktop app with Bun, React or Preact, TypeScript, Vite, Biome, typed Electrobun RPC, and optional integrations. The generated project includes ces.json so future tooling can understand and expand the stack.
4+
Scaffold an Electrobun desktop app with Bun, React, Preact, Svelte, or SvelteKit, TypeScript, Vite, Biome, typed Electrobun RPC, and optional integrations. The generated project includes ces.json so future tooling can understand and expand the stack.
55

66
Primary commands:
77

@@ -42,6 +42,7 @@ Default stack:
4242
--db-setup none
4343
--settings none
4444
--package-manager bun
45+
--packaging none
4546
--testing bun
4647
--addons none
4748
--examples rpc
@@ -50,7 +51,7 @@ Default stack:
5051

5152
Generated app:
5253
- Bun native process in src/bun.
53-
- React or Preact renderer in src/views/main.
54+
- React, Preact, Svelte, or SvelteKit renderer in src/views/main.
5455
- Shared types in src/shared.
5556
- Typed RPC contract in src/shared/rpc/schema.ts when --api electrobun-rpc is selected.
5657
- ces.json manifest at project root.
@@ -72,6 +73,8 @@ Option behavior:
7273
- --router react-router adds React Router with HashRouter.
7374
- --router none renders Home directly.
7475
- --frontend preact adds a Preact renderer with @preact/preset-vite. It currently requires --router none, --query none, and --ui none.
76+
- --frontend svelte adds a direct Svelte renderer with @sveltejs/vite-plugin-svelte. It currently requires --router none, --query none, and --ui none.
77+
- --frontend sveltekit adds a static SvelteKit renderer with @sveltejs/adapter-static and SvelteKit file routing. It currently requires --router none, --query none, and --ui none.
7578
- --query tanstack-query adds @tanstack/react-query and QueryClientProvider.
7679
- --styling tailwindcss adds Tailwind CSS v4 and @tailwindcss/vite.
7780
- --styling css omits Tailwind dependencies.
@@ -94,6 +97,7 @@ Option behavior:
9497
- --settings json adds data/settings.json persistence and requires Electrobun RPC.
9598
- --settings database stores settings in SQLite and requires Electrobun RPC plus SQLite.
9699
- --package-manager bun|npm|pnpm|yarn controls install/run command text and package manager metadata.
100+
- --packaging installers adds scripts/package-electrobun.ts plus package:release, package:linux, package:mac, and package:windows scripts for AppImage, deb, DMG collection, and NSIS wrapping around Electrobun artifacts.
97101
- --testing bun adds bun test and tests/manifest.test.ts.
98102
- --testing desktop-smoke adds bun test, tests/manifest.test.ts, and tests/desktop-smoke.test.ts with mocked Electrobun launch verification.
99103
- --testing none omits tests.
@@ -107,7 +111,7 @@ Invalid combinations:
107111
- Native utility examples require Electrobun RPC.
108112
- RPC examples require Electrobun RPC.
109113
- shadcn requires Tailwind CSS.
110-
- Preact requires --router none, --query none, and --ui none.
114+
- Non-React frontends require --router none, --query none, and --ui none.
111115

112116
Add command:
113117
- Reads ces.json from cwd or --cwd.
@@ -126,7 +130,7 @@ Add command:
126130
- Does not remove features or switch package managers/build settings.
127131

128132
Manifest:
129-
- ces.json includes $schema, version, createdAt, reproducibleCommand, projectName, packageName, appIdentifier, template, stack fields, addons, examples, git, install, and features.
133+
- ces.json includes $schema, version, createdAt, reproducibleCommand, projectName, packageName, appIdentifier, template, stack fields, packaging, addons, examples, git, install, and features.
130134
- V1 manifests are additive. Unknown fields should be tolerated. Breaking manifest migrations require a documented migration path.
131135
- Keep ces.json in source control.
132136
- Prefer create-electrobun-stack add over hand-editing ces.json.

docs/reference/cli.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ The command reads `ces.json`, applies only the flags you pass, infers required p
8282
| Option | Values | Default |
8383
| --- | --- | --- |
8484
| `--template` | `minimal`, `standard`, `full` | `minimal` |
85-
| `--frontend` | `react`, `preact` | `react` |
85+
| `--frontend` | `react`, `preact`, `svelte`, `sveltekit` | `react` |
8686
| `--router` | `tanstack-router`, `react-router`, `none` | `tanstack-router` |
8787
| `--query` | `none`, `tanstack-query` | `none` |
8888
| `--runtime` | `bun` | `bun` |
@@ -94,6 +94,7 @@ The command reads `ces.json`, applies only the flags you pass, infers required p
9494
| `--db-setup` | `none`, `seed` | `none` |
9595
| `--settings` | `none`, `json`, `database` | `none` |
9696
| `--package-manager` | `bun`, `npm`, `pnpm`, `yarn` | `bun` |
97+
| `--packaging` | `none`, `installers` | `none` |
9798
| `--testing` | `bun`, `desktop-smoke`, `none` | `bun` |
9899
| `--addons` | `none`, `turborepo` | `none` |
99100
| `--examples` | `rpc`, `none` | `rpc` |
@@ -121,8 +122,8 @@ The CLI fails before files are written when unsupported combinations are selecte
121122
- `--native-utils file-dialogs` requires `--api electrobun-rpc`.
122123
- `--native-utils clipboard` and `--native-utils desktop-kit` require `--api electrobun-rpc`.
123124
- `--examples rpc` requires `--api electrobun-rpc`.
124-
- `--ui shadcn` requires `--styling tailwindcss`.
125-
- `--frontend preact` currently requires `--router none`, `--query none`, and `--ui none`.
125+
- `--ui shadcn` requires `--styling tailwindcss` and `--frontend react`.
126+
- `--frontend preact`, `--frontend svelte`, and `--frontend sveltekit` currently require `--router none`, `--query none`, and `--ui none`.
126127

127128
The `add` command can infer some prerequisites. For example, `add --orm drizzle` enables SQLite if it was missing, and `add --ui shadcn` enables Tailwind CSS if the app was created with plain CSS.
128129

@@ -174,6 +175,22 @@ bunx create-electrobun-stack my-app \
174175
--router none
175176
```
176177

178+
Use Svelte with direct rendering:
179+
180+
```bash
181+
bunx create-electrobun-stack my-app \
182+
--frontend svelte \
183+
--router none
184+
```
185+
186+
Use SvelteKit with static file routing:
187+
188+
```bash
189+
bunx create-electrobun-stack my-app \
190+
--frontend sveltekit \
191+
--router none
192+
```
193+
177194
Use plain CSS and no renderer router:
178195

179196
```bash
@@ -224,6 +241,12 @@ Use native clipboard plus file dialogs:
224241
bunx create-electrobun-stack my-app --native-utils desktop-kit
225242
```
226243

244+
Add installer packaging helpers:
245+
246+
```bash
247+
bunx create-electrobun-stack my-app --packaging installers
248+
```
249+
227250
Add desktop launch smoke tests:
228251

229252
```bash
@@ -272,5 +295,6 @@ Options may add commands:
272295

273296
- `--addons turborepo` adds `bun run check`.
274297
- `--orm drizzle` adds `bun run db:generate` and `bun run db:studio`.
298+
- `--packaging installers` adds `bun run package:release`, `bun run package:linux`, `bun run package:mac`, and `bun run package:windows`.
275299
- `--testing desktop-smoke` keeps `bun test` and adds `tests/desktop-smoke.test.ts`.
276300
- `--testing none` omits `bun test`.

0 commit comments

Comments
 (0)