feat: enable npx support - no bun installation required#6
Conversation
Users can now run `npx pgserve` without installing bun globally. Bun is bundled as an npm dependency and automatically downloaded. Changes: - Add bun as npm dependency (^1.3.4) - Add Node.js wrapper (bin/pgserve-wrapper.cjs) that spawns local bun - Update README: bunx → npx, remove bun requirements - Update CI: add npx integration test - Rename test-bunx.sh → test-npx.sh Performance: ~23ms startup overhead, zero runtime overhead. The wrapper just spawns bun - all Bun.* APIs run natively. BREAKING: None. bunx pgserve still works for bun users.
Summary of ChangesHello @namastex888, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the user experience by enabling Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a great enhancement, enabling npx support by bundling bun as a dependency and adding a Node.js wrapper. This significantly improves the user experience by removing the need for a global bun installation. The implementation of the wrapper script is robust, covering multiple platforms and edge cases for locating the bun binary, and includes proper signal forwarding and error handling. The documentation and test scripts have also been updated accordingly. I've found one critical issue in package.json that needs to be addressed.
| "lint-staged": { | ||
| "src/**/*.js": [ | ||
| "eslint --fix" | ||
| ], | ||
| "bin/**/*.js": [ | ||
| "eslint --fix" | ||
| ] | ||
| }, |
There was a problem hiding this comment.
The package.json file contains a syntax error. The lint-staged configuration block is incorrectly indented, which makes the JSON file invalid and will cause package managers to fail. It should be at the same indentation level as other top-level keys like devDependencies.
| "lint-staged": { | |
| "src/**/*.js": [ | |
| "eslint --fix" | |
| ], | |
| "bin/**/*.js": [ | |
| "eslint --fix" | |
| ] | |
| }, | |
| "lint-staged": { | |
| "src/**/*.js": [ | |
| "eslint --fix" | |
| ], | |
| "bin/**/*.js": [ | |
| "eslint --fix" | |
| ] | |
| }, |
Violation: Manually set version to 1.1.0 in package.json during PR, then manually triggered workflow_dispatch for release. Result: version jumped from 1.0.9 → 1.1.1-rc.1 (skipped 1.1.0-rc.1). Correction: - Never manually bump version in package.json - Never manually trigger workflow_dispatch for releases - Always use PR with `rc` or `stable` label - Version bumping is automated by scripts/release.cjs Evidence: PR #6 npx support feature, release v1.1.1-rc.1 Net growth: +7 lines (surgical addition to Amendment #3)
Summary
Users can now run
npx pgservewithout installing bun globally. Bun is bundled as an npm dependency and automatically downloaded for the user's platform.Before:
After:
Changes
bunas npm dependency (^1.3.4)bin/pgserve-wrapper.cjs) that finds and spawns local bunbunx→npx, remove bun requirementstest-bunx.sh→test-npx.shPerformance
~23ms overhead - negligible for a long-running server. Once running, performance is identical because the wrapper just spawns bun with
stdio: 'inherit'.Test plan
node bin/pgserve-wrapper.cjs --helpworksnode bin/pgserve-wrapper.cjs --no-cluster --port 15433starts server