chore(petstore-hono): regenerate client/server/hooks on demand instead of committing them#306
Merged
Conversation
…d of committing them Move user-owned src/schemas.ts out of generated/ into src/ so the entire generated/ directory can be gitignored. Update both generator configs (input_schema: "src/schemas.ts"). Wire pnpm generate into build, dev, and test:e2e scripts so generated output is always fresh. Add packages/petstore-hono/.gitignore covering generated/, test-results/, and playwright-report/. Add CI comment noting generated code is produced fresh from spec/api.json by the workspace generators.
Contributor
Fallow audit reportFound 2 findings. Details
Generated by fallow. |
Contributor
Fallow audit report0 inline findings selected for GitHub review. |
…in shims pnpm drops bin shims at install time if the target dist file does not yet exist (ENOENT warning). In CI, generator packages have no dist/ after a fresh pnpm install --frozen-lockfile, so the openapi-zod-ts, openapi-server, and openapi-react-query shims are never created. The recursive build then fails with "openapi-zod-ts: not found" even though pnpm builds the generators before petstore-hono (topological order). Replace bare CLI names in the generate script with explicit node invocations via the workspace-symlinked dist paths. No bin shims needed; the dist files are present by the time petstore-hono runs because pnpm respects the workspace dependency order. Verified from a clean state: removed generator dists, ran pnpm install --frozen-lockfile then pnpm -r run build. All three generators ran successfully and vite build produced a 289 kB bundle.
…chema path Both packages shared petstore-hono's schema via input_schema: "../petstore-hono/generated/schemas.ts". Moving hono's schema to src/ broke the import in their committed generated/router.ts. Apply the same regenerate-on-demand pattern as petstore-hono: - Fix input_schema in openapi-server.config.json to point at ../petstore-hono/src/schemas.ts (always committed, no build dep). - Replace bare CLI names in generate scripts with explicit node invocations to bypass the pnpm bin-shim ENOENT failure on CI. - Wire pnpm generate into test and start so generated/ is always fresh before the code runs. - Add .gitignore covering generated/ and test-results/. - git rm --cached the 12 committed generated files. Verified clean-room: removed generator dists, ran pnpm install --frozen-lockfile then pnpm -r run build then pnpm -r run test. All 2,458 tests passed across all packages including petstore-express (5 tests) and petstore-fastify (5 tests). Regenerated routers now import from ../../petstore-hono/src/schemas.js. Zero remaining references to petstore-hono/generated in the repo.
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
The petstore-hono e2e example no longer commits generated code (client, server router/service, react-query hooks, models, zod schemas). The
generated/directory is gitignored and regenerated fresh viapnpm generate, wired intobuild,dev, andtest:e2e. This ensures CI always exercises current generator output rather than a stale committed snapshot.Changes
generated/directory is now gitignored; code regenerates on demandpnpm generatecommand regenerates all client, server, and react-query codegenerated/schemas.tsto trackedsrc/schemas.tsTesting
The E2E job in CI will run
pnpm buildthentest:e2e, which now:../src/schemas.js