Skip to content

Commit

Permalink
should be working
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Nov 13, 2024
1 parent 4f5f082 commit 6701502
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
registry-url: 'https://registry.npmjs.org'

- name: Build with Node.js ${{ matrix.node }} on ${{ matrix.os }}
run: npm install && npm run compile
run: bash etc/install-zstd.sh && npm install
shell: bash

- name: Test ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion addon/compressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ struct Compressor {

return Compressor(std::move(data), compression_level);
}
};
};
2 changes: 1 addition & 1 deletion addon/napi_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ Uint8Array Uint8ArrayFromValue(Value v, std::string argument_name) {
}

return v.As<Uint8Array>();
}
}
5 changes: 3 additions & 2 deletions addon/zstd.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "zstd.h"

#include <napi.h>

#include <string>
Expand All @@ -7,7 +9,6 @@
#include "compressor.h"
#include "decompressor.h"
#include "napi_utils.h"
#include "zstd.h"

using namespace Napi;

Expand Down Expand Up @@ -51,4 +52,4 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) {
return exports;
}

NODE_API_MODULE(hello, Init)
NODE_API_MODULE(zstd, Init)
16 changes: 13 additions & 3 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
'type': 'loadable_module',
'defines': ['ZSTD_STATIC_LINKING_ONLY'],
'include_dirs': [
"<!(node -p \"require('node-addon-api').include_dir\")"
"<!(node -p \"require('node-addon-api').include_dir\")",
"<(module_root_dir)/deps/zstd/lib",
],
'variables': {
'ARCH': '<(host_arch)',
'built_with_electron%': 0
},
'sources': [
'addon/*'
'addon/zstd.cpp',
'addon/compression_worker.h',
'addon/compressor.h',
'addon/decompressor.h',
'addon/napi_utils.h',
],
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
Expand All @@ -23,6 +28,11 @@
'cflags_cc!': [ '-fno-exceptions' ],
'msvs_settings': {
'VCCLCompilerTool': { 'ExceptionHandling': 1 },
}
},
'link_settings': {
'libraries': [
'<(module_root_dir)/deps/zstd/build/cmake/lib/libzstd.a',
]
},
}]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"prepare": "npm run compile",
"compile": "node-gyp rebuild",
"test": "mocha test/index.test.js",
"check:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint . .*.json",
"check:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint *ts lib/ .*.json",
"clang-format": "clang-format --style=file:.clang-format --Werror -i addon/*",
"check:clang-format": "clang-format --style=file:.clang-format --dry-run --Werror addon/*"
},
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { describe, test } = require('mocha');
const { compress, decompress } = require('../index');
const { compress, decompress } = require('../lib/index');

const zstdLegacy = require('@mongodb-js/zstd');
const { expect } = require('chai');
Expand Down

0 comments on commit 6701502

Please sign in to comment.