diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 57413b7..89f9590 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,8 +28,8 @@ jobs: run: npm run install-zstd shell: bash - - name: install dependencies and compmile - run: npm install --loglevel verbose + - name: install dependencies and compile + run: npm install --ignore-scripts --loglevel verbose && npm run prebuild shell: bash - name: Test ${{ matrix.os }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json index af4b15c..924b352 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.0.0-alpha.2" + ".": "2.0.0-alpha.3" } diff --git a/HISTORY.md b/HISTORY.md index 29701a8..7c196fb 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.0.0-alpha.3](https://github.com/mongodb-js/zstd/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-12-05) + +### Bug Fixes + +* bundle release build on windows ([#59](https://github.com/mongodb-js/zstd/issues/59)) ([999c506](https://github.com/mongodb-js/zstd/commit/999c5064f7e1033a889b4e1d9b3cd491a5ec2ff9)) + ## [2.0.0-alpha.2](https://github.com/mongodb-js/zstd/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-12-04) diff --git a/README.md b/README.md index b1cc57c..d9f523f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # @mongodb-js/zstd -[![CI](https://github.com/mongodb-js/zstd/actions/workflows/CI.yml/badge.svg)](https://github.com/mongodb-js/zstd/actions/workflows/CI.yml) +[![CI](https://github.com/mongodb-js/zstd/actions/workflows/test.yml/badge.svg)](https://github.com/mongodb-js/zstd/actions/workflows/test.yml) Zstandard compression library for Node.js @@ -38,30 +38,35 @@ No verification is done when using npm to install the package. The contents of t To verify the native `.node` packages, follow the same steps as above using `mongodb-js-zstd-X.Y.Z-platform.tgz` and the corresponding `.sig` file. - -## OS Support matrix - -| | node12 | node14 | node16 | node18 | node20 | -| ---------------- | ------ | ------ | ------ | ------ | ------ | -| Windows x64 | ✓ | ✓ | ✓ | ✓ | ✓ | -| macOS x64 | ✓ | ✓ | ✓ | ✓ | ✓ | -| macOS arm64 | ✓ | ✓ | ✓ | ✓ | ✓ | -| Linux x64 gnu | ✓ | ✓ | ✓ | ✓ | ✓ | -| Linux arm gnu | ✓ | ✓ | ✓ | ✓ | ✓ | -| Linux arm64 gnu | ✓ | ✓ | ✓ | ✓ | ✓ | -| Linux x64 musl | ✓ | ✓ | ✓ | ✓ | ✓ | -| Linux arm64 musl | ✓ | ✓ | ✓ | ✓ | ✓ | - ## MongoDB Node.js Driver Version Compatibility Only the following version combinations with the [MongoDB Node.js Driver](https://github.com/mongodb/node-mongodb-native) are considered stable. -| | `@mongodb-js/zstd@1.x` | -| ------------- | ---------------------- | -| `mongodb@6.x` | ✓ `^1.1.0` | -| `mongodb@5.x` | ✓ | -| `mongodb@4.x` | ✓ | -| `mongodb@3.x` | N/A | +| | `@mongodb-js/zstd@1.x` | `@mongodb-js/zstd@2.x` | +| ---------------- | ---------------------- | ---------------------- | +| `mongodb@>=6.12` | ✓ `^1.1.0` | `^2.0.0` | +| `mongodb@<6.12` | ✓ `^1.1.0` | N/A | +| `mongodb@5.x` | ✓ | N/A | +| `mongodb@4.x` | ✓ | N/A | +| `mongodb@3.x` | N/A | N/A | + +#### Prebuild Platforms + +Below are the platforms that are available as prebuilds on each github release. +`prebuild-install` downloads these automatically depending on the platform you are running npm install on. + +- Linux GLIBC 2.23 or later + - s390x + - arm64 + - x64 +- Linux MUSL 1.1.20 + - arm64 + - x64 +- MacOS universal binary + - x64 + - arm64 +- Windows + - x64 ## API @@ -105,14 +110,9 @@ First, install and build the zstd library: `npm run install-zstd` -Then: -`npm test` - -## Releasing +Then build the bindings: -CI will automatically publish when it detects a new release after: +`npm run prebuild` -``` -npm run release -- --release-as -git push --follow-tags origin main -``` +Then test: +`npm test` diff --git a/binding.gyp b/binding.gyp index 3da1b99..4aa6259 100644 --- a/binding.gyp +++ b/binding.gyp @@ -23,14 +23,14 @@ { 'link_settings': { 'libraries': [ - '<(module_root_dir)/deps/zstd/build/cmake/lib/Debug/zstd_static.lib' + '<(module_root_dir)/deps/zstd/out/lib/Release/zstd_static.lib' ] }, }, { # macos and linux 'link_settings': { 'libraries': [ - '<(module_root_dir)/deps/zstd/build/cmake/lib/libzstd.a', + '<(module_root_dir)/deps/zstd/out/lib/libzstd.a', ] }, } diff --git a/etc/install-zstd.sh b/etc/install-zstd.sh index d9ba539..1f3bae8 100644 --- a/etc/install-zstd.sh +++ b/etc/install-zstd.sh @@ -1,5 +1,6 @@ #!/bin/sh set -o xtrace +set -o errexit clean_deps() { rm -rf deps @@ -9,18 +10,36 @@ download_zstd() { mkdir -p deps/zstd ZSTD_VERSION=$(node -p "require('./package.json')['mongodb:zstd_version']") + # only unpack the source and build files needed to compile the project + necessary_files="zstd-$ZSTD_VERSION/build zstd-$ZSTD_VERSION/lib zstd-$ZSTD_VERSION/programs" + + # flags + # -L follow redirects + # -C output directory + # - tar from stdin + # --strip-components ignore the top-level directory when unpacking curl -L "https://github.com/facebook/zstd/releases/download/v$ZSTD_VERSION/zstd-$ZSTD_VERSION.tar.gz" \ - | tar -zxf - -C deps/zstd --strip-components 1 + | tar -zxf - -C deps/zstd --strip-components 1 $necessary_files } build_zstd() { export MACOSX_DEPLOYMENT_TARGET=11 - cd deps/zstd/build/cmake + cd deps/zstd + + mkdir out + cd out # CMAKE_RC_FLAGS is a workaround for a bug in 1.5.6 that breaks compilation on windows. # The fix is merged but not yet released. see https://github.com/facebook/zstd/issues/3999 - cmake -DCMAKE_RC_FLAGS="$(pwd)/lib" -DZSTD_MULTITHREAD_SUPPORT=OFF -DZSTD_BUILD_SHARED=OFF -DCMAKE_OSX_ARCHITECTURES='x86_64;arm64' . - cmake --build . + cmake \ + -DCMAKE_RC_FLAGS="$(pwd)/lib" \ + -DZSTD_MULTITHREAD_SUPPORT=OFF \ + -DZSTD_BUILD_SHARED=OFF \ + -DCMAKE_OSX_ARCHITECTURES='x86_64;arm64' \ + -DCMAKE_BUILD_TYPE=Release \ + ../build/cmake + + cmake --build . --target libzstd_static --config Release } clean_deps diff --git a/package-lock.json b/package-lock.json index 2eb27ae..79e3b7e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mongodb-js/zstd", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@mongodb-js/zstd", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.3", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 93156a7..1da7297 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mongodb-js/zstd", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.3", "main": "lib/index.js", "types": "index.d.ts", "repository": "https://github.com/mongodb-js/zstd",