rsc-kit 0.1.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 (3) hide show
  1. package/README.md +25 -0
  2. package/dist/index.js +37 -0
  3. package/package.json +37 -0
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # rsc-kit
2
+
3
+ The command line for [rsc-kit](https://rsc-kit.dev) — React Server Components
4
+ as a Vite plugin, on any JavaScript server.
5
+
6
+ ```sh
7
+ bunx rsc-kit init # add it to a project you already have
8
+ bunx rsc-kit prerender # render every route once and store what it can
9
+ ```
10
+
11
+ Starting from nothing instead:
12
+
13
+ ```sh
14
+ bun create rsc-kit my-app
15
+ ```
16
+
17
+ `init` never rewrites anything that exists. It writes the files you do not have,
18
+ adds the dependencies you are missing, and for your vite config and your server
19
+ — the two files most likely to hold work that took a while to get right — it
20
+ prints the exact edit for you to make.
21
+
22
+ Installing this package also gives you [`@rsc-kit/core`](https://www.npmjs.com/package/@rsc-kit/core),
23
+ so `import { rscRoutes } from '@rsc-kit/core/vite'` works after `bun add rsc-kit`.
24
+
25
+ Docs: https://rsc-kit.dev · Licence: MIT
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ // rsc-kit — the commands an app runs, and the door into an existing project.
3
+ //
4
+ // Two entry points exist on purpose. `bun create rsc-kit my-app` scaffolds a
5
+ // new one; this is what someone types when they already have a project, and it
6
+ // has to work with nothing installed — which is why `init` delegates to
7
+ // create-rsc-kit rather than reimplementing it. One implementation, two doors.
8
+ import { argv, exit, stdout } from 'node:process';
9
+ const HELP = `
10
+ rsc-kit — React Server Components on any JavaScript server
11
+
12
+ Usage
13
+ rsc-kit init [options] add it to the project in this directory
14
+ rsc-kit prerender [options] render every route once and store what it can
15
+
16
+ Run \`rsc-kit <command> --help\` for what each takes.
17
+ Starting a new app instead: bun create rsc-kit my-app
18
+ `;
19
+ const [command, ...rest] = argv.slice(2);
20
+ if (!command || command === '--help' || command === '-h') {
21
+ stdout.write(HELP);
22
+ exit(command ? 0 : 1);
23
+ }
24
+ if (command === 'init') {
25
+ // The scaffolder owns every template already; init is the mode of it that
26
+ // writes into a project rather than an empty directory.
27
+ const { runInit } = await import('create-rsc-kit/init');
28
+ await runInit(rest);
29
+ }
30
+ else if (command === 'prerender') {
31
+ const { runPrerender } = await import('@rsc-kit/core/cli');
32
+ await runPrerender(rest);
33
+ }
34
+ else {
35
+ stdout.write(`\n Not an rsc-kit command: ${command}\n${HELP}`);
36
+ exit(1);
37
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "rsc-kit",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "The rsc-kit command line: add it to a project, and freeze what can be frozen.",
6
+ "bin": {
7
+ "rsc-kit": "./dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && chmod +x dist/index.js",
14
+ "typecheck": "tsc --noEmit"
15
+ },
16
+ "keywords": [
17
+ "rsc",
18
+ "react-server-components",
19
+ "cli",
20
+ "vite"
21
+ ],
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/rsc-kit/rsc-kit.git",
26
+ "directory": "packages/cli"
27
+ },
28
+ "homepage": "https://rsc-kit.dev",
29
+ "dependencies": {
30
+ "@rsc-kit/core": "^0.1.0",
31
+ "create-rsc-kit": "^0.1.0"
32
+ },
33
+ "devDependencies": {
34
+ "@types/node": "^24.0.0",
35
+ "typescript": "^7.0.2"
36
+ }
37
+ }