Skip to content

Commit f929501

Browse files
committed
feat: Add Node 24 and 25 prebuilt binary support
- Update prebuildify.targets to include Node 24 and 25 for both x64 and arm64 - Update build scripts to build for all three Node versions - Move node-gyp to optionalDependencies (build-time only) - Remove @mapbox/node-pre-gyp dependency - Add prebuildify for modern binary bundling - Update CI/CD workflows to use prebuildify - Simplify install script with better fallback handling - Add binding.gyp fix for OpenSSL compatibility This ensures users on Node 22, 24, and 25 all get fast prebuilt binary installations instead of falling back to source compilation.
1 parent f1caf93 commit f929501

File tree

7 files changed

+406
-346
lines changed

7 files changed

+406
-346
lines changed

.github/actions/build-native-binaries/action.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ runs:
7979
echo '✅ Native module compiled successfully'
8080
"
8181
82-
- name: Package binary with node-pre-gyp
82+
- name: Package binary with prebuildify
8383
shell: bash
8484
run: |
8585
echo "📦 Packaging binary for ${{ inputs.arch }}"
@@ -90,31 +90,31 @@ runs:
9090
fi
9191
9292
# Ensure the binary was built successfully
93-
if [ ! -d "lib/binding" ]; then
94-
echo "❌ No lib/binding directory found - build may have failed"
93+
if [ ! -d "build/Release" ]; then
94+
echo "❌ No build/Release directory found - build may have failed"
9595
exit 1
9696
fi
9797
9898
# List available binaries for debugging
9999
echo "🔍 Available binaries:"
100-
find lib/binding -name "*.node" -exec echo " {}" \; || echo " No .node files found"
100+
find build/Release -name "*.node" -exec echo " {}" \; || echo " No .node files found"
101101
102-
pnpm run build:native:package
102+
pnpm run build:native:prebuild
103103
echo "✅ Binary packaged successfully"
104104
105105
- name: Validate packaged binary
106106
shell: bash
107107
run: |
108108
echo "🔍 Validating packaged binary for ${{ inputs.arch }}"
109109
110-
# Check if tar.gz was created
111-
BINARY_PACKAGE=$(find . -name "*.tar.gz" | head -1)
112-
if [ -n "$BINARY_PACKAGE" ]; then
113-
echo "✅ Found binary package: $BINARY_PACKAGE"
114-
echo "📦 Package contents:"
115-
tar -tzf "$BINARY_PACKAGE" | head -10
110+
# Check if prebuildify created binaries
111+
PREBUILT_BINARIES=$(find . -name "prebuilds" -type d)
112+
if [ -n "$PREBUILT_BINARIES" ]; then
113+
echo "✅ Found prebuildify directory: $PREBUILT_BINARIES"
114+
echo "📦 Prebuilt binaries:"
115+
find "$PREBUILT_BINARIES" -name "*.node" -exec echo " {}" \; || echo " No .node files found"
116116
else
117-
echo "❌ No binary package found"
117+
echo "❌ No prebuildify directory found"
118118
exit 1
119119
fi
120120
@@ -123,6 +123,6 @@ runs:
123123
with:
124124
name: binary-${{ inputs.os }}-${{ inputs.arch }}
125125
path: |
126-
lib/binding/
127-
*.tar.gz
126+
prebuilds/
127+
build/Release/
128128
retention-days: 30

binding.gyp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
["OS=='linux'", {
1717
"cflags": ["-D_GNU_SOURCE"],
1818
"cflags_cc": ["-D_GNU_SOURCE"]
19+
}],
20+
["target_arch!='ia32' and target_arch!='x64' and target_arch!='arm64' and target_arch!='arm'", {
21+
"defines": ["OPENSSL_NO_ASM"]
1922
}]
2023
]
2124
}

compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
services:
2-
node-syslog-test:
2+
test:
33
build:
44
context: .
55
dockerfile: Dockerfile

package.json

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
"scripts": {
99
"build": "tsc",
1010
"build:native": "node-gyp rebuild",
11-
"build:native:package": "node-pre-gyp package",
12-
"build:native:publish": "node-pre-gyp publish",
11+
"build:native:prebuild": "prebuildify --target 22.0.0 --target 24.0.0 --target 25.0.0 --strip --napi",
12+
"build:native:package": "prebuildify --target 22.0.0 --target 24.0.0 --target 25.0.0 --strip",
1313
"test": "node scripts/container-test.js test",
1414
"test:coverage": "node scripts/container-test.js test:coverage",
1515
"test:watch": "node scripts/container-test.js test:watch",
1616
"dev": "tsc --watch",
1717
"lint": "eslint src --ext .ts",
18-
"prepublishOnly": "pnpm run build && npm run build:native",
18+
"prepublishOnly": "pnpm run build && npm run build:native && npm run build:native:prebuild",
1919
"install": "node scripts/install.js",
2020
"install:native": "node scripts/install.js",
2121
"docs:build": "typedoc && node scripts/build-docs.js",
@@ -44,36 +44,41 @@
4444
"arm64"
4545
],
4646
"dependencies": {
47-
"@mapbox/node-pre-gyp": "^2.0.0",
4847
"node-addon-api": "^8.5.0",
4948
"node-gyp-build": "^4.8.4"
5049
},
50+
"optionalDependencies": {
51+
"node-gyp": "^12.1.0"
52+
},
5153
"devDependencies": {
5254
"@eslint/js": "^9.39.1",
53-
"@tsconfig/recommended": "^1.0.12",
54-
"@tsconfig/node22": "^22.0.2",
55-
"@tsconfig/node-ts": "^23.6.1",
56-
"@types/node": "^24.10.0",
55+
"@tsconfig/recommended": "^1.0.13",
56+
"@tsconfig/node22": "^22.0.3",
57+
"@tsconfig/node-ts": "^23.6.2",
58+
"@types/node": "^24.10.1",
5759
"@typescript-eslint/eslint-plugin": "^8.46.4",
5860
"@typescript-eslint/parser": "^8.46.4",
5961
"@vitest/coverage-v8": "^4.0.8",
6062
"eslint": "^9.39.1",
61-
"node-gyp": "^12.0.0",
63+
"prebuildify": "^6.0.1",
6264
"typedoc": "^0.28.14",
6365
"typescript": "^5.9.3",
6466
"vitest": "^4.0.8"
6567
},
66-
"binary": {
67-
"module_name": "syslog_native",
68-
"module_path": "./lib/binding/{node_abi}-{platform}-{arch}/",
69-
"remote_path": "./{module_name}/v{version}/",
70-
"package_name": "{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz",
71-
"host": "https://github.com/schamane/node-syslog/releases/download",
72-
"accept_prerelease": false
68+
"prebuildify": {
69+
"targets": [
70+
"node@22-linux-x64",
71+
"node@22-linux-arm64",
72+
"node@24-linux-x64",
73+
"node@24-linux-arm64",
74+
"node@25-linux-x64",
75+
"node@25-linux-arm64"
76+
],
77+
"strip": true,
78+
"quiet": false
7379
},
7480
"pnpm": {
7581
"onlyBuiltDependencies": [
76-
"@mapbox/node-pre-gyp",
7782
"esbuild"
7883
]
7984
}

0 commit comments

Comments
 (0)