create-rsc-kit 0.24.2 → 0.24.3

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.
package/README.md CHANGED
@@ -6,18 +6,40 @@ Scaffold a React Server Components app that builds and runs before you edit it.
6
6
  bun create rsc-kit@latest my-app
7
7
  ```
8
8
 
9
- Asks which server (Bun, Hono, Elysia or `node:http`), whether you want the React
10
- Compiler, and whether to include Tailwind. Every answer has a flag, so it runs
11
- unattended too:
9
+ It asks where the app will run (Bun, Node or Cloudflare Workers — a Nitro
10
+ preset), whether you want the React Compiler, Tailwind and, if so, shadcn/ui,
11
+ oxlint, a validation library, typed environment variables, and whether the
12
+ app should be installable. Every answer has a flag, so it runs unattended too:
12
13
 
13
14
  ```sh
14
- bun create rsc-kit@latest my-app --host=bun --compiler=oxc --tailwind
15
+ bun create rsc-kit@latest my-app --host=bun --compiler=oxc --tailwind --yes
15
16
  ```
16
17
 
18
+ | Flag | What it does |
19
+ | --- | --- |
20
+ | `--host=bun\|node\|worker` | Where it runs, which picks the Nitro preset |
21
+ | `--compiler=none\|oxc\|babel` | The React Compiler; the prompt offers oxc |
22
+ | `--tailwind`, `--no-tailwind` | Include Tailwind |
23
+ | `--shadcn` | shadcn/ui, set up for RSC; needs Tailwind |
24
+ | `--lint`, `--no-lint` | Include oxlint |
25
+ | `--validation=zod\|valibot\|arktype\|none` | The schema library forms, actions and env use |
26
+ | `--env`, `--no-env` | Typed environment variables |
27
+ | `--pwa`, `--no-pwa` | Installable: offline, a manifest, starter icons (off by default) |
28
+ | `--source-dir=<dir>` | Where `app/` lives (default `src`) |
29
+ | `--backend=<url>` | A backend answering `rpc()`, such as a Go server; writes `.env` with a secret |
30
+ | `--no-install`, `--no-git` | Skip installing dependencies, or `git init` |
31
+ | `--yes` | Accept every default and ask nothing |
32
+
33
+ Use `--yes`, not `-y`, with `bun create`: Bun reads `-y` as its own flag.
34
+ `bunx create-rsc-kit my-app -y` accepts either.
35
+
17
36
  The point is not the typing it saves. Several things in this setup fail by
18
- producing an app that looks nearly right — a server that serves a development
19
- payload to a production client, a stylesheet with no server-component classes
20
- in it, an engine declaration that typechecks the server and fails the prerender.
21
- What comes out has those right.
37
+ producing an app that looks nearly right — a stylesheet with no
38
+ server-component classes in it, shadcn's components written without
39
+ `"use client"`, an engine declaration that typechecks the server and fails the
40
+ prerender. What comes out builds, prerenders, typechecks and serves.
41
+
42
+ To add rsc-kit to a project that already exists, use
43
+ [`rsc-kit init`](https://www.npmjs.com/package/rsc-kit) instead.
22
44
 
23
- Docs: https://docs.rsc-kit.dev · Licence: MIT
45
+ Docs: https://docs.rsc-kit.dev/installation · Licence: MIT
package/dist/init.js CHANGED
@@ -655,7 +655,7 @@ const INIT_HELP = `
655
655
 
656
656
  Options
657
657
  --source-dir <dir> where app/ should live (detected, usually src)
658
- --host=… bun | hono | elysia | node (detected from your deps)
658
+ --host=… bun | node | worker (detected from your deps)
659
659
  laravel is detected from artisan, never asked
660
660
  --backend=<url> a backend answering host calls - a Go server, say, at
661
661
  http://127.0.0.1:8080 (assumed when go.mod is here);
package/dist/options.js CHANGED
@@ -118,7 +118,10 @@ export function defaultCore(fromDir) {
118
118
  */
119
119
  export function parseArgs(argv) {
120
120
  const out = {};
121
- for (const arg of argv) {
121
+ // `--source-dir src` as well as `--source-dir=src`: the help shows the
122
+ // first, and it was read as the project's directory instead.
123
+ const args = argv.flatMap((arg, i) => arg === '--source-dir' ? [] : argv[i - 1] === '--source-dir' ? ['--source-dir=' + arg] : [arg]);
124
+ for (const arg of args) {
122
125
  if (arg === '--help' || arg === '-h')
123
126
  out.help = true;
124
127
  else if (arg === '--yes' || arg === '-y')
package/dist/templates.js CHANGED
@@ -82,7 +82,11 @@ export function scripts(o) {
82
82
  // costs more than it saves.
83
83
  ...(o.host === 'worker'
84
84
  ? {
85
- preview: 'wrangler dev .output/server/index.mjs',
85
+ // No entry argument: the build leaves .wrangler/deploy/config.json
86
+ // pointing at its own wrangler.json, and wrangler refuses an entry
87
+ // beside that - "found both a user configuration file and a deploy
88
+ // configuration file" - so the script never started.
89
+ preview: 'wrangler dev',
86
90
  deploy: 'vite build && nitro deploy --prebuilt',
87
91
  }
88
92
  : {
@@ -232,7 +236,13 @@ export function viteConfig(o) {
232
236
  //
233
237
  // Not optional, and not a flag on rscKit() either — the plugin builds for
234
238
  // Nitro and nothing else, so a config without this line has no server.
235
- plugins.push(`nitro({ preset: ${JSON.stringify(preset(o.host))}, serveStatic: 'inline' })`);
239
+ // On Workers, the runtime's compatibility date is pinned to the day the app
240
+ // was made: left to Nitro it is each build's own date, so behaviour changed
241
+ // from one build to the next, and a wrangler older than the build refused to
242
+ // run it at all.
243
+ plugins.push(o.host === 'worker'
244
+ ? `nitro({ preset: 'cloudflare_module', serveStatic: 'inline', compatibilityDate: '${new Date().toISOString().slice(0, 10)}' })`
245
+ : `nitro({ preset: ${JSON.stringify(preset(o.host))}, serveStatic: 'inline' })`);
236
246
  plugins.push(`rscKit({
237
247
  ${options.join(',\n ')},
238
248
  })`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rsc-kit",
3
- "version": "0.24.2",
3
+ "version": "0.24.3",
4
4
  "type": "module",
5
5
  "description": "Scaffold an RSC app on Bun, Hono, Elysia or Node.",
6
6
  "bin": {