fix: Use pglite so that postgres isn't required when generating types (#2)#23
Open
IbrahimLaeeq wants to merge 1 commit into
Open
fix: Use pglite so that postgres isn't required when generating types (#2)#23IbrahimLaeeq wants to merge 1 commit into
IbrahimLaeeq wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Changes the default db:generate script generated by pgstrap init to use the --pglite flag, allowing fresh projects to generate types without a running Postgres instance.
Changes:
- Update
db:generatescript template insrc/init.tsto include--pglite - Update corresponding test expectation
- Update README to document the new default behavior
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/init.ts | Adds --pglite flag to the generated db:generate script |
| tests/init.test.ts | Updates expected script string to match new default |
| README.md | Documents new default and how to opt out |
| bun.lock | Adds configVersion: 0 field (likely from bun version difference) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Fixes #2.
/claim #2
Init test passes with the updated expectation.
Summary
Root cause:
src/init.tswas writingdb:generate: pgstrap generateinto newly-initializedpackage.jsonfiles. That script path insrc/generate.ts(whenpgliteis falsy) callszg.generateagainst a real Postgres viaDATABASE_URL— so users runningbun run db:generatestraight afterpgstrap initneeded Postgres running. The pglite codepath already existed and was reachable only via the manual--pgliteflag.Fix (smallest correct change):
src/init.ts:19— generateddb:generatescript now usespgstrap generate --pglite, so a fresh project works without any running Postgres.tests/init.test.ts:28— updated expectation to match.README.md:58— refreshed thenpm run db:generatedescription to document the new default behavior and how to opt out (drop--pglite).No changes to dependencies, lockfile, CI, or version. Existing pglite codepath in
generate.tsis unchanged.Verified against the repository's own test suite before submission.