Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(NODE-6591): remove bindings as a dependency #57

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .github/docker/Dockerfile.glibc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN apt-get -qq update && apt-get -qq install -y python3 build-essential && ldd
RUN npm run install:libmongocrypt

ARG RUN_TEST
RUN [ -n "$RUN_TEST" ] && npm run test || echo 'skipping testing!'
RUN if [ -n "$RUN_TEST" ]; then npm test ; else echo "skipping tests" ; fi
nbbeeken marked this conversation as resolved.
Show resolved Hide resolved

FROM scratch

Expand Down
27 changes: 0 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"gypfile": true,
"mongodb:libmongocrypt": "1.11.0",
"dependencies": {
"bindings": "^1.5.0",
"node-addon-api": "^4.3.0",
"prebuild-install": "^7.1.2"
},
Expand Down Expand Up @@ -97,4 +96,4 @@
"moduleResolution": "node"
}
}
}
}
15 changes: 11 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { cryptoCallbacks } from './crypto_callbacks';
export { cryptoCallbacks };

import bindings = require('bindings');
const mc: MongoCryptBindings = bindings('mongocrypt');
function load() {
try {
return require('../build/Release/mongocrypt.node');
} catch {
return require('../build/Debug/mongocrypt.node');
}
nbbeeken marked this conversation as resolved.
Show resolved Hide resolved
}

const mc: MongoCryptBindings = load();

/**
* The value returned by the native bindings
Expand Down Expand Up @@ -54,7 +61,7 @@
};

export interface MongoCryptConstructor {
new (options: MongoCryptConstructorOptions): MongoCrypt;
new(options: MongoCryptConstructorOptions): MongoCrypt;

Check failure on line 64 in src/index.ts

View workflow job for this annotation

GitHub Actions / typescript

Insert `·`
libmongocryptVersion: string;
}

Expand Down Expand Up @@ -116,6 +123,6 @@

/** exported for testing only. */
interface MongoCryptContextCtor {
new (): MongoCryptContext;
new(): MongoCryptContext;

Check failure on line 126 in src/index.ts

View workflow job for this annotation

GitHub Actions / typescript

Insert `·`
}
export const MongoCryptContextCtor: MongoCryptContextCtor = mc.MongoCryptContextCtor;
Loading