Repository navigation
fix(cli): theme build reads the Core it builds with for variant declarations, and names the build command alone - #12092
josephfarina wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
…rations, and names the build command alone
There was a problem hiding this comment.
Requesting changes: the fix does what it says, since a CLI copy with no Core beside it now writes the same theme outputs as a copy with Core, but one line breaks the build.
packages/cli/api/theme/build/build.mjs:1838fails TypeScript's strict check (TS18048: 'index' is possibly 'undefined') becauseMap.getcan returnundefined, so the rootpnpm build(atsync:api-types) and the CLI typecheck fail; keep the promise in a local before awaiting it, as the inline suggestion shows.
The preview deployment fails on both commits, which matches this build failure. Everything else checked out: the new test fails on main and passes here, and one theme built through both kinds of copy gives the same five files.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: a CLI installed for the computer now writes the same theme files as one installed beside Core. Verified: a side-by-side build gives five identical files apart from the ignored command line; the new test.
- Claim: the build reads component docs and types from the Core it builds with. Verified:
build.mjs:1849-1891. - Claim: a theme with a custom variant now gets its
.variants.d.tsand the.d.tsreference. Verified: the new test fails onmainat line 94 and passes here. - Claim: before, that CLI wrote no variant declarations, and
doctorandtheme build --checkcalled another copy's build stale. Verified: onmainthe global copy writes four files and a.d.tswithout the reference;doctor's local-build check runs the strict check. - Claim: the module's doc comment names
astryx theme buildwhatever ran the build. Verified:build.mjs:4219; the theme packages' built modules differ only in that line. - Claim: only before a build selects a Core does it fall back to the Core beside the CLI. Verified:
build.mjs:1850-1857. - Claim: the caches of those reads are kept per Core. Verified:
build.mjs:1815,:1912,:1962,:4326. - Claim: the build keeps the facts of the project's installed Core when it has one. Verified:
build.mjs:4747-4752. - Claim: the generated header already names
astryx theme build. Verified:build.mjs:755. - Claim: the theme, doctor and core-facts tests pass. Verified for the subset rerun here: 65 files, 909 passed, 1 skipped.
- Claim: no new public API. Verified: the API report lists no row for any built package, and no command or option changed.
- File
packages/cli/api/theme/build/build.mjs: finding (TS18048 at line 1838). - File
packages/cli/api/theme/build/build.global-copy.test.mjs: clear. - File
.changeset/theme-build-selected-core-facts.md: clear.
d18dd83 to
cba8838
Compare
There was a problem hiding this comment.
Approved pending CI: the required checks have not run on this head yet, because the CI run was refused for capacity ("CI is full"), so re-run its jobs before merging.
The earlier blocker is fixed: getKnownValues now keeps the promise in a local before awaiting it, and the root pnpm build and the CLI's strict typecheck pass. A CLI copy with no Core beside it now writes the same five theme files as a copy with Core, and each copy's theme build --check accepts the other's build; the new test fails on main and passes here.
Claims and files checked
Review mode: full; reason: rebase
- Claim: a CLI installed for the computer now writes the same theme files as one installed beside Core. Verified: one theme built through both gives the same five files byte for byte; the new test.
- Claim: the build reads the component docs and types of the Core it builds with, which is the project's. Verified:
build.mjs:1855-1897. - Claim: a theme with a custom variant now gets its
.variants.d.tsand the.d.tsreference. Verified: the new test fails onmainat line 94 and passes here. - Claim: before, that CLI wrote no variant declarations, and
doctorandtheme build --checkcalled another copy's build stale. Verified: onmainthe global copy writes four files and each copy's--checkrejects the other's build;doctor's local-build check runs the same strict check (api/doctor/theme-checks.mjs:1619-1623). - Claim: the module's doc comment names
astryx theme buildwhatever ran the build, so different package managers and tools write the same module. Verified:build.mjs:4383; the theme packages' built modules differ only in that line. - Claim: only before a build selects a Core does it fall back to the Core beside the CLI. Verified:
build.mjs:1855-1864, and every build path selects a Core before the first read. - Claim: the caches of those reads are kept per Core. Verified:
build.mjs:1818,:1918,:1968,:4490. - Claim: the build keeps the facts of the project's installed Core when it has one. Verified:
build.mjs:4909-4916. - Claim: the generated header already names
astryx theme build. Verified:build.mjs:758. - Claim: the governing records are the global-mode and app-theme specs, and no record changes. Verified: the global-mode spec's same-files and installed-Core requirements and the app-theme spec's doctor check 5 cover every change; no record is edited.
- Claim: the regression test builds a custom Badge variant through a packed global copy with no Core and fails on
main. Verified: it fails onmainat line 94. - Claim: with the fix, both copies write the same five files,
--checkis up to date and the local-build check passes. Verified for the files and--check; the local-build check runs the same comparison. - Claim: the theme, theme-edit, doctor theme-check and core-theme-facts tests pass. Verified: the same suites pass here (449 files, 5,604 passed, 5 skipped).
- Claim: ESLint and Prettier pass on the changed files. Verified: both clean.
- Claim: no new public API. Verified: the API report lists no row for any published package, and no command or option changed.
- File
packages/cli/api/theme/build/build.mjs: clear; the strict-typecheck failure ingetKnownValuesis fixed (build.mjs:1838-1843), and the root build andtsconfig.strict.jsonpass. - File
packages/cli/api/theme/build/build.global-copy.test.mjs: clear. - File
.changeset/theme-build-selected-core-facts.md: clear.
…variant declarations, and names the build command alone
…variant declarations, and names the build command alone
- #12252 docs(cli): agent docs name the prop names that differ from other libraries Author: Joey Farina <[email protected]> - #12154 fix(core): a numeric typography weight builds through an extended base's adaptation rules Author: Joey <[email protected]> - #12092 fix(cli): theme build reads the Core it builds with for variant declarations, and names the build command alone Author: Joey Farina <[email protected]> - #12316 fix(core): a shorthand never follows its own longhand in one style merge Author: josephfarina <[email protected]> - #12357 fix(core): a Table stays the scroll region when a host scrolls every table's parent Author: Joey Farina <[email protected]> - #12349 fix(core): end a mouse drag a sandboxed frame never saw released Author: josephfarina <[email protected]> - #12425 fix(cli): use a stored doc parse only with the zod release that made it Author: Joey <[email protected]> - #12396 fix(AppShell): with the standard width points, a server-rendered shell hides its inline side nav on a phone before its script runs Author: Joey <[email protected]> - #12438 fix(charts): end dots draw whole and a thinned axis keeps its last label Author: Joey Farina <[email protected]> - #12448 fix(cli): upgrade outside a project names the project, not --from Author: Joey Farina <[email protected]> - #12459 fix(templates): the dashboard scorecard fits a phone screen Author: Joey Farina <[email protected]> - #12428 fix(core): Field labels draw in a bolder face than their description Author: Joey Farina <[email protected]> - #12435 fix(theme-matcha): dark menus, popovers and muted fills take the theme's deep gray neutral Author: Joey <[email protected]> - #12432 fix(templates): dashboard chart labels show whole instead of clipped by the chart edge Author: Joey Farina <[email protected]> - #12441 fix(cli): mark icon-set generated calls pure so apps drop unused icons Author: Joey Farina <[email protected]> - #12472 fix(MetadataListItem): a value breaks only a word longer than its line Author: Joey <[email protected]>
|
Landed in #12718. |
User impact
A theme that gives a component a custom variant, such as a Badge
variant: 'gray'that Core does not ship, needs a.variants.d.tsfile so that<Badge variant="gray">type-checks.theme buildwrites it, and references it from the theme's.d.ts.Through a CLI installed for the computer (
npm install -g @astryxdesign/cli),theme buildwrites neither: the theme builds, but the app's TypeScript rejects the custom variant. Because the same theme built by a CLI installed beside Core does get the file, the two copies disagree about the same source. In an app whose theme was built by one, the other reports it stale:and rebuilding with the first drops the type declarations the app relies on.
After this change, both copies write the same files: a CLI installed for the computer reads the component docs and types of the project's Core, which it already builds with, and writes the variant declarations.
The built module's doc comment also names the command that ran the build (
built by \npx @astryxdesign/[email protected] theme build`,pnpm exec astryx, or a tool's own command), so two people building the same theme with different package managers or tools wrote different modules, andtheme build --checkreported the other's build as stale. It now namesastryx theme build`, as the generated header already does.Problem and solution fit
theme buildloads the project's Core to build a theme, but reads the component docs and types that decide which variants need declarations from a Core beside the CLI. A CLI installed for the computer has none beside it, so it finds no component and declares no variant. Separately, the module's doc comment prints the invocation that ran the build.doctorandtheme build --checkfail on a theme that is up to date, depending on which copy built it.The build now reads Core's docs and types from the Core it selected for the build, the same one it loads the theme with; only before a build selects one does it fall back to the Core beside the CLI. The caches of those reads are kept per Core. The doc comment names the canonical command, so the module no longer depends on how the CLI was started.
Expected behavior and authority
spec:AST-081FR3: a run answers as a project with that release of Core installed would.spec:AST-050FR11 check 5: every added local theme is built, and its outputs match its source. A build's outputs follow from its source and the Core it builds with, not from which copy of the same CLI release ran it. No record changes.Smallest restoration
api/theme/build/build.mjs:resolveCoreRoot()returns the package root of the Core the build selected (from its theme entry), else the Core beside the CLI. The known-values index, component declarations, augmentation targets and known components are cached per Core. The build keeps the facts of the project's installed Core when it has one. The module's doc comment namesastryx theme build.Evidence
.variants.d.tsdeclares neutral's custom Badge variant), then checked by the same release installed for the computer. Before:theme build --checkreportedteam-purple.d.tsoutdated, anddoctor'stheme-local-buildsfailed. Rebuilding with the computer's copy wrote no.variants.d.ts.api/theme/build/build.mjsreplaced in both copies: the computer's copy writes the same five files, byte for byte apart from the header's command line;--checkis up to date andtheme-local-buildspasses.build.global-copy.test.mjsplaces the packed CLI as a global install with no Core beside it and builds a theme with a custom Badge variant in an app that installed Core. It expects the.variants.d.tsdeclaration, the.d.tsreference, and the canonical command in the module. It fails on main (no.variants.d.ts).Scope
Components: CLI (
theme buildthrough a CLI installed for the computer)Testing
vitest run --project nodeoverapi/theme(every build test included),api/theme-edit,api/doctor/theme-checksandfoundation/discovery/core-theme-facts: 399 files, 5,344 passed. The newbuild.global-copytest fails on main.