Skip to content

Commit d79c459

Browse files
committed
chore: add npm build testing infrastructure and documentation
- 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
1 parent 4abfc7c commit d79c459

File tree

4 files changed

+182
-296
lines changed

4 files changed

+182
-296
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: test-npm-build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
test-npm-build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Code checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version: 1.24.9
20+
21+
- name: Install GoReleaser
22+
run: go install github.com/goreleaser/goreleaser@latest
23+
24+
- name: Install Windows cross-compilation tools
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y gcc-mingw-w64-x86-64
28+
29+
- name: Set up Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: "20.x"
33+
34+
- name: Run npm build tests
35+
run: |
36+
chmod +x test-scripts/test-npm-build.sh
37+
./test-scripts/test-npm-build.sh

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,46 @@ Then run the locally generated `hookdeck-cli` binary:
10111011
./hookdeck-cli
10121012
```
10131013

1014+
### Testing the npm package build
1015+
1016+
To test the npm package build process locally (including the wrapper script), you can use the automated test script:
1017+
1018+
```sh
1019+
# Run the automated test script (recommended)
1020+
./test-scripts/test-npm-build.sh
1021+
```
1022+
1023+
The test script will:
1024+
- Build all 6 platform binaries using GoReleaser
1025+
- Verify the binaries directory structure
1026+
- Test the wrapper script on your current platform
1027+
- Verify npm pack includes all required files
1028+
1029+
**Manual testing (if you prefer step-by-step):**
1030+
1031+
```sh
1032+
# Install GoReleaser (if not already installed)
1033+
# Option 1: Using Homebrew (recommended on macOS)
1034+
brew install goreleaser
1035+
1036+
# Option 2: Download binary from GitHub releases
1037+
# Visit https://github.com/goreleaser/goreleaser/releases/latest
1038+
1039+
# Build all platform binaries for npm
1040+
goreleaser build -f .goreleaser/npm.yml --snapshot --clean
1041+
1042+
# Verify binaries directory structure
1043+
ls -R binaries/
1044+
1045+
# Test the wrapper script on your platform
1046+
node bin/hookdeck.js --version
1047+
1048+
# Test npm package creation (dry-run)
1049+
npm pack --dry-run
1050+
```
1051+
1052+
This will create the `binaries/` directory with all 6 platform binaries, allowing you to test the wrapper script locally before publishing.
1053+
10141054
## Testing
10151055

10161056
### Running Acceptance Tests
@@ -1045,6 +1085,36 @@ In CI environments, set the `HOOKDECK_CLI_TESTING_API_KEY` environment variable
10451085

10461086
For detailed testing documentation and troubleshooting, see [`test/acceptance/README.md`](test/acceptance/README.md).
10471087

1088+
### Testing npm package and wrapper script
1089+
1090+
The npm package includes a wrapper script (`bin/hookdeck.js`) that detects the platform and executes the correct binary.
1091+
1092+
**Quick test (using automated script):**
1093+
1094+
```sh
1095+
./test-scripts/test-npm-build.sh
1096+
```
1097+
1098+
**Manual testing:**
1099+
1100+
```sh
1101+
# Ensure GoReleaser is installed (see "Testing the npm package build" section above)
1102+
1103+
# Build all platform binaries
1104+
goreleaser build -f .goreleaser/npm.yml --snapshot --clean
1105+
1106+
# Test wrapper script on current platform
1107+
node bin/hookdeck.js version
1108+
1109+
# Verify wrapper script can find binary
1110+
node bin/hookdeck.js --help
1111+
1112+
# Test npm pack includes all files
1113+
npm pack --dry-run | grep -E "(bin/hookdeck.js|binaries/)"
1114+
```
1115+
1116+
**Note:** The wrapper script expects binaries in `binaries/{platform}-{arch}/hookdeck[.exe]`. When building locally, ensure all platforms are built or the wrapper will fail for missing platforms.
1117+
10481118
### Testing against a local API
10491119

10501120
When testing against a non-production Hookdeck API, you can use the

0 commit comments

Comments
 (0)