@object-ui/cli 17.5.0 → 17.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,274 @@
1
1
  # @object-ui/cli
2
2
 
3
+ ## 17.6.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 195b9e4: The routed temp app's generated manifest now asks for the same `lucide-react` range this repo installs.
8
+
9
+ `utils/app-generator.ts` writes the routed variant's `dependencies` with two
10
+ quoted third-party ranges, and `lucide-react` had fossilised a minor behind the
11
+ 22 sibling manifests that declare it: the generated manifest said `^1.29.0`
12
+ while the repo had moved to `^1.31.0`. A generated app therefore asked npm for
13
+ an icon library older than the one every `@object-ui/*` package it installs
14
+ alongside was built against.
15
+
16
+ The drift was not silent — `app-generator.test.ts` derives its expectation from
17
+ the in-repo range precisely so a bump on one side and not the other fails a
18
+ test, and both of its pins were red. What went wrong is that they went red too
19
+ late to stop anything: the dependency PR that moved the repo range merged while
20
+ those shards were still running, so the failure surfaced on `main` and then on
21
+ the merge ref of every unrelated open PR. The range is now caught up; the
22
+ reporting hole and the merge-ordering hole are filed separately (objectui#4968).
23
+
24
+ The remaining eleven anchored ranges were swept against the same dependabot
25
+ batch and are all in sync, so this is the batch's only consumer-side follow-up.
26
+ Deriving the value from the workspace instead of quoting it was considered and
27
+ rejected: nine of the thirteen anchored ranges quote the repo root manifest,
28
+ which is not published with this CLI, so no single derivation can serve the
29
+ table and a bespoke one for this one name would leave the class untouched.
30
+ - 68d9e28: `objectui check`: the known-type list is now derived from the component registry instead of being a hand-written copy, which had drifted in both directions at once.
31
+
32
+ The command judged a schema's `type` against a seventeen-entry array typed by
33
+ hand into `packages/cli/src/commands/check.ts`. Nothing held that array against
34
+ the registry, and measured on `origin/main` @ `8378e9954` it was wrong in both
35
+ directions simultaneously:
36
+
37
+ - **Two phantoms.** `crud` and `gallery` were on the list and are registered by
38
+ nothing. `objectui check` passed `{ "type": "crud" }` in silence while
39
+ `SchemaRenderer` painted the OBJUI-001 "Unknown component type" panel for the
40
+ very same file — measured, both halves. `CRUDSchema` still has its interface,
41
+ zod mirror, validator branch and builder; what it has never had is a
42
+ registration. For `gallery`, the registered spelling is `object-gallery`.
43
+ - **221 bare keys missing, plus every namespaced spelling.** `object-grid`,
44
+ `object-form`, `card`, `div` and `view:grid` were all reported as
45
+ `⚠️ Unknown schema type`. False warnings at that volume are not a cosmetic
46
+ problem: they train authors to skip the output, which costs the phantom
47
+ direction its only reader.
48
+
49
+ The list now lives in `packages/cli/src/utils/known-schema-types.ts`, generated
50
+ by `node scripts/regenerate-known-schema-types.mjs` from the same
51
+ `deriveRegistryKeys` derivation that judges documentation snippets, and held to
52
+ it by a bidirectional pin in
53
+ `scripts/__tests__/known-schema-types-derivation-5115.test.ts` — a key the
54
+ registry has and the list lacks fails, and so does a key the list has and the
55
+ registry lacks. Bare and namespaced spellings are both carried, because
56
+ `register('grid', C, { namespace: 'view' })` really does store both.
57
+
58
+ A runtime lookup through `ComponentRegistry` was measured and rejected: eleven
59
+ of the fifteen genuinely-registered entries come from plugin packages the CLI
60
+ does not depend on, and a published CLI runs against a user project whose plugin
61
+ set this repository cannot know either way.
62
+
63
+ **Behaviour change, in both directions.** `{ "type": "crud" }` and
64
+ `{ "type": "gallery" }` now produce the `Unknown schema type` warning they
65
+ always should have, and a large number of real component types stop producing
66
+ one. The warning remains advisory — it never changes the command's exit code,
67
+ which is still driven only by files that fail to parse — so no run that passed
68
+ before fails now.
69
+
70
+ `check()` additionally takes the directory to scan as an optional argument
71
+ (defaulting, as before, to `process.cwd()`), so the behaviour can be tested
72
+ against a fixture tree.
73
+ - e6a8960: `objectui check` reads `.json` as JSONC, so a `tsconfig.json` no longer fails the run.
74
+
75
+ `check` globbed every `**/*.{json,yaml,yml}` and handed each `.json` straight to
76
+ `JSON.parse`. A throw there is the only thing that increments the error count, and
77
+ a non-zero error count is the only thing that calls `process.exit(1)` — so a `//`
78
+ comment or a trailing comma, which is how TypeScript documents `tsconfig.json`,
79
+ was reported as a malformed file and **failed the command**. Every TypeScript
80
+ project hit this: `objectui check` exited 1 for anyone who ran it, and at this
81
+ repository's own root it reported 64 errors, all of them `tsconfig*.json`
82
+ (objectui#5237).
83
+
84
+ `.json` on disk means JSONC in practice — `tsconfig.json`, `.eslintrc.json`,
85
+ `devcontainer.json` and VS Code's own settings are all written that way — so the
86
+ file is now read with `jsonc-parser`, which permits comments and trailing commas.
87
+ No new package enters what users install: `jsonc-parser` is already a runtime
88
+ dependency of `@object-ui/app-shell`, it is already at the version the lockfile
89
+ resolves, and it declares no dependencies of its own.
90
+
91
+ The reader is a real JSONC parser and **not** a comment-stripping regex, because
92
+ a `//` inside a string value — a URL, say — is not a comment, and a stripper that
93
+ cannot tell the difference corrupts valid files instead of reading them.
94
+
95
+ Genuinely malformed JSON still errors and still exits 1. That needed saying in
96
+ code as well as in tests: `jsonc-parser`'s reader is error-tolerant and returns a
97
+ best-effort value rather than throwing, so the command consults its reported-error
98
+ array instead of inferring success from the absence of a throw. Error output now
99
+ names the reason and the line and column.
100
+
101
+ The unknown-schema-type warning arm is deliberately untouched: it still warns, and
102
+ it still does not affect the exit code. Files that previously died at the parse
103
+ step now reach it, so a JSONC file carrying an unrecognised root `type` warns
104
+ where it used to error — the verdict and the exit-code neutrality are unchanged.
105
+ - 51e65d4: `dev`, `serve` and `build` accept the documented directory argument from anywhere, and refuse a non-project directory in plain language.
106
+
107
+ `content/docs/utilities/cli.mdx` has recorded the positional argument as "Path
108
+ to JSON/YAML schema file or `pages/` directory" and printed `objectui dev
109
+ pages/` as the file-system-routing example. That promise had never actually been
110
+ parsed. Detection's first step required `statSync(...).isFile()`, so a directory
111
+ argument fell straight through it; the one spelling that worked — `objectui dev
112
+ pages/` from inside the project — worked by coincidence of position, caught by
113
+ the working-directory fallback rather than read as an argument. Every pathful
114
+ spelling reached single-schema mode and handed a directory to `readFileSync`:
115
+
116
+ ```
117
+ $ objectui dev my-app/pages
118
+ Error: Invalid schema file: EISDIR: illegal operation on a directory, read
119
+ ```
120
+
121
+ A directory argument now resolves through file-system routing in the shared
122
+ resolution step the three commands were centralized on (objectui#4923), in
123
+ either of the two shapes a user can mean: the directory **is** a `pages`
124
+ directory, or it **contains** one. Both produce the same routed answer as naming
125
+ the app config beside them — same project root, same routes, same app config —
126
+ so `objectui dev my-app/pages`, `objectui dev my-app` and `objectui dev
127
+ my-app/app.json` agree, from any working directory, across all three commands.
128
+ The limb lives in the shared resolver, not in three command branches.
129
+
130
+ The remaining directory-shaped miss is now diagnosed instead of leaking a
131
+ `readFileSync` errno: a directory that is neither shape is refused by name,
132
+ saying what would have been accepted. The refusal sits **after** the
133
+ working-directory fallback, so nothing that resolves today stops resolving: this
134
+ change accepts strictly more than before and rejects nothing that worked.
135
+ - bbfbc54: `objectui serve` and `objectui build` now locate the project the way `dev` does, instead of looking only in the current directory.
136
+
137
+ For a project with an app config and a `pages/` directory beside it, the three
138
+ commands answered one invocation two different ways. `dev` anchored on the
139
+ schema argument — `dirname(<schema>)` is the project root, `pages/` beside it
140
+ means file-system routing, the named file is the app config. `serve` and `build`
141
+ looked for a `pages/` directory in the current working directory and nowhere
142
+ else, so from any directory above the project they fell through to single-schema
143
+ mode and handed the app config to the renderer as if it were a page.
144
+
145
+ Measured on the reported fixture (`<root>/app.json` + `<root>/pages/index.json`,
146
+ invoked from the directory above): `dev` reported the project and one route,
147
+ `serve` reported `Loading schema: <root>/app.json`, and `build` did the same and
148
+ **exited 0** — the emitted bundle embedded the app config as the page schema and
149
+ contained no page from `pages/` at all. A wrong artifact, produced silently.
150
+
151
+ The detection now lives in one helper the three commands share
152
+ (`utils/project-source.ts`), resolving in a fixed order: a `pages/` directory
153
+ beside the schema argument, else one under the current directory, else
154
+ single-schema mode. `serve` and `build` also pass the resolved app config to the
155
+ routed app generator, which they never did, so a routed project keeps its layout
156
+ under all three commands.
157
+
158
+ A lone schema file with no `pages/` beside it is unchanged — that is the
159
+ fallback, and it is still a supported way to run.
160
+ - 82fbc09: `objectui serve` gains `--no-open`, matching the flag `objectui dev` already ships, and no
161
+ longer prints a bare `Error: spawn xdg-open ENOENT` stack after its success banner in a
162
+ headless environment.
163
+
164
+ **`--no-open`.** `serve` hardcoded Vite's `open: true` and its only options were
165
+ `--port`/`--host` — `dev` already had `--no-open` (`options.open !== false`), so the same
166
+ invocation behaved inconsistently across the two commands. `serve` now threads the same
167
+ flag the same way; the default is unchanged — with the flag omitted, `serve` still opens a
168
+ browser exactly as it always has (objectui#4924).
169
+
170
+ **The headless spawn failure.** Vite's own browser-open step already catches a failed
171
+ `open(url)`, but reports it via `logger.error(err.stack || err.message)` with no
172
+ `{ timestamp: true }`, so the default logger prints the bare Node `ChildProcess` stack with
173
+ no `[vite]` prefix and no context — and because that promise chain is fire-and-forget from
174
+ `server.listen()`, it lands *after* the "✓ Server started successfully!" banner, reading
175
+ like a crash even though the server is fine. There's nothing in `serve.ts` to try/catch —
176
+ the error never leaves Vite. `serve` now supplies a `customLogger` that wraps Vite's default
177
+ logger and replaces exactly that message with a short, contextual line naming the missing
178
+ opener binary (`(could not open the browser automatically — 'xdg-open' is not available in
179
+ this environment; open the URL above manually)`); every other log call — including
180
+ unrelated errors — passes through unchanged.
181
+
182
+ Sibling card objectui#4923 (project-root detection on the same command) is intentionally
183
+ untouched here; it is a separate defect with a separate PR.
184
+ - 4102bfc: Inside a pnpm workspace, `objectui dev` / `serve` / `build` now resolve every platform package
185
+ from workspace source (objectui#3890).
186
+
187
+ The temp app these commands generate installs nothing inside a workspace — it resolves by
188
+ hoisting, and the repo root declares no `@object-ui/*` — so a Vite alias table is the only thing
189
+ that resolves a platform package there. That table was a hand-kept list of eleven names in
190
+ `dev`, which is not a list of what the app imports but of what it imports *transitively*:
191
+ measured on the reported commit, the generated entry closes over 21 packages, ten were unlisted,
192
+ and every module whose transform hit one of them answered 500 with a blank page behind it. Vite's
193
+ dependency scan named only four of the ten, because a scan stops at the first layer it cannot
194
+ resolve.
195
+
196
+ The table is now derived from `pnpm-workspace.yaml` — every scoped workspace package that exposes
197
+ a source barrel, targeting its `src` directory — and a test reconciles it against the manifest so
198
+ it cannot drift again. `serve` and `build` had no workspace branch at all (no aliases, and an
199
+ unconditional `npm install` against a manifest that is empty here); all three commands now share
200
+ one helper. The `lucide-react` entry moved from a resolved entry file to the package root, so
201
+ subpath imports of it stop being rewritten into a path that cannot exist.
202
+
203
+ Measured with the reported repro, from the repo root: 8 of the first 400 modules a browser walk
204
+ reaches answered 500 before, 0 of 2498 after, and the page renders its schema instead of nothing.
205
+ - Updated dependencies [88085e3]
206
+ - Updated dependencies [516663d]
207
+ - Updated dependencies [460c4d0]
208
+ - Updated dependencies [0ae27f7]
209
+ - Updated dependencies [78c0f9a]
210
+ - Updated dependencies [bbe8b86]
211
+ - Updated dependencies [279fb13]
212
+ - Updated dependencies [2e82ab2]
213
+ - Updated dependencies [40d3a33]
214
+ - Updated dependencies [8b9dc62]
215
+ - Updated dependencies [1184192]
216
+ - Updated dependencies [a2a9747]
217
+ - Updated dependencies [a1609a6]
218
+ - Updated dependencies [53f23bc]
219
+ - Updated dependencies [c4533dc]
220
+ - Updated dependencies [be60815]
221
+ - Updated dependencies [37f6844]
222
+ - Updated dependencies [93de4f6]
223
+ - Updated dependencies [2b50261]
224
+ - Updated dependencies [384f30d]
225
+ - Updated dependencies [ac600e5]
226
+ - Updated dependencies [97fba31]
227
+ - Updated dependencies [232f61a]
228
+ - Updated dependencies [d374caf]
229
+ - Updated dependencies [5673576]
230
+ - Updated dependencies [911ceaa]
231
+ - Updated dependencies [98eab36]
232
+ - Updated dependencies [af5e292]
233
+ - Updated dependencies [3fbbea1]
234
+ - Updated dependencies [7f96b10]
235
+ - Updated dependencies [167ec42]
236
+ - Updated dependencies [616a2a5]
237
+ - Updated dependencies [0046d8f]
238
+ - Updated dependencies [f1d4748]
239
+ - Updated dependencies [578e025]
240
+ - Updated dependencies [598c89a]
241
+ - Updated dependencies [4a0bd17]
242
+ - Updated dependencies [b8b9af4]
243
+ - Updated dependencies [8c0d52e]
244
+ - Updated dependencies [aff10e2]
245
+ - Updated dependencies [70a774b]
246
+ - Updated dependencies [7458a41]
247
+ - Updated dependencies [d971e51]
248
+ - Updated dependencies [97abb24]
249
+ - Updated dependencies [deb157a]
250
+ - Updated dependencies [d2ce342]
251
+ - Updated dependencies [9695da7]
252
+ - Updated dependencies [75444e3]
253
+ - Updated dependencies [58b8346]
254
+ - Updated dependencies [2d0bd16]
255
+ - Updated dependencies [dad51e5]
256
+ - Updated dependencies [1c9c342]
257
+ - Updated dependencies [787c738]
258
+ - Updated dependencies [8396656]
259
+ - Updated dependencies [dbbd38a]
260
+ - Updated dependencies [93fe362]
261
+ - Updated dependencies [dfc6975]
262
+ - Updated dependencies [3cf4de0]
263
+ - Updated dependencies [c9dc811]
264
+ - Updated dependencies [144ef9b]
265
+ - Updated dependencies [138ab04]
266
+ - Updated dependencies [a0b9e91]
267
+ - Updated dependencies [99bd015]
268
+ - @object-ui/types@17.6.0
269
+ - @object-ui/react@17.6.0
270
+ - @object-ui/components@17.6.0
271
+
3
272
  ## 17.5.0
4
273
 
5
274
  ### Patch Changes
package/README.md CHANGED
@@ -49,6 +49,12 @@ objectui dev --no-open
49
49
  - `-h, --host <host>` — default `localhost`
50
50
  - `--no-open` — do not open browser
51
51
 
52
+ `dev`, `serve` and `build` locate the project the same way: a `pages/` directory
53
+ beside the schema argument means file-system routing (with that file as the app
54
+ config), otherwise a `pages/` directory in the current directory, otherwise the
55
+ named file is rendered on its own. So `objectui build my-app/app.json` from above
56
+ `my-app/` builds the same routes `objectui dev my-app/app.json` serves.
57
+
52
58
  ### `objectui build [schema]`
53
59
 
54
60
  Build the application for production.