Skip to content

Commit 5559b19

Browse files
committed
Fix the darn build!
1. Don't skip tsc on install script. Previously, if `script/build.js` exists, we would skip the C++ build. 2. Fix issue with github tags if ZMQ version provided as semver. (github seems to normalize tarballed directory name by stripping leading `v` from tag) 3. Build scripts before node-gyp. Build library wrappers after. 4. Remove questionable npmrc 5. Switch to standard node-gyp-build. Modified version tends to hang on failure instead of crash.
1 parent e0c9853 commit 5559b19

File tree

6 files changed

+20
-25
lines changed

6 files changed

+20
-25
lines changed

.npmrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

.prototools

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm = "~8"

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
},
1919
"homepage": "http://zeromq.github.io/zeromq.js/",
2020
"dependencies": {
21-
"@aminya/node-gyp-build": "4.5.0-aminya.5",
2221
"cross-env": "^7.0.3",
2322
"node-addon-api": "^7.0.0",
23+
"node-gyp-build": "^4.5.0",
2424
"shelljs": "^0.8.5",
2525
"shx": "^0.3.4"
2626
},
@@ -79,7 +79,9 @@
7979
"tsconfig.json"
8080
],
8181
"scripts": {
82-
"install": "(shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true aminya-node-gyp-build",
82+
"preinstall": "run-s build.script",
83+
"install": "node-gyp-build",
84+
"prepare": "run-s build.library",
8385
"clean": "shx rm -rf ./build ./lib/ ./prebuilds ./script/*.js ./script/*.js.map ./script/*.d.ts ./script/*.tsbuildinfo",
8486
"clean.temp": "shx rm -rf ./tmp && shx mkdir -p ./tmp && shx touch ./tmp/.gitkeep",
8587
"build.library.compat": "shx rm -rf ./lib/ts3.7 && downlevel-dts ./lib ./lib/ts3.7 --to=3.7",
@@ -88,11 +90,11 @@
8890
"build.js": "run-p build.script build.library",
8991
"build.doc": "typedoc --options ./typedoc.json && minify-all -s docs-raw -d docs --jsCompressor terser",
9092
"deploy.doc": "run-s build.doc && gh-pages --dist \"./docs\"",
91-
"prebuild": "run-s build.js && node ./script/prebuild.js",
93+
"prebuild": "node ./script/prebuild.js",
9294
"build.native": "node-gyp configure --release && node-gyp build --release",
9395
"build.native.debug": "cross-env CMAKE_BUILD_TYPE=Debug node-gyp configure --debug && cross-env CMAKE_BUILD_TYPE=Debug node-gyp build --debug",
94-
"build": "run-s build.js build.native",
95-
"build.debug": "run-s build.js build.native.debug",
96+
"build": "run-s build.native",
97+
"build.debug": "run-s build.native.debug",
9698
"test": "run-s build && mocha --exit",
9799
"test.skip_gc_tests": "run-s build.debug && cross-env SKIP_GC_TESTS=true mocha --exit",
98100
"test.electron.main": "run-s build && electron-mocha",
@@ -102,8 +104,7 @@
102104
"lint.eslint": "pnpm run lint-test.eslint --fix",
103105
"lint": "run-p lint.eslint lint.clang-format",
104106
"lint-test": "run-s lint-test.eslint",
105-
"bench": "node --expose-gc test/bench",
106-
"prepublishOnly": "pnpm run build.js"
107+
"bench": "node --expose-gc test/bench"
107108
},
108109
"keywords": [
109110
"zeromq",

pnpm-lock.yaml

Lines changed: 6 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

script/build.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ const root = dirname(__dirname)
77
function main() {
88
const zmq_rev =
99
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/strict-boolean-expressions
10-
process.env.ZMQ_VERSION || "20de92ac0a2b2b9a1869782a429df68f93c3625e"
11-
const src_url = `https://github.com/zeromq/libzmq/archive/${zmq_rev}.tar.gz`
10+
process.env.ZMQ_VERSION || "4.3.5"
1211

12+
// if it looks like a dot-separated version number, prepend with "v" to match repo tagging convention
13+
const gitref = zmq_rev.match(/^\d+\./) ? `v${zmq_rev}` : zmq_rev
14+
const src_url = `https://github.com/zeromq/libzmq/archive/${gitref}.tar.gz`
1315
const libzmq_build_prefix = `${root}/build/libzmq-staging`
1416
const libzmq_install_prefix = `${root}/build/libzmq`
1517

src/native.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/* Declare all native C++ classes and methods in this file. */
44
const path = require("path")
5-
module.exports = require("@aminya/node-gyp-build")(path.join(__dirname, ".."))
5+
module.exports = require("node-gyp-build")(path.join(__dirname, ".."))
66

77
/**
88
* The version of the ØMQ library the bindings were built with. Formatted as

0 commit comments

Comments
 (0)