Skip to content

Commit 13f75f7

Browse files
authored
fix: Failing install script (#22)
1 parent 1a2a244 commit 13f75f7

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.2.3
4+
5+
- fix: Failing install script (#22)
6+
37
## 0.2.2
48

59
- fix: when tracking threads, use a monotonic clock that ignores system suspension (#14)

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"build:dev": "yarn clean && yarn build:bindings:configure && yarn build",
3333
"build:tarball": "npm pack",
3434
"clean": "node-gyp clean && rm -rf lib && rm -rf build",
35-
"test": "node ./test/prepare.mjs && vitest run --silent=false --disable-console-intercept"
35+
"test": "yarn test:install && node ./test/prepare.mjs && vitest run --silent=false --disable-console-intercept",
36+
"test:install": "cross-env ALWAYS_THROW=true yarn install"
3637
},
3738
"engines": {
3839
"node": ">=18"
@@ -46,6 +47,7 @@
4647
"@types/node": "^18.19.1",
4748
"@types/node-abi": "^3.0.3",
4849
"clang-format": "^1.8.0",
50+
"cross-env": "^7.0.3",
4951
"eslint": "^7.0.0",
5052
"node-gyp": "^11.2.0",
5153
"typescript": "^5.8.3",

scripts/check-build.mjs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import fs from 'fs';
2-
import child_process from 'child_process';
1+
import * as child_process from 'node:child_process';
2+
import * as fs from 'node:fs';
3+
import { createRequire } from 'node:module';
34
import * as binaries from './binaries.mjs';
45

6+
const require = createRequire(import.meta.url);
7+
58
function clean(err) {
69
return err.toString().trim();
710
}
@@ -32,11 +35,15 @@ function recompileFromSource() {
3235

3336
if (fs.existsSync(binaries.target)) {
3437
try {
35-
await import(binaries.target);
38+
require(binaries.target);
3639
console.log('Precompiled binary found, skipping build from source.');
3740
} catch (e) {
3841
console.log('Precompiled binary found but failed loading');
39-
console.log(e);
42+
if (process.env.ALWAYS_THROW) {
43+
throw e;
44+
} else {
45+
console.log(e);
46+
}
4047
try {
4148
recompileFromSource();
4249
} catch (e) {

yarn.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,14 @@ concat-map@0.0.1:
952952
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
953953
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
954954

955-
cross-spawn@^7.0.2, cross-spawn@^7.0.6:
955+
cross-env@^7.0.3:
956+
version "7.0.3"
957+
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
958+
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
959+
dependencies:
960+
cross-spawn "^7.0.1"
961+
962+
cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.6:
956963
version "7.0.6"
957964
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f"
958965
integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==

0 commit comments

Comments
 (0)