Skip to content

Commit

Permalink
fix(NODE-6591): remove bindings as a dependency (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson authored Dec 3, 2024
1 parent f8db4f9 commit e6e830d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 36 deletions.
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

FROM scratch

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ jobs:
matrix:
os: [macos-latest, windows-2019]
node: [16.x, 18.x, 20.x, 22.x]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
cache: "npm"
registry-url: "https://registry.npmjs.org"

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

Expand Down
5 changes: 3 additions & 2 deletions .mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"recursive": true,
"failZero": true,
"reporter": "test/tools/mongodb_reporter.js",
"color": true
}
"color": true,
"timeout": 0
}
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"
}
}
}
}
11 changes: 9 additions & 2 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');
}
}

const mc: MongoCryptBindings = load();

/**
* The value returned by the native bindings
Expand Down

0 comments on commit e6e830d

Please sign in to comment.