Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "cross-env ALWAYS_THROW=true yarn install"
},
"engines": {
"node": ">=18"
Expand All @@ -46,6 +47,7 @@
"@types/node": "^18.19.1",
"@types/node-abi": "^3.0.3",
"clang-format": "^1.8.0",
"cross-env": "^7.0.3",
"eslint": "^7.0.0",
"node-gyp": "^11.2.0",
"typescript": "^5.8.3",
Expand All @@ -66,4 +68,4 @@
"volta": {
"node": "24.1.0"
}
}
}
Comment thread
timfish marked this conversation as resolved.
Outdated
15 changes: 11 additions & 4 deletions scripts/check-build.mjs
Original file line number Diff line number Diff line change
@@ -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();
}
Expand Down Expand Up @@ -32,11 +35,15 @@ 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');
console.log(e);
if (process.env.ALWAYS_THROW) {
throw e;
} else {
console.log(e);
}
try {
recompileFromSource();
} catch (e) {
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +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-spawn@^7.0.2, cross-spawn@^7.0.6:
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:
cross-spawn "^7.0.1"

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==
Expand Down
Loading