From 42e647add33f72161dba28a22b1f725b6ed61eaa Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Fri, 29 Aug 2025 14:40:13 -0500 Subject: [PATCH 1/6] fix: Failing install script --- scripts/check-build.mjs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/check-build.mjs b/scripts/check-build.mjs index 687c990..13b0eef 100644 --- a/scripts/check-build.mjs +++ b/scripts/check-build.mjs @@ -1,7 +1,10 @@ -import fs from 'fs'; -import child_process from 'child_process'; +import * as child_process from 'node:child_process'; +import * as fs from 'node:fs'; +import { createRequire } from 'node:module'; import * as binaries from './binaries.mjs'; +const require = createRequire(import.meta.url); + function clean(err) { return err.toString().trim(); } @@ -32,7 +35,7 @@ function recompileFromSource() { if (fs.existsSync(binaries.target)) { try { - await import(binaries.target); + require(binaries.target); console.log('Precompiled binary found, skipping build from source.'); } catch (e) { console.log('Precompiled binary found but failed loading'); From 1210f2c84b45ec08614691529b450ac4f1cbdc92 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Thu, 4 Sep 2025 03:47:33 +0200 Subject: [PATCH 2/6] Add test --- package.json | 3 ++- scripts/check-build.mjs | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index caa44a0..7a4a584 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "build:dev": "yarn clean && yarn build:bindings:configure && yarn build", "build:tarball": "npm pack", "clean": "node-gyp clean && rm -rf lib && rm -rf build", - "test": "node ./test/prepare.mjs && vitest run --silent=false --disable-console-intercept" + "test": "yarn test:install && node ./test/prepare.mjs && vitest run --silent=false --disable-console-intercept", + "test:install": "ALWAYS_THROW=true yarn install" }, "engines": { "node": ">=18" diff --git a/scripts/check-build.mjs b/scripts/check-build.mjs index 13b0eef..811f3cc 100644 --- a/scripts/check-build.mjs +++ b/scripts/check-build.mjs @@ -39,7 +39,11 @@ if (fs.existsSync(binaries.target)) { console.log('Precompiled binary found, skipping build from source.'); } catch (e) { console.log('Precompiled binary found but failed loading'); - console.log(e); + if (process.env.ALWAYS_THROW) { + throw e; + } else { + console.log(e); + } try { recompileFromSource(); } catch (e) { From 288a541db3e27058fb8259d6c0fe8ec3e421a85a Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Thu, 4 Sep 2025 13:59:16 +0200 Subject: [PATCH 3/6] Use cross-env so test passes on Windows --- package.json | 5 +++-- yarn.lock | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7a4a584..0ebeab6 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "build:tarball": "npm pack", "clean": "node-gyp clean && rm -rf lib && rm -rf build", "test": "yarn test:install && node ./test/prepare.mjs && vitest run --silent=false --disable-console-intercept", - "test:install": "ALWAYS_THROW=true yarn install" + "test:install": "cross-env ALWAYS_THROW=true yarn install" }, "engines": { "node": ">=18" @@ -47,6 +47,7 @@ "@types/node": "^18.19.1", "@types/node-abi": "^3.0.3", "clang-format": "^1.8.0", + "cross-env": "^10.0.0", "eslint": "^7.0.0", "node-gyp": "^11.2.0", "typescript": "^5.8.3", @@ -67,4 +68,4 @@ "volta": { "node": "24.1.0" } -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 3b5dba9..eb357e5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24,6 +24,11 @@ js-tokens "^4.0.0" picocolors "^1.0.0" +"@epic-web/invariant@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@epic-web/invariant/-/invariant-1.0.0.tgz#1073e5dee6dd540410784990eb73e4acd25c9813" + integrity sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA== + "@esbuild/aix-ppc64@0.25.4": version "0.25.4" resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.4.tgz#830d6476cbbca0c005136af07303646b419f1162" @@ -952,6 +957,14 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== +cross-env@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-10.0.0.tgz#ba25823cfa1ed6af293dcded8796fa16cd162456" + integrity sha512-aU8qlEK/nHYtVuN4p7UQgAwVljzMg8hB4YK5ThRqD2l/ziSnryncPNn7bMLt5cFYsKVKBh8HqLqyCoTupEUu7Q== + dependencies: + "@epic-web/invariant" "^1.0.0" + cross-spawn "^7.0.6" + cross-spawn@^7.0.2, cross-spawn@^7.0.6: version "7.0.6" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" From 87173902c0051917db4244b5d947f283c9170726 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Thu, 4 Sep 2025 14:43:17 +0200 Subject: [PATCH 4/6] Support older node for testing --- package.json | 2 +- yarn.lock | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 0ebeab6..20685ce 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@types/node": "^18.19.1", "@types/node-abi": "^3.0.3", "clang-format": "^1.8.0", - "cross-env": "^10.0.0", + "cross-env": "^7.0.3", "eslint": "^7.0.0", "node-gyp": "^11.2.0", "typescript": "^5.8.3", diff --git a/yarn.lock b/yarn.lock index eb357e5..96a7d8a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24,11 +24,6 @@ js-tokens "^4.0.0" picocolors "^1.0.0" -"@epic-web/invariant@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@epic-web/invariant/-/invariant-1.0.0.tgz#1073e5dee6dd540410784990eb73e4acd25c9813" - integrity sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA== - "@esbuild/aix-ppc64@0.25.4": version "0.25.4" resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.4.tgz#830d6476cbbca0c005136af07303646b419f1162" @@ -957,15 +952,14 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== -cross-env@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-10.0.0.tgz#ba25823cfa1ed6af293dcded8796fa16cd162456" - integrity sha512-aU8qlEK/nHYtVuN4p7UQgAwVljzMg8hB4YK5ThRqD2l/ziSnryncPNn7bMLt5cFYsKVKBh8HqLqyCoTupEUu7Q== +cross-env@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf" + integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw== dependencies: - "@epic-web/invariant" "^1.0.0" - cross-spawn "^7.0.6" + cross-spawn "^7.0.1" -cross-spawn@^7.0.2, cross-spawn@^7.0.6: +cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.6: version "7.0.6" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== From 937509e3be88859fb30624c963f4bcfd61afb215 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Wed, 17 Sep 2025 17:40:05 +0200 Subject: [PATCH 5/6] Update package.json Co-authored-by: Abhijeet Prasad --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 20685ce..1e83dec 100644 --- a/package.json +++ b/package.json @@ -68,4 +68,4 @@ "volta": { "node": "24.1.0" } -} \ No newline at end of file +} From 8b61355a629f537c851d73e5c7c51b59717ad5e4 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Wed, 17 Sep 2025 17:42:08 +0200 Subject: [PATCH 6/6] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e49e8bb..99a2aff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.2.3 + +- fix: Failing install script (#22) + ## 0.2.2 - fix: when tracking threads, use a monotonic clock that ignores system suspension (#14)