chore: format generated type files in their generators#324
Open
MarioCadenas wants to merge 2 commits intomainfrom
Open
chore: format generated type files in their generators#324MarioCadenas wants to merge 2 commits intomainfrom
MarioCadenas wants to merge 2 commits intomainfrom
Conversation
The per-package `build:package` scripts run the schema/registry type generators before `tsdown`, but only the root `generate:types` script piped the output through Biome. Since `pnpm build` and `pnpm dev` skip that root script, every build left `plugin-manifest.generated.ts` and `types.generated.ts` dirty until `pnpm format` was run. Have each generator invoke `biome check --write` on its own output so the file lands formatted regardless of how it was produced. The trailing biome step in the root `generate:types` script is now redundant and removed.
Both generate-schema-types.ts and generate-registry-types.ts had the same helper for spawning `biome check --write`. Move it into a single tools/format-with-biome.ts module so both generators share one copy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every
pnpm buildandpnpm devwas leavingpackages/shared/src/schemas/plugin-manifest.generated.tsandpackages/appkit/src/registry/types.generated.tsdirty untilpnpm formatwas run.The per-package
build:packagescripts run the schema/registry generators beforetsdown:packages/shared:tsx ../../tools/generate-schema-types.ts && tsdown ...packages/appkit:tsx ../../tools/generate-registry-types.ts && tsdown ...Only the root-level
pnpm generate:typesscript piped their output through Biome — butpnpm build/pnpm devdon't invoke it, so the files always landed in their unformatted state.Changes
tools/generate-schema-types.tsandtools/generate-registry-types.tsnow runpnpm exec biome check --writeon their output file immediately after writing it, viachild_process.spawnSync.biome check --write …from the rootgenerate:typesscript inpackage.jsonsince it's now redundant.Test plan
git diffwas empty afterwards.pnpm build—git statusno longer reports the.generated.tsfiles as modified.