svelte-bundle 0.2.0-beta.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/ReadMe.md +50 -90
  2. package/package.json +8 -2
package/ReadMe.md CHANGED
@@ -1,36 +1,18 @@
1
- > ⚠️ **NOTICE:** While this tool is currently functional, it has not nearly been battle-tested enough to ensure it works in most use-cases.
1
+ > **Early release** functional but not yet battle-tested across all use-cases.
2
2
 
3
3
  ![svelte-bundle](https://media2.dev.to/dynamic/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcwfyh1w8r8g4f2ap1hff.png)
4
4
 
5
- ## Usage
6
- ```bash
7
- svelte-bundle create my-app
8
- cd my-app
9
- svelte-bundle build
10
- ```
11
-
12
- ### Full Documentation: [https://github.com/uhteddy/svelte-bundle/wiki](https://github.com/uhteddy/svelte-bundle/wiki)
5
+ # svelte-bundle
13
6
 
14
- # Svelte Bundle CLI
7
+ Scaffold a Svelte 5 + Vite project and bundle it into a **single self-contained `.html` file** — CSS and JS fully inlined, no web server required.
15
8
 
16
- **Svelte Bundle CLI** is a command-line tool that scaffolds a Svelte 5 + Vite project and bundles it into a single self-contained `.html` file. The goal of this tool is to make it easy to develop with Svelte and deploy anywhere particularly for cases where everything needs to be contained in a single file.
9
+ Built for environments that only accept plain HTML: legacy CMS platforms or anywhere you need real reactivity without a build server.
17
10
 
18
- Just note, the purpose of this tool is **NOT** to bundle an entire large-scale Svelte app. The purpose is to expand the capabilities of Svelte to work on systems like certain Content Management Systems (CMS) that only allow HTML, CSS, and JS. It was also built with SSR hydration support so the generated file is SEO-safe, with necessary elements already pre-rendered.
11
+ > **Not a SvelteKit tool.** This scaffolds a standalone Svelte 5 app and outputs one `.html` file.
19
12
 
20
- Utilizing this you will be able to develop a page with the joy of Svelte — components, reactivity, TypeScript, Tailwind — and output a single `.html` file you can drop anywhere.
21
-
22
- ⚠️ **Note**: This tool is **NOT** made to function with SvelteKit natively. It scaffolds a standalone Svelte 5 app (not a SvelteKit project) and outputs a single `.html` file.
23
-
24
- ## Inspiration
25
- This tool was inspired by the need I had when it came to updating the CMS for a company I worked for. They were looking for more custom content on their website which used an outdated CMS. Pages were only able to include HTML, CSS, and JS.
26
-
27
- Pure HTML, CSS, and JS can be granular and more importantly, lacks the reactivity that Svelte has. Meaning, to develop certain features I had to focus a lot more on the "what to do" when data changes, rather than Svelte handling that for me.
28
-
29
- So, I searched for tools around that could be of assistance. I found [figsvelte](https://github.com/thomas-lowry/figsvelte) which was of so much help in the underlying understanding of what to do. But, it did not accomplish all I was looking for. I needed a solution that didn't just generate an HTML file with JS that hydrated the page. Through a lot of tinkering I was finally able to get the system to work.
30
-
31
- I noticed through a lot of Google searches I wasn't the only one looking for a solution like this, yet I was unable to find one that addressed everything I was looking for. So, for this reason I built svelte-bundle to take care of this in a much more simplistic and CLI-driven way.
13
+ ---
32
14
 
33
- ## Installation
15
+ ## Install
34
16
 
35
17
  ```bash
36
18
  npm install -g svelte-bundle
@@ -38,49 +20,57 @@ npm install -g svelte-bundle
38
20
  bun add -g svelte-bundle
39
21
  ```
40
22
 
41
- `sb` is available as a short alias:
23
+ Short alias `sb` is also available.
24
+
25
+ ---
26
+
27
+ ## Quickstart
42
28
 
43
29
  ```bash
44
- sb create my-app
45
- sb build --hydrate
30
+ svelte-bundle create my-app
31
+ cd my-app
32
+ npm run dev # develop with hot reload
33
+ svelte-bundle build # → dist/index.html
46
34
  ```
47
35
 
48
36
  ---
49
37
 
50
- ## `svelte-bundle create`
38
+ ## Commands
39
+
40
+ ### `svelte-bundle create [name]`
51
41
 
52
- Scaffolds a new Vite + Svelte 5 project with TypeScript configured and ready to go.
42
+ Scaffolds a new project with Svelte 5, Vite, and TypeScript ready to run.
53
43
 
54
44
  ```bash
55
45
  svelte-bundle create my-app
56
46
  ```
57
47
 
58
- Interactive prompts will ask for:
59
- - **Package manager** — bun, npm, pnpm, or yarn
60
- - **Optional features** — Tailwind CSS, ESLint, Prettier, Vitest
61
- - **Git** initialize a repository
62
- - **Install** — run the package manager automatically
48
+ Interactive prompts let you choose a package manager and optional features. You can also skip prompts with flags:
49
+
50
+ ```bash
51
+ svelte-bundle create my-app --pm bun --no-git
52
+ ```
63
53
 
64
54
  | Flag | Description |
65
55
  |---|---|
66
- | `--template / -t` | Template to use (currently: `default`) |
67
- | `--pm` | Skip the package manager prompt (`bun`, `npm`, `pnpm`, `yarn`) |
56
+ | `-t, --template` | Template to use (default: `default`) |
57
+ | `--pm` | Package manager: `bun`, `npm`, `pnpm`, `yarn` |
68
58
  | `--no-install` | Skip dependency installation |
69
59
  | `--no-git` | Skip git initialization |
70
60
 
71
- ```bash
72
- svelte-bundle create my-app --pm bun --no-git
73
- ```
74
-
75
- ### Project structure
61
+ **Optional features** (selected during prompts):
62
+ - **Tailwind CSS** `@tailwindcss/vite` v4, zero config
63
+ - **ESLint** — with Svelte plugin
64
+ - **Prettier** — with Svelte plugin
65
+ - **Vitest** — unit testing setup
76
66
 
67
+ **Output structure:**
77
68
  ```
78
69
  my-app/
79
70
  ├── src/
80
71
  │ ├── App.svelte ← root component
81
72
  │ ├── main.ts ← entry point
82
- │ └── lib/
83
- │ └── index.ts ← library re-export entry
73
+ │ └── lib/index.ts
84
74
  ├── public/
85
75
  ├── index.html
86
76
  ├── vite.config.ts
@@ -88,71 +78,41 @@ my-app/
88
78
  └── package.json
89
79
  ```
90
80
 
91
- ### Dev server
92
-
93
- ```bash
94
- cd my-app
95
- npm run dev
96
- ```
97
-
98
81
  ---
99
82
 
100
- ## `svelte-bundle build`
101
-
102
- Builds the project into a **single self-contained `dist/index.html`** with all CSS and JavaScript inlined — no separate asset files, no web server needed.
103
-
104
- ```bash
105
- cd my-app
106
- svelte-bundle build
107
- ```
108
-
109
- | Flag | Default | Description |
110
- |---|---|---|
111
- | `--hydrate` | `false` | Pre-render with Svelte SSR for SEO-friendly output |
112
- | `--entry` | `src/App.svelte` | Root component for SSR pre-rendering |
113
- | `--outfile` | `dist/index.html` | Output file path |
114
- | `--mode / -m` | `production` | Vite build mode |
83
+ ### `svelte-bundle build`
115
84
 
116
- ### Default build
85
+ Compiles the project and inlines everything into a single `dist/index.html`.
117
86
 
118
87
  ```bash
119
88
  svelte-bundle build
120
89
  ```
121
90
 
122
- Produces a single `dist/index.html` with CSS and JS fully inlined. Open it directly in a browser no web server required. Drop it into any CMS, email, or embedded environment.
123
-
124
- ### Hydrated build (SSR)
91
+ Add `--hydrate` to pre-render with SSRuseful for SEO, fast LCP, or CMS environments that crawl content:
125
92
 
126
93
  ```bash
127
94
  svelte-bundle build --hydrate
128
95
  ```
129
96
 
130
- Pre-renders the root component server-side so the page contains real HTML content before JavaScript executes. Useful for:
131
-
132
- - **SEO** — search engine crawlers see actual content immediately
133
- - **LCP** — Largest Contentful Paint is not blocked by JS execution
134
- - **CMS / embedded use** — a fully pre-rendered, static single file
97
+ With `--hydrate`, the root component is server-rendered first so real HTML content exists before JavaScript runs. The client JS automatically calls `hydrate()` or `mount()` depending on what it finds — no extra config needed.
135
98
 
136
- The client JS automatically detects whether SSR content is present and calls `hydrate()` or `mount()` accordingly — no separate builds or entry points needed.
99
+ | Flag | Default | Description |
100
+ |---|---|---|
101
+ | `--hydrate` | `false` | Pre-render with Svelte SSR |
102
+ | `--entry` | `src/App.svelte` | Root component for SSR |
103
+ | `--outfile` | `dist/index.html` | Output path |
104
+ | `-m, --mode` | `production` | Vite build mode |
137
105
 
138
- ### How the build pipeline works
106
+ **How the build works:**
107
+ 1. `vite build` compiles and minifies the Svelte app
108
+ 2. Every `<link rel="stylesheet">` is replaced with an inline `<style>` block
109
+ 3. Every `<script src="...">` is replaced with an inline `<script type="module">` block
110
+ 4. *(with `--hydrate`)* A Vite SSR build pre-renders the component and injects the HTML into `<div id="app">`
139
111
 
140
- 1. **Client bundle** `vite build` compiles and minifies the Svelte app via your `vite.config.ts`
141
- 2. **Inline** — every `<link rel="stylesheet">` becomes an inline `<style>` block; every `<script src="...">` becomes an inline `<script type="module">` block
142
- 3. **SSR** *(with `--hydrate` only)* — a temporary Vite SSR build server-renders the component; the HTML is injected into `<div id="app">` before inlining; all temp files are cleaned up automatically
112
+ The result is one `.html` file you can open directly in a browser or drop into any system.
143
113
 
144
114
  ---
145
115
 
146
- ## Features
147
- - [x] Scaffold a Svelte 5 + Vite project with a single command
148
- - [x] Outputs a single `.html` file ready for deployment anywhere
149
- - [x] All CSS and JS fully inlined — zero external dependencies at runtime
150
- - [x] SSR hydration support for SEO-safe output
151
- - [x] Tailwind CSS support out of the box (selected during `create`)
152
- - [x] Optional ESLint, Prettier, and Vitest setup
153
- - [x] TypeScript everywhere, strict mode enforced
154
- - [x] Works with any Vite plugin ecosystem
155
-
156
116
  ## Requirements
157
117
 
158
118
  - Node.js 18+ or Bun 1.0+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-bundle",
3
- "version": "0.2.0-beta.1",
3
+ "version": "0.3.0",
4
4
  "description": "A powerful CLI for scaffolding and bundling Svelte components",
5
5
  "type": "module",
6
6
  "bin": {
@@ -18,7 +18,9 @@
18
18
  "build": "bun build src/cli.ts --outfile dist/cli.js --target node --format esm",
19
19
  "dev": "bun run src/cli.ts",
20
20
  "test": "bun test",
21
- "type-check": "tsc --noEmit"
21
+ "type-check": "tsc --noEmit",
22
+ "release": "release-it",
23
+ "prepare": "husky"
22
24
  },
23
25
  "dependencies": {
24
26
  "@clack/prompts": "^0.9.1",
@@ -26,7 +28,11 @@
26
28
  "picocolors": "^1.1.1"
27
29
  },
28
30
  "devDependencies": {
31
+ "@commitlint/cli": "^20.4.3",
32
+ "@commitlint/config-conventional": "^20.4.3",
33
+ "@release-it/conventional-changelog": "^10.0.5",
29
34
  "@types/bun": "latest",
35
+ "husky": "^9.1.7",
30
36
  "release-it": "^19.2.4",
31
37
  "typescript": "^5"
32
38
  }