From dbaf798783b2a998119377545eaded771c17758c Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Thu, 23 Jan 2025 18:19:47 +0000 Subject: [PATCH] feat: build platform/arch specific npm packages support libpact_ffi & pact-js-core node bindings to be published in seperate npm packages. these are segmented by os-arch-libc users should not need to require these automatically, npm should determine the required optional dependency to download at install time. supported_platforms "@pact-foundation/pact-core-darwin-arm64": "16.0.0", "@pact-foundation/pact-core-darwin-x64": "16.0.0", "@pact-foundation/pact-core-linux-arm64-glibc": "16.0.0", "@pact-foundation/pact-core-linux-arm64-musl": "16.0.0", "@pact-foundation/pact-core-linux-x64-glibc": "16.0.0", "@pact-foundation/pact-core-linux-x64-musl": "16.0.0", "@pact-foundation/pact-core-win32-x64": "16.0.0" --- .github/workflows/build-and-test.yml | 4 +- .gitignore | 3 + .npmignore | 9 +- DEVELOPER.md | 114 +++++++++++++----- package-lock.json | 27 ++++- package.json | 12 +- package.json.tmpl | 20 ++++ script/ci/build-and-test.sh | 12 +- script/ci/build-opt-dependencies.sh | 168 +++++++++++++++++++++++++++ script/ci/lib/publish.sh | 4 + script/ci/prebuild.sh | 2 +- script/ci/release.sh | 2 + script/ci/unpack-and-test.sh | 5 + src/ffi/index.ts | 46 ++++++++ 14 files changed, 386 insertions(+), 42 deletions(-) create mode 100644 package.json.tmpl create mode 100755 script/ci/build-opt-dependencies.sh diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 32b56f58..9cb8feb8 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -173,11 +173,11 @@ jobs: - if: ${{ matrix.docker == true && matrix.alpine == true && matrix.arch == 'amd64' && matrix.os == 'ubuntu-latest' }} name: test linux amd64 musl - run: docker run -v $PWD:/home --platform linux/${{ matrix.arch }} --rm node:${{ matrix.node-version }}-alpine bin/sh -c 'apk add bash curl gcompat file && cd /home && /home/script/ci/unpack-and-test.sh' + run: docker run -v $PWD:/home --platform linux/${{ matrix.arch }} --rm node:${{ matrix.node-version }}-alpine bin/sh -c 'apk add jq gettext-envsubst bash curl gcompat file && cd /home && /home/script/ci/unpack-and-test.sh' - if: ${{ matrix.docker == true && matrix.alpine == true && matrix.arch == 'arm64' && matrix.os == 'ubuntu-24.04-arm' }} name: test linux arm64 musl - run: docker run -v $PWD:/home --platform linux/${{ matrix.arch }} --rm node:${{ matrix.node-version }}-alpine bin/sh -c 'apk add bash curl file protoc protobuf-dev && cd /home && /home/script/ci/unpack-and-test.sh' + run: docker run -v $PWD:/home --platform linux/${{ matrix.arch }} --rm node:${{ matrix.node-version }}-alpine bin/sh -c 'apk add jq gettext-envsubst bash curl file protoc protobuf-dev && cd /home && /home/script/ci/unpack-and-test.sh' release_dry_run: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index b428edab..5eebbcc5 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,6 @@ reports tmp .tmp test/__testoutput__ + +# platform-arch specific packages +@pact-foundation/* \ No newline at end of file diff --git a/.npmignore b/.npmignore index aa54c8e6..4fca5264 100644 --- a/.npmignore +++ b/.npmignore @@ -90,4 +90,11 @@ DEVELOPER.md RELEASING.md test.js tsconfig.build.json -tsconfig.json \ No newline at end of file +tsconfig.json + +# Standalone Binaries - Published as seperate packages +@pact-foundation/ + +# Cross packaging files +Makefile +package.json.tmpl \ No newline at end of file diff --git a/DEVELOPER.md b/DEVELOPER.md index 4a90971f..7cb0369b 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -4,13 +4,23 @@ Pact-Js-Core uses FFI bindings from the pact-reference project, which are prebui Do this and you should be 👌👌👌: -``` +```sh bash script/ci/prebuild.sh -npm ci --ignore-scripts +supported_platforms=$(./script/ci/build-opt-dependencies.sh determine_platform) +./script/ci/build-opt-dependencies.sh build +./script/ci/build-opt-dependencies.sh link npm run build -npm test +npm run test ``` +set supported platform to one of these values + +- `linux-x64` +- `linux-arm64` +- `darwin-x64` +- `darwin-arm64` +- `windows-x64` + _notes_ - As a developer, you need to run `bash script/ci/prebuild.sh` to @@ -32,61 +42,103 @@ Alternatively you can run the following, which will not create a prebuild, but i bash script/download-libs.sh npm ci npm run build -npm test +npm run test ``` -### Linux x86_64 Task +## Creating Platform specific packages -#### Pre Reqs +We create cross-platform and architecture binaries which are published individually to NPM, and consumed in this project. -1. x86_64 Machine - 1. ARM64 Mac - If you have Rosetta (MacOS) +### Download prebuilt binaries for all platforms -### CI Locally +```sh +./script/ci/build_opt_dependencies.sh libs v15.2.1 +``` -1. Docker/Podman -2. Act +Tag is optional and defaults to latest + +This will run the following script, which will grab the latest prebuilt binaries from GitHub. ```sh -act --container-architecture linux/amd64 -W .github/workflows/build-and-test.yml --artifact-server-path tmp +FETCH_ASSETS=true ./script/ci/check-release-libs.sh --fetch-assets -t v15.2.1 ``` -### MacOS ARM64 Task +### Building all platform specific npm packages -#### Pre Reqs +```sh +./script/ci/build_opt_dependencies.sh build +``` + +### Building individual platform specific npm package -1. Arm64 Mac -2. Cirrus-Cli -3. Tart.run +Supported platforms are +- linux-x64-glibc +- linux-arm64-glibc +- linux-x64-musl +- linux-arm64-musl +- darwin-x64 +- darwin-arm64 +- win32-x64 + +You can detect your platform with ```sh -cirrus run --output github-actions macos_arm --artifacts-dir tmp +./script/ci/build-opt-dependencies.sh determine_platform ``` -### Linux ARM64 Task +You can build with one -#### Pre Reqs +```sh +supported_platforms=$(./script/ci/build-opt-dependencies.sh determine_platform) ./script/ci/build-opt-dependencies.sh build +``` -1. Arm64 Machine +or all -### CI Locally +```sh +./script/ci/build-opt-dependencies.sh build +``` -1. Arm64 Machine -2. Docker / Podman -3. Cirrus-Cli +### Linking arch specific package, for your local build +Make link will try to link all available packages, for all available platforms, and will link any that apply ```sh -cirrus run --output github-actions linux_arm --artifacts-dir tmp +./script/ci/build-opt-dependencies.sh ``` -#### Publishing Assets +You can scope it with `supported_platforms` + +```sh +supported_platforms=$(./script/ci/build-opt-dependencies.sh determine_platform) ./script/ci/build-opt-dependencies.sh link +``` -MacOS ARM64 +### Publishing packages -`cirrus run --output github-actions macos_arm --artifacts-dir tmp --environment GITHUB_TOKEN=$GITHUB_TOKEN --environment CIRRUS_RELEASE=test --environment CIRRUS_REPO_FULL_NAME=pact-foundation/pact-js-core;` +Dry run publishing optional packages, (default) + +```sh +./script/ci/build-opt-dependencies.sh publish +``` -Linux ARM64 +Publishing packages with `--dry-run` option removed. -`cirrus run --output github-actions linux_arm --artifacts-dir tmp --environment GITHUB_TOKEN=$GITHUB_TOKEN --environment CIRRUS_RELEASE=test --environment CIRRUS_REPO_FULL_NAME=pact-foundation/pact-js-core;` \ No newline at end of file +```sh +PUBLISH=true ./script/ci/build-opt-dependencies.sh publish +``` + +### Linux x86_64 Task + +#### Pre Reqs + +1. x86_64 Machine + 1. ARM64 Mac - If you have Rosetta (MacOS) + +### CI Locally + +1. Docker/Podman +2. Act + +```sh +act --container-architecture linux/amd64 -W .github/workflows/build-and-test.yml --artifact-server-path tmp +``` diff --git a/package-lock.json b/package-lock.json index 578580df..11c344f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@pact-foundation/pact-core", - "version": "15.2.1", + "version": "16.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@pact-foundation/pact-core", - "version": "15.2.1", + "version": "16.0.0", "cpu": [ "x64", "ia32", @@ -20,6 +20,7 @@ ], "dependencies": { "check-types": "7.4.0", + "detect-libc": "^2.0.3", "node-gyp-build": "^4.6.0", "pino": "^8.7.0", "pino-pretty": "^9.1.1", @@ -81,6 +82,15 @@ }, "engines": { "node": ">=16" + }, + "optionalDependencies": { + "@pact-foundation/pact-core-darwin-arm64": "16.0.0", + "@pact-foundation/pact-core-darwin-x64": "16.0.0", + "@pact-foundation/pact-core-linux-arm64-glibc": "16.0.0", + "@pact-foundation/pact-core-linux-arm64-musl": "16.0.0", + "@pact-foundation/pact-core-linux-x64-glibc": "16.0.0", + "@pact-foundation/pact-core-linux-x64-musl": "16.0.0", + "@pact-foundation/pact-core-win32-x64": "16.0.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -2605,6 +2615,14 @@ "node": ">=8" } }, + "node_modules/detect-libc": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", + "engines": { + "node": ">=8" + } + }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -9862,6 +9880,11 @@ "integrity": "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==", "dev": true }, + "detect-libc": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==" + }, "detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", diff --git a/package.json b/package.json index 2c7d657c..41f5fd62 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pact-foundation/pact-core", - "version": "15.2.1", + "version": "16.0.0", "description": "Core of @pact-foundation/pact. You almost certainly don't want to depend on this directly.", "main": "src/index.js", "homepage": "https://github.com/pact-foundation/pact-js-core#readme", @@ -42,8 +42,18 @@ "publishConfig": { "access": "public" }, + "optionalDependencies": { + "@pact-foundation/pact-core-darwin-arm64": "16.0.0", + "@pact-foundation/pact-core-darwin-x64": "16.0.0", + "@pact-foundation/pact-core-linux-arm64-glibc": "16.0.0", + "@pact-foundation/pact-core-linux-arm64-musl": "16.0.0", + "@pact-foundation/pact-core-linux-x64-glibc": "16.0.0", + "@pact-foundation/pact-core-linux-x64-musl": "16.0.0", + "@pact-foundation/pact-core-win32-x64": "16.0.0" + }, "dependencies": { "check-types": "7.4.0", + "detect-libc": "^2.0.3", "node-gyp-build": "^4.6.0", "pino": "^8.7.0", "pino-pretty": "^9.1.1", diff --git a/package.json.tmpl b/package.json.tmpl new file mode 100644 index 00000000..9bc67a72 --- /dev/null +++ b/package.json.tmpl @@ -0,0 +1,20 @@ +{ + "name": "${node_pkg}", + "version": "${pkg_version}", + "description": "Platform/arch specific libpact_ffi binaries for @pact-foundation/pact-core", + "license": "MIT", + "repository": { + "type": "git", + "url": "git://github.com/pact-foundation/pact-js-core.git" + }, + "scripts": {}, + "author": "Yousaf Nabi ", + "homepage": "https://github.com/pact-foundation/pact-js-core#readme", + "os": [ + "${node_os}" + ], + ${libc} + "cpu": [ + "${node_arch}" + ] +} diff --git a/script/ci/build-and-test.sh b/script/ci/build-and-test.sh index abc3c01b..69d21d94 100755 --- a/script/ci/build-and-test.sh +++ b/script/ci/build-and-test.sh @@ -19,11 +19,15 @@ fi node --version npm --version +# Update main package.json optional dependencies versions, with those created earlier +current_platform=$("$SCRIPT_DIR"/build-opt-dependencies.sh determine_platform) +supported_platforms="$current_platform" "$SCRIPT_DIR"/build-opt-dependencies.sh update +# update lockfile post building updated opt deps +npm ci --ignore-scripts || npm i --ignore-scripts +# Link os/arch specific npm package, for running os/arch system -npm ci --ignore-scripts - +supported_platforms="$current_platform" "$SCRIPT_DIR"/build-opt-dependencies.sh link npm run format:check npm run lint npm run build -npm run test -ls -1 \ No newline at end of file +npm run test \ No newline at end of file diff --git a/script/ci/build-opt-dependencies.sh b/script/ci/build-opt-dependencies.sh new file mode 100755 index 00000000..a6ea10f0 --- /dev/null +++ b/script/ci/build-opt-dependencies.sh @@ -0,0 +1,168 @@ +#!/bin/bash + +export bin=@pact-foundation/pact-core +export pkg_version=$(cat package.json | jq -r .version) + +if [ -z "${supported_platforms+x}" ]; then + supported_platforms=("linux-x64-glibc" "linux-arm64-glibc" "linux-x64-musl" "linux-arm64-musl" "darwin-x64" "darwin-arm64" "win32-x64") +fi + +setup_package_vars(){ + unset node_os + unset node_arch + unset node_libc + unset libc + echo $supported_platform + IFS='-' read -r node_os node_arch node_libc <<< "$supported_platform" + export node_os=$node_os + export node_arch=$node_arch + export node_libc=$node_libc + if [ "$node_libc" = "glibc" ]; then + export libc='"libc": ["glibc"],' + fi + if [ "$node_libc" = "musl" ]; then + export libc='"libc": ["musl"],' + fi + export standalone_package=prebuilds/$node_os-$node_arch + if [ "$node_libc" = "musl" ] || [ "$node_libc" = "glibc" ]; then + export node_pkg=${bin}-$node_os-$node_arch-$node_libc + else + export node_pkg=${bin}-$node_os-$node_arch + fi +} + +clean() { + rm -rf @pact-foundation + npm run clean-libs +} + +libs() { + echo $1 + if [ -n "$1" ]; then + tag=$1 + else + tag=v${pkg_version} + fi + FETCH_ASSETS=true ./script/ci/check-release-libs.sh --fetch-assets -t $tag +} + +build() { + for supported_platform in "${supported_platforms[@]}"; do + setup_package_vars + echo "Building for $node_os-$node_arch" + echo "Building $node_pkg" + echo "Build $node_libc" + mkdir -p "$node_pkg/prebuilds" + cp -R "$standalone_package" "$node_pkg/prebuilds" + if [ "$node_libc" = "glibc" ]; then + find "$node_pkg/prebuilds" -type f -name '*musl*' -exec rm -f {} + + fi + if [ "$node_libc" = "musl" ]; then + find "$node_pkg/prebuilds" -type f ! -name '*musl*' -exec rm -f {} + + fi + envsubst < package.json.tmpl > "$node_pkg/package.json" + (cd $node_pkg && npm publish --access public ${DRY_RUN:---dry-run}) + done +} + +update() { + for supported_platform in "${supported_platforms[@]}"; do + setup_package_vars + jq '.optionalDependencies."'$node_pkg'" = "'$pkg_version'"' package.json > package-new.json + mv package-new.json package.json + done +} + +publish() { + set -eu + for supported_platform in "${supported_platforms[@]}"; do + setup_package_vars + echo "Building for $node_os-$node_arch" + echo "Building $node_pkg for $node_os-$node_arch" + if [ "${PUBLISH:-false}" = true ]; then + (cd $node_pkg && npm publish --access public) + else + (cd $node_pkg && npm publish --access public --dry-run) + fi + done +} + +link() { + set -eu + for supported_platform in "${supported_platforms[@]}"; do + setup_package_vars + (cd $node_pkg && npm link || echo "cannot link for platform") + npm link $node_pkg || echo "cannot link for platform" + done +} + +determine_platform(){ + case "$(uname -s)" in + Linux) + if [ "$(uname -m)" == "x86_64" ]; then + if [ -f /etc/os-release ] && grep -q 'Alpine' /etc/os-release; then + current_platform="linux-x64-musl" + else + current_platform="linux-x64-glibc" + fi + elif [ "$(uname -m)" == "aarch64" ]; then + if [ -f /etc/os-release ] && grep -q 'Alpine' /etc/os-release; then + current_platform="linux-arm64-musl" + else + export current_platform="linux-arm64-glibc" + fi + fi + ;; + Darwin) + if [ "$(uname -m)" == "x86_64" ]; then + export current_platform="darwin-x64" + elif [ "$(uname -m)" == "arm64" ]; then + export current_platform="darwin-arm64" + fi + ;; + CYGWIN*|MINGW32*|MSYS*|MINGW*) + export current_platform="win32-x64" + ;; + *) + echo "Unsupported platform: $(uname -s)" + exit 1 + ;; + esac + if [ -z "$current_platform" ]; then + echo "Error: could not determine current_platform" + exit 1 + fi + echo $current_platform +} + +help() { + echo "Pact platform/arch specific dependency builder" + + echo "Usage: $0 {clean|libs|build_opt_deps|update_opt_deps|publish_opt_package|link|determine_platform|help}" + echo + echo "Functions:" + echo " clean - Clean the build environment" + echo " libs - Fetch and check release libraries" + echo " build_opt_deps - Build optional dependencies for supported platforms" + echo " update_opt_deps - Update optional dependencies in package.json" + echo " publish_opt_package - Publish the optional package" + echo " link - Link the package for development" + echo " determine_platform - Determine the current platform" + echo " help - Display this help message" + + echo + echo "Supported platforms:" + for platform in "${supported_platforms[@]}"; do + echo " - $platform" + done + echo + echo "Example to run for the current platform:" + echo ' supported_platforms=$(./script/ci/build_opt_dependencies.sh determine_platform) ./script/ci/build_opt_dependencies.sh link' +} + +if [ $# -eq 0 ]; then + help + exit 1 +fi + +"$@" \ No newline at end of file diff --git a/script/ci/lib/publish.sh b/script/ci/lib/publish.sh index 0020219a..2ee7b508 100755 --- a/script/ci/lib/publish.sh +++ b/script/ci/lib/publish.sh @@ -14,12 +14,16 @@ echo "--> Releasing artifacts" echo " Publishing pact-core@${VERSION}..." if [[ ${DRY_RUN:-} == 'true' ]]; then echo "publishing in dry run mode" + # Dry-run Publish os/arch specific npm packages + "$SCRIPT_DIR"/../build-opt-dependencies.sh publish npm publish --access-public --dry-run else echo "--> Preparing npmrc file" "$SCRIPT_DIR"/create_npmrc_file.sh echo "--> Removing binding.gyp to prevent rebuild. See https://github.com/npm/cli/issues/5234#issuecomment-1291139150" rm "${SCRIPT_DIR}/../../../binding.gyp" + # Publish os/arch specific npm packages + "$SCRIPT_DIR"/../build-opt-dependencies.sh PUBLISH=true publish npm publish --access public --tag latest fi echo " done!" diff --git a/script/ci/prebuild.sh b/script/ci/prebuild.sh index c3c5b0a3..b5df85e7 100755 --- a/script/ci/prebuild.sh +++ b/script/ci/prebuild.sh @@ -1,4 +1,4 @@ -# !/bin/bash -eu +#!/bin/bash -eu set -e # This needs to be here for windows bash, which doesn't read the #! line above set -u diff --git a/script/ci/release.sh b/script/ci/release.sh index 113d9d42..d1216b24 100755 --- a/script/ci/release.sh +++ b/script/ci/release.sh @@ -80,7 +80,9 @@ fi FETCH_ASSETS=true ./script/ci/check-release-libs.sh --fetch-assets -t "${NEXT_TAG}" "$SCRIPT_DIR"/../download-plugins.sh +"$SCRIPT_DIR"/build-opt-dependencies.sh build "$SCRIPT_DIR"/build-and-test.sh +export pkg_version=$NEXT_VERSION if [[ ${DRY_RUN:-} == 'true' ]]; then VERSION=$NEXT_VERSION diff --git a/script/ci/unpack-and-test.sh b/script/ci/unpack-and-test.sh index 82671286..ab136d88 100755 --- a/script/ci/unpack-and-test.sh +++ b/script/ci/unpack-and-test.sh @@ -6,8 +6,13 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the . "$SCRIPT_DIR"/../lib/robust-bash.sh ls -1 +ls -1 artifact* mkdir -p prebuilds mv artifact*/*.tar.gz . ls *.gz |xargs -n1 tar -xzf + "$SCRIPT_DIR"/../download-plugins.sh +# Use the determined platform +current_platform=$("$SCRIPT_DIR"/build-opt-dependencies.sh determine_platform) +supported_platforms="$current_platform" "$SCRIPT_DIR"/build-opt-dependencies.sh build "$SCRIPT_DIR"/build-and-test.sh \ No newline at end of file diff --git a/src/ffi/index.ts b/src/ffi/index.ts index 9b486cac..d246a7f9 100644 --- a/src/ffi/index.ts +++ b/src/ffi/index.ts @@ -1,11 +1,50 @@ import path from 'node:path'; import bindings = require('node-gyp-build'); +import { isNonGlibcLinuxSync } from 'detect-libc'; import logger, { DEFAULT_LOG_LEVEL } from '../logger'; import { LogLevel } from '../logger/types'; import { Ffi, FfiLogLevelFilter } from './types'; export const PACT_FFI_VERSION = '0.4.22'; +/** + * Returns the library path which is located inside `node_modules` + * The naming convention is @pact-foundation/pact-core-${os}-${arch}<-${libc}> + * - "-${libc}" is optional for linux only + * @see https://nodejs.org/api/os.html#osarch + * @see https://nodejs.org/api/os.html#osplatform + * @example "x/xx/node_modules/@pact-foundation/pact-core-darwin-arm64" + */ +function getPlatformArchSpecificPackage() { + const { arch } = process; + let os = process.platform as string; + if (['win32', 'windows', 'cygwin'].includes(process.platform)) { + os = 'win32'; + } + let platformArchSpecificPackage = `@pact-foundation/pact-core-${os}-${arch}`; + if (os === 'linux') { + platformArchSpecificPackage += isNonGlibcLinuxSync() ? '-musl' : '-glibc'; + } + + const prebuildPackageLocation = process.env['PACT_PREBUILD_PACKAGE_LOCATION']; + if (prebuildPackageLocation) { + platformArchSpecificPackage = path.join( + prebuildPackageLocation, + platformArchSpecificPackage + ); + } + + const packagePath = `${platformArchSpecificPackage}/package.json`; + try { + require.resolve(packagePath); + return platformArchSpecificPackage; + } catch (e) { + throw new Error( + `Couldn't find npm package ${platformArchSpecificPackage} \n 💡 you can tell Pact where the npm package is located with env var $PACT_PREBUILD_PACKAGE_LOCATION` + ); + } +} + // supported prebuilds // darwin-arm64 // darwin-x64 @@ -54,6 +93,13 @@ const bindingsResolver = (bindingsPath: string | undefined) => bindings(bindingsPath); const bindingPaths = [ + path.resolve( + __dirname, + '..', + '..', + 'node_modules', + getPlatformArchSpecificPackage() + ), path.resolve(__dirname, '..', '..'), process.env['PACT_PREBUILD_LOCATION']?.toString() ?? path.resolve(), ];