Skip to content

Commit e6e830d

Browse files
fix(NODE-6591): remove bindings as a dependency (#57)
1 parent f8db4f9 commit e6e830d

File tree

6 files changed

+18
-36
lines changed

6 files changed

+18
-36
lines changed

Diff for: .github/docker/Dockerfile.glibc

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN apt-get -qq update && apt-get -qq install -y python3 build-essential && ldd
1616
RUN npm run install:libmongocrypt
1717

1818
ARG RUN_TEST
19-
RUN [ -n "$RUN_TEST" ] && npm run test || echo 'skipping testing!'
19+
RUN if [ -n "$RUN_TEST" ]; then npm test ; else echo "skipping tests" ; fi
2020

2121
FROM scratch
2222

Diff for: .github/workflows/test.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ jobs:
1313
matrix:
1414
os: [macos-latest, windows-2019]
1515
node: [16.x, 18.x, 20.x, 22.x]
16+
fail-fast: false
1617
runs-on: ${{ matrix.os }}
1718
steps:
1819
- uses: actions/checkout@v4
1920

2021
- uses: actions/setup-node@v4
2122
with:
2223
node-version: ${{ matrix.node }}
23-
cache: 'npm'
24-
registry-url: 'https://registry.npmjs.org'
24+
cache: "npm"
25+
registry-url: "https://registry.npmjs.org"
2526

2627
- name: Build with Node.js ${{ matrix.node }} on ${{ matrix.os }}
2728
run: node .github/scripts/libmongocrypt.mjs ${{ runner.os == 'Windows' && '--build' || '' }}
@@ -37,6 +38,7 @@ jobs:
3738
matrix:
3839
linux_arch: [s390x, arm64, amd64]
3940
node: [16.x, 18.x, 20.x, 22.x]
41+
fail-fast: false
4042
steps:
4143
- uses: actions/checkout@v4
4244

Diff for: .mocharc.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
"recursive": true,
1212
"failZero": true,
1313
"reporter": "test/tools/mongodb_reporter.js",
14-
"color": true
15-
}
14+
"color": true,
15+
"timeout": 0
16+
}

Diff for: package-lock.json

-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"gypfile": true,
3838
"mongodb:libmongocrypt": "1.11.0",
3939
"dependencies": {
40-
"bindings": "^1.5.0",
4140
"node-addon-api": "^4.3.0",
4241
"prebuild-install": "^7.1.2"
4342
},
@@ -97,4 +96,4 @@
9796
"moduleResolution": "node"
9897
}
9998
}
100-
}
99+
}

Diff for: src/index.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
import { cryptoCallbacks } from './crypto_callbacks';
22
export { cryptoCallbacks };
33

4-
import bindings = require('bindings');
5-
const mc: MongoCryptBindings = bindings('mongocrypt');
4+
function load() {
5+
try {
6+
return require('../build/Release/mongocrypt.node');
7+
} catch {
8+
return require('../build/Debug/mongocrypt.node');
9+
}
10+
}
11+
12+
const mc: MongoCryptBindings = load();
613

714
/**
815
* The value returned by the native bindings

0 commit comments

Comments
 (0)