Skip to content

fix: Use pglite so that postgres isn't required when generating types (#2)#23

Open
IbrahimLaeeq wants to merge 1 commit into
seveibar:mainfrom
IbrahimLaeeq:fix/bounty-issue-2
Open

fix: Use pglite so that postgres isn't required when generating types (#2)#23
IbrahimLaeeq wants to merge 1 commit into
seveibar:mainfrom
IbrahimLaeeq:fix/bounty-issue-2

Conversation

@IbrahimLaeeq
Copy link
Copy Markdown

Fixes #2.

/claim #2

Init test passes with the updated expectation.

Summary

Root cause: src/init.ts was writing db:generate: pgstrap generate into newly-initialized package.json files. That script path in src/generate.ts (when pglite is falsy) calls zg.generate against a real Postgres via DATABASE_URL — so users running bun run db:generate straight after pgstrap init needed Postgres running. The pglite codepath already existed and was reachable only via the manual --pglite flag.

Fix (smallest correct change):

  • src/init.ts:19 — generated db:generate script now uses pgstrap generate --pglite, so a fresh project works without any running Postgres.
  • tests/init.test.ts:28 — updated expectation to match.
  • README.md:58 — refreshed the npm run db:generate description 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.ts is unchanged.


Verified against the repository's own test suite before submission.

Copilot AI review requested due to automatic review settings May 15, 2026 16:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:generate script template in src/init.ts to 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use pglite so that postgres isn't required when generating types

2 participants