Skip to content

Commit 79cb304

Browse files
remove bindings dependency
1 parent 0936bf0 commit 79cb304

File tree

4 files changed

+13
-34
lines changed

4 files changed

+13
-34
lines changed

.github/docker/Dockerfile.glibc

Lines changed: 1 addition & 1 deletion
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

package-lock.json

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

package.json

Lines changed: 1 addition & 2 deletions
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+
}

src/index.ts

Lines changed: 11 additions & 4 deletions
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
@@ -54,7 +61,7 @@ type MongoCryptConstructorOptions = {
5461
};
5562

5663
export interface MongoCryptConstructor {
57-
new (options: MongoCryptConstructorOptions): MongoCrypt;
64+
new(options: MongoCryptConstructorOptions): MongoCrypt;
5865
libmongocryptVersion: string;
5966
}
6067

@@ -116,6 +123,6 @@ export const MongoCrypt: MongoCryptConstructor = class MongoCrypt extends mc.Mon
116123

117124
/** exported for testing only. */
118125
interface MongoCryptContextCtor {
119-
new (): MongoCryptContext;
126+
new(): MongoCryptContext;
120127
}
121128
export const MongoCryptContextCtor: MongoCryptContextCtor = mc.MongoCryptContextCtor;

0 commit comments

Comments
 (0)