rsc-kit 0.24.0 → 0.24.2

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/dist/index.js +17 -4
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -12,8 +12,9 @@ const HELP = `
12
12
  Usage
13
13
  rsc-kit init [options] add it to the project in this directory,
14
14
  or start one here if the directory is empty
15
- rsc-kit typegen write the route types without starting Vite,
16
- for a typecheck after a route was added
15
+ rsc-kit typegen [--check] write the route types without starting Vite,
16
+ for a typecheck after a route was added;
17
+ --check fails if committed ones are stale
17
18
 
18
19
  Run \`rsc-kit init --help\` for what it takes. Freezing pages is part of
19
20
  \`vite build\` and has no command: it needs the bundle the build just wrote,
@@ -42,8 +43,20 @@ else if (command === 'typegen') {
42
43
  // Loads the app's vite.config through the app's own Vite, so the types come
43
44
  // from the plugin version and options the app builds with.
44
45
  const { typegen } = await import('@rsc-kit/core/typegen');
45
- await typegen();
46
- stdout.write('rsc-kit: route types written\n');
46
+ const check = rest.includes('--check');
47
+ const stale = await typegen(process.cwd(), check);
48
+ if (!check) {
49
+ stdout.write('rsc-kit: route types written\n');
50
+ }
51
+ else if (stale.length === 0) {
52
+ stdout.write('rsc-kit: generated files are current\n');
53
+ }
54
+ else {
55
+ stdout.write('rsc-kit typegen --check: these are committed and no longer what the backend and the routes produce:\n' +
56
+ stale.map((f) => ' ' + f).join('\n') +
57
+ '\nRun rsc-kit typegen and commit the result.\n');
58
+ exit(1);
59
+ }
47
60
  }
48
61
  else {
49
62
  stdout.write(`\n Not an rsc-kit command: ${command}\n${HELP}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsc-kit",
3
- "version": "0.24.0",
3
+ "version": "0.24.2",
4
4
  "type": "module",
5
5
  "description": "The rsc-kit command line: add it to a project, and freeze what can be frozen.",
6
6
  "bin": {
@@ -27,8 +27,8 @@
27
27
  },
28
28
  "homepage": "https://rsc-kit.dev",
29
29
  "dependencies": {
30
- "@rsc-kit/core": "^0.24.0",
31
- "create-rsc-kit": "^0.24.0"
30
+ "@rsc-kit/core": "^0.24.2",
31
+ "create-rsc-kit": "^0.24.2"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^24.0.0",