-
Notifications
You must be signed in to change notification settings - Fork 15
fix: pnpm v10+ compatibility: Single-package binary distribution with GoReleaser #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+693
−366
Conversation
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
- Add test-npm-build.sh script to automate multi-platform build testing - Add test-npm-build.yml CI workflow for automated npm build verification - Update README with npm package build testing instructions - Update package-lock.json to reflect go-npm-next removal
- Replace manual GoReleaser installation with GitHub Action for improved reliability - Specify version v2.10.2 for consistent builds
- Add --skip validate flag to GoReleaser build in release workflow This fixes tag validation errors when package.json is updated after tag creation - Remove outdated next branch references from README - Update beta release instructions to reflect single-branch workflow - Add beta installation instructions to feature branch pre-release section
…okdeck-cli into feat/install-process
- Create reusable composite action for npm install testing - Add workflow to test npm package installation on macOS, Linux, and Windows - Automatically triggers after release workflow completes - Handles npm registry propagation delays with polling - Extracts version from release tags for accurate testing - Supports manual testing via workflow_dispatch - Uses matrix strategy to reduce duplication and improve maintainability
…okdeck-cli into feat/install-process
Collaborator
Author
|
@copilot review |
Contributor
|
@leggetter I've opened a new pull request, #201, to work on those changes. Once the pull request is ready, I'll request review from you. |
- Set CGO_ENABLED=0 for all platform builds (Darwin, Linux, Windows) since the codebase is pure Go with no C dependencies - Remove unnecessary mingw cross-compiler dependencies from CI - Fix wrapper script error handling: use ?? instead of || for proper null status handling - Enhance test-npm-build.sh with: - Verification of all 6 platform binaries (was only checking 2) - Binary architecture validation using 'file' command - Exit code propagation test for wrapper script The codebase has no CGO imports, so CGO_ENABLED=0 is the accurate setting for cross-compilation. This simplifies the build process and removes the need for platform-specific cross-compilers. See #202 for discussion on Windows 32-bit support. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Fix pnpm v10+ compatibility: Single-package binary distribution with GoReleaser
Problem
The current npm distribution approach relies on
go-npm-nextwith postinstall scripts to download platform-specific binaries. This creates a poor developer experience with modern package managers, particularly pnpm v10+, which blocks lifecycle scripts by default for security reasons.Impact:
onlyBuiltDependencies,pnpm approve-builds)--ignore-scriptsis usedRelated Issue: #166
Solution
Switched to a single-package approach that includes all platform binaries directly in the npm package, using GoReleaser's native post hooks to organize binaries during the build process.
Key Changes
JavaScript Wrapper Script (
bin/hookdeck.js)binaries/directoryUnified GoReleaser Config (
.goreleaser/npm.yml)binaries/{platform}-{arch}/structureRelease Workflow Updates (
.github/workflows/release.yml)Package Configuration (
package.json)go-npm-nextdependencybinto point to wrapper scriptbinaries/tofilesarrayTesting Infrastructure
test-scripts/test-npm-build.shfor automated testingtest-npm-build.ymlCI workflowSupported Platforms
Benefits
✅ Works with pnpm v10+ - No postinstall scripts required
✅ Works with
--ignore-scripts- All binaries included in package✅ Better CI/CD compatibility - No script execution needed
✅ Offline support - Binaries included, no network requests
✅ Uses GoReleaser natively - Leverages existing tooling
✅ Simpler workflow - Single package, single build process
✅ Better developer experience - "Just works" with any package manager
Trade-offs
Testing
Local Testing
CI Testing
test-npm-build.ymlworkflow runs on every PRMigration Notes
Files Changed
Core Implementation
.goreleaser/npm.yml- New unified GoReleaser config.github/workflows/release.yml- Added GoReleaser build steppackage.json- Removed go-npm-next, updated bin path.gitignore- Added binaries/, exception for hookdeck.jsbin/hookdeck.js- New wrapper scriptTesting & Documentation
test-scripts/test-npm-build.sh- Automated test script.github/workflows/test-npm-build.yml- CI workflowREADME.md- Updated with testing instructionsVerification Checklist
--ignore-scriptsflagBranch Classification
This PR is a feature/fix branch that will be merged to a feature branch (or
nextbranch) for beta testing before promoting tomain.Next Steps: Beta Release Process
After this PR is merged, we'll create a beta release to test the new npm distribution approach:
1. Merge PR to Feature Branch
feat/install-processornext)2. Create Beta Tag
From the merged branch, create and push a beta tag:
Tag naming convention:
v<major>.<minor>.<patch>-beta.<number>v1.6.1-beta.0,v1.6.1-beta.1,v2.0.0-beta.03. Automated Release Process
The GitHub Actions
release.ymlworkflow will automatically:.goreleaser/npm.ymlconfigbetatag:1.6.1-beta.0beta(extracted from pre-release identifier)npm install hookdeck-cli@beta -ghookdeck-betaformulahookdeck-betapackagelatest)4. Verify Beta Release
Test npm installation:
Verify package contents:
Test on different platforms:
5. After Beta Testing
Once beta testing is complete and verified:
mainwhen ready for production releasemain:latesttaglatestImportant Notes
-beta,-rc, etc. and marks them as pre-releasesbetafrom1.6.1-beta.0) and uses it as the npm distribution tag