@nuasite/cli 0.51.0 → 0.53.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.
- package/README.md +25 -3
- package/dist/index.js +1290 -473
- package/dist/types/check-code.d.ts +19 -0
- package/dist/types/check-code.d.ts.map +1 -0
- package/dist/types/check.d.ts +11 -0
- package/dist/types/check.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -3
- package/src/check-code.ts +133 -0
- package/src/check.ts +72 -9
- package/src/index.ts +2 -1
package/README.md
CHANGED
|
@@ -63,22 +63,44 @@ config, and run `nua dev`.
|
|
|
63
63
|
Validates the content collections without building the site:
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
|
-
nua check
|
|
67
|
-
nua check --json
|
|
68
|
-
nua check --strict
|
|
66
|
+
nua check # exit 1 on errors
|
|
67
|
+
nua check --json # machine-readable report
|
|
68
|
+
nua check --strict # warnings fail too
|
|
69
|
+
nua check --content-only # skip the source parse
|
|
69
70
|
```
|
|
70
71
|
|
|
72
|
+
Run it anywhere in the project: with no `astro.config.*` in the current directory
|
|
73
|
+
it checks every `packages/*` that has one, so a monorepo root works too — which is
|
|
74
|
+
where `bun run build` typically builds something else entirely.
|
|
75
|
+
|
|
71
76
|
It reads `src/content.config.ts`, walks every collection's entries and reports
|
|
72
77
|
frontmatter that does not parse, values that do not match a declared field type
|
|
73
78
|
(`order: ""` where the schema wants a number), missing required fields, and
|
|
74
79
|
`reference()` values pointing at no entry.
|
|
75
80
|
|
|
81
|
+
It then parses the project's own `.astro`, `.ts` and `.tsx` — each `.astro` through
|
|
82
|
+
`@astrojs/compiler` and then the emitted TypeScript, which is the same two steps a
|
|
83
|
+
build takes before it renders anything. That catches the syntax error that kills a
|
|
84
|
+
build in `Building static entrypoints`, and reports it at its line in the `.astro`
|
|
85
|
+
source rather than in generated code. It is a syntax check, not a type check: a
|
|
86
|
+
wrong prop type still needs `astro check` or a build.
|
|
87
|
+
|
|
76
88
|
Use it instead of a full build when you only need to know whether the content is
|
|
77
89
|
still valid: `astro build` validates the same things but costs the whole render
|
|
78
90
|
and stops at the first bad entry, while this reports every problem in one pass —
|
|
79
91
|
under a second on a 1500-entry site. A dangling reference is a warning, because
|
|
80
92
|
it builds green and then renders nothing.
|
|
81
93
|
|
|
94
|
+
`check` is new in 0.51.0. Most projects do not depend on `@nuasite/cli` directly
|
|
95
|
+
— it arrives through `@nuasite/nua`, which pins it exactly — so a project on an
|
|
96
|
+
older `@nuasite/nua` has an older `nua` and answers `Unknown command: check`
|
|
97
|
+
until it bumps. To run it regardless of what the project pins, and from a plain
|
|
98
|
+
shell where `node_modules/.bin` is not on `PATH`:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
bunx @nuasite/cli@latest check
|
|
102
|
+
```
|
|
103
|
+
|
|
82
104
|
### `nua clean`
|
|
83
105
|
|
|
84
106
|
Ejects your project from the Nua toolchain back to a standard Astro setup:
|