hookdeck-cli 1.5.0 → 1.6.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +179 -52
- package/bin/hookdeck.js +37 -0
- package/binaries/darwin-amd64/hookdeck +0 -0
- package/binaries/darwin-arm64/hookdeck +0 -0
- package/{bin → binaries/linux-amd64}/hookdeck +0 -0
- package/binaries/linux-arm64/hookdeck +0 -0
- package/binaries/win32-386/hookdeck.exe +0 -0
- package/binaries/win32-amd64/hookdeck.exe +0 -0
- package/package.json +8 -15
package/README.md
CHANGED
|
@@ -1011,6 +1011,46 @@ Then run the locally generated `hookdeck-cli` binary:
|
|
|
1011
1011
|
./hookdeck-cli
|
|
1012
1012
|
```
|
|
1013
1013
|
|
|
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
|
+
|
|
1014
1054
|
## Testing
|
|
1015
1055
|
|
|
1016
1056
|
### Running Acceptance Tests
|
|
@@ -1045,6 +1085,36 @@ In CI environments, set the `HOOKDECK_CLI_TESTING_API_KEY` environment variable
|
|
|
1045
1085
|
|
|
1046
1086
|
For detailed testing documentation and troubleshooting, see [`test/acceptance/README.md`](test/acceptance/README.md).
|
|
1047
1087
|
|
|
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
|
+
|
|
1048
1118
|
### Testing against a local API
|
|
1049
1119
|
|
|
1050
1120
|
When testing against a non-production Hookdeck API, you can use the
|
|
@@ -1067,40 +1137,59 @@ docker run --rm -it \
|
|
|
1067
1137
|
|
|
1068
1138
|
## Releasing
|
|
1069
1139
|
|
|
1070
|
-
This section describes the
|
|
1140
|
+
This section describes the release process for the Hookdeck CLI.
|
|
1141
|
+
|
|
1142
|
+
## Release Process
|
|
1143
|
+
|
|
1144
|
+
The release workflow supports tagging from **ANY branch** - it automatically detects which branch contains the tag. This means you can create beta releases directly from feature branches for testing before merging to `main`.
|
|
1071
1145
|
|
|
1072
|
-
###
|
|
1146
|
+
### Stable Release (Preferred Method: GitHub UI)
|
|
1073
1147
|
|
|
1074
|
-
|
|
1148
|
+
1. Ensure all tests pass on `main`
|
|
1149
|
+
2. Go to the [GitHub Releases page](https://github.com/hookdeck/hookdeck-cli/releases)
|
|
1150
|
+
3. Click "Draft a new release"
|
|
1151
|
+
4. Create a new tag with a stable version (e.g., `v1.3.0`)
|
|
1152
|
+
5. Target the `main` branch
|
|
1153
|
+
6. Generate release notes or write them manually
|
|
1154
|
+
7. Publish the release
|
|
1155
|
+
|
|
1156
|
+
The GitHub Actions workflow will automatically:
|
|
1157
|
+
- Build binaries for all platforms
|
|
1158
|
+
- Create a stable GitHub release
|
|
1159
|
+
- Publish to NPM with the `latest` tag
|
|
1160
|
+
- Update package managers:
|
|
1161
|
+
- Homebrew: `hookdeck` formula
|
|
1162
|
+
- Scoop: `hookdeck` package
|
|
1163
|
+
- Docker: Updates both the version tag and `latest`
|
|
1075
1164
|
|
|
1076
|
-
|
|
1077
|
-
|
|
1165
|
+
**Alternative (Command Line):**
|
|
1166
|
+
```bash
|
|
1167
|
+
git checkout main
|
|
1168
|
+
git tag v1.3.0
|
|
1169
|
+
git push origin v1.3.0
|
|
1170
|
+
# Then create release notes on GitHub Releases page
|
|
1171
|
+
```
|
|
1078
1172
|
|
|
1079
|
-
### Beta
|
|
1173
|
+
### Pre-release from Main (General Beta Testing)
|
|
1080
1174
|
|
|
1081
|
-
|
|
1175
|
+
For general beta testing of features that have been merged to `main`:
|
|
1082
1176
|
|
|
1083
|
-
**
|
|
1177
|
+
**Preferred Method: GitHub UI**
|
|
1178
|
+
1. Ensure `main` branch is in the desired state
|
|
1179
|
+
2. Go to the [GitHub Releases page](https://github.com/hookdeck/hookdeck-cli/releases)
|
|
1180
|
+
3. Click "Draft a new release"
|
|
1181
|
+
4. Create a new tag with pre-release version (e.g., `v1.3.0-beta.1`)
|
|
1182
|
+
5. Target the `main` branch
|
|
1183
|
+
6. Check "Set as a pre-release"
|
|
1184
|
+
7. Publish the release
|
|
1185
|
+
8. GitHub Actions will build and publish with npm tag `beta`
|
|
1084
1186
|
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
3. Create and push a beta tag with a pre-release identifier:
|
|
1092
|
-
```sh
|
|
1093
|
-
git tag v1.2.3-beta.0
|
|
1094
|
-
git push origin v1.2.3-beta.0
|
|
1095
|
-
```
|
|
1096
|
-
4. The GitHub Actions workflow will automatically:
|
|
1097
|
-
- Build binaries for all platforms (macOS, Linux, Windows)
|
|
1098
|
-
- Create a GitHub pre-release (marked as "Pre-release")
|
|
1099
|
-
- Publish to NPM with the `beta` tag
|
|
1100
|
-
- Create beta packages:
|
|
1101
|
-
- Homebrew: `hookdeck-beta` formula
|
|
1102
|
-
- Scoop: `hookdeck-beta` package
|
|
1103
|
-
- Docker: Tagged with the version (e.g., `v1.2.3-beta.0`), but not `latest`
|
|
1187
|
+
**Alternative (Command Line):**
|
|
1188
|
+
```bash
|
|
1189
|
+
git checkout main
|
|
1190
|
+
git tag v1.3.0-beta.1
|
|
1191
|
+
git push origin v1.3.0-beta.1
|
|
1192
|
+
```
|
|
1104
1193
|
|
|
1105
1194
|
**Installing beta releases:**
|
|
1106
1195
|
|
|
@@ -1118,39 +1207,77 @@ brew install hookdeck/hookdeck/hookdeck-beta
|
|
|
1118
1207
|
scoop install hookdeck-beta
|
|
1119
1208
|
|
|
1120
1209
|
# Docker
|
|
1121
|
-
docker run hookdeck/hookdeck-cli:v1.
|
|
1210
|
+
docker run hookdeck/hookdeck-cli:v1.3.0-beta.1 version
|
|
1122
1211
|
```
|
|
1123
1212
|
|
|
1124
|
-
###
|
|
1213
|
+
### Pre-release from Feature Branch (Feature-Specific Testing)
|
|
1125
1214
|
|
|
1126
|
-
|
|
1215
|
+
For testing a specific feature in isolation before merging to main:
|
|
1127
1216
|
|
|
1128
|
-
**
|
|
1129
|
-
|
|
1130
|
-
1. Merge the `next` branch into `main`:
|
|
1131
|
-
```sh
|
|
1132
|
-
git checkout main
|
|
1133
|
-
git pull origin main
|
|
1134
|
-
git merge next
|
|
1135
|
-
git push origin main
|
|
1136
|
-
```
|
|
1217
|
+
**Preferred Method: GitHub UI**
|
|
1218
|
+
1. Ensure your feature branch is pushed to origin
|
|
1137
1219
|
2. Go to the [GitHub Releases page](https://github.com/hookdeck/hookdeck-cli/releases)
|
|
1138
1220
|
3. Click "Draft a new release"
|
|
1139
|
-
4. Create a new tag with
|
|
1140
|
-
5. Target
|
|
1141
|
-
6.
|
|
1142
|
-
7.
|
|
1221
|
+
4. Create a new tag with pre-release version (e.g., `v1.3.0-beta.1`)
|
|
1222
|
+
5. Target your feature branch (e.g., `feat/my-feature`)
|
|
1223
|
+
6. Check "Set as a pre-release"
|
|
1224
|
+
7. Add notes about what's being tested
|
|
1225
|
+
8. Publish the release
|
|
1226
|
+
9. GitHub Actions will automatically detect the branch and build from it
|
|
1227
|
+
|
|
1228
|
+
**Alternative (Command Line):**
|
|
1229
|
+
```bash
|
|
1230
|
+
git checkout feat/my-feature
|
|
1231
|
+
git tag v1.3.0-beta.1
|
|
1232
|
+
git push origin v1.3.0-beta.1
|
|
1233
|
+
# Then create release notes on GitHub Releases page
|
|
1234
|
+
```
|
|
1143
1235
|
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1236
|
+
**Installing beta releases:**
|
|
1237
|
+
|
|
1238
|
+
```sh
|
|
1239
|
+
# NPM
|
|
1240
|
+
npm install hookdeck-cli@beta -g
|
|
1241
|
+
|
|
1242
|
+
# Homebrew
|
|
1243
|
+
brew install hookdeck/hookdeck/hookdeck-beta
|
|
1244
|
+
|
|
1245
|
+
# To force the symlink update and overwrite all conflicting files:
|
|
1246
|
+
# brew link --overwrite hookdeck-beta
|
|
1247
|
+
|
|
1248
|
+
# Scoop
|
|
1249
|
+
scoop install hookdeck-beta
|
|
1250
|
+
|
|
1251
|
+
# Docker
|
|
1252
|
+
docker run hookdeck/hookdeck-cli:v1.3.0-beta.1 version
|
|
1253
|
+
```
|
|
1254
|
+
|
|
1255
|
+
**Note:** Only stable releases (without pre-release identifiers like `-beta`, `-alpha`) will update the `latest` tags across all distribution channels.
|
|
1256
|
+
|
|
1257
|
+
## Repository Setup
|
|
1258
|
+
|
|
1259
|
+
### GitHub Repository Settings
|
|
1260
|
+
|
|
1261
|
+
To maintain code quality and protect the main branch, configure the following settings in your GitHub repository:
|
|
1262
|
+
|
|
1263
|
+
**Default Branch:**
|
|
1264
|
+
1. Go to Settings → Branches
|
|
1265
|
+
2. Set default branch to `main` (if not already set)
|
|
1266
|
+
|
|
1267
|
+
**Branch Protection Rules for `main`:**
|
|
1268
|
+
1. Go to Settings → Branches → Branch protection rules
|
|
1269
|
+
2. Add rule for `main` branch
|
|
1270
|
+
3. Enable the following settings:
|
|
1271
|
+
- **Require a pull request before merging**
|
|
1272
|
+
- Require approvals: 1 (or as needed for your team)
|
|
1273
|
+
- **Require status checks to pass before merging**
|
|
1274
|
+
- Require branches to be up to date before merging
|
|
1275
|
+
- Add status check: `build-linux`, `build-mac`, `build-windows` (from test workflow)
|
|
1276
|
+
- **Do not allow bypassing the above settings**
|
|
1277
|
+
- **Restrict force pushes** (recommended)
|
|
1278
|
+
- **Restrict deletions** (recommended)
|
|
1152
1279
|
|
|
1153
|
-
|
|
1280
|
+
These settings ensure that all changes to `main` go through proper review and testing before being merged.
|
|
1154
1281
|
|
|
1155
1282
|
## License
|
|
1156
1283
|
|
package/bin/hookdeck.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { execFileSync } = require('child_process');
|
|
3
|
+
const { existsSync } = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const platform = process.platform; // 'darwin', 'linux', 'win32'
|
|
7
|
+
const arch = process.arch; // 'x64', 'arm64', 'ia32'
|
|
8
|
+
|
|
9
|
+
// Map Node.js arch to Go arch naming
|
|
10
|
+
const archMap = {
|
|
11
|
+
'x64': 'amd64',
|
|
12
|
+
'arm64': 'arm64',
|
|
13
|
+
'ia32': '386'
|
|
14
|
+
};
|
|
15
|
+
const goArch = archMap[arch] || arch;
|
|
16
|
+
|
|
17
|
+
// Determine binary directory name and executable name
|
|
18
|
+
const binaryDir = `${platform}-${goArch}`;
|
|
19
|
+
const binaryName = platform === 'win32' ? 'hookdeck.exe' : 'hookdeck';
|
|
20
|
+
|
|
21
|
+
// Path to the binary relative to this script
|
|
22
|
+
const binaryPath = path.join(__dirname, '..', 'binaries', binaryDir, binaryName);
|
|
23
|
+
|
|
24
|
+
if (!existsSync(binaryPath)) {
|
|
25
|
+
console.error(`Error: Unsupported platform: ${platform}-${arch}`);
|
|
26
|
+
console.error(`Expected binary at: ${binaryPath}`);
|
|
27
|
+
console.error(`Please report this issue at https://github.com/hookdeck/hookdeck-cli/issues`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
execFileSync(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
|
|
33
|
+
} catch (error) {
|
|
34
|
+
// execFileSync will exit with the same code as the binary
|
|
35
|
+
// If there's an error executing, exit with code 1
|
|
36
|
+
process.exit(error.status || 1);
|
|
37
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hookdeck-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1-beta.1",
|
|
4
4
|
"description": "Hookdeck CLI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,19 +16,12 @@
|
|
|
16
16
|
},
|
|
17
17
|
"homepage": "https://github.com/hookdeck/hookdeck-cli#readme",
|
|
18
18
|
"bin": {
|
|
19
|
-
"hookdeck": "./bin/hookdeck"
|
|
19
|
+
"hookdeck": "./bin/hookdeck.js"
|
|
20
20
|
},
|
|
21
|
-
"files": [
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
"
|
|
27
|
-
"name": "hookdeck",
|
|
28
|
-
"path": "./bin",
|
|
29
|
-
"url": "https://github.com/hookdeck/hookdeck-cli/releases/download/v{{version}}/hookdeck_{{version}}_{{platform}}_{{arch}}.tar.gz"
|
|
30
|
-
},
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"go-npm-next": "^1.1.0"
|
|
33
|
-
}
|
|
21
|
+
"files": [
|
|
22
|
+
"bin/",
|
|
23
|
+
"binaries/"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {},
|
|
26
|
+
"dependencies": {}
|
|
34
27
|
}
|