feat(nodejs): implement Node.js binding core code#424
Conversation
longbinlai
left a comment
There was a problem hiding this comment.
Should release node.js package to npm.
|
|
||
| build_npm_linux_x86_64: | ||
| needs: format_check | ||
| runs-on: [self-hosted, daily, linux, x64] |
There was a problem hiding this comment.
Please refer to https://github.com/alibaba/neug/blob/main/.github/workflows/neug-test.yml#L61 for invoking to different runners for different repo(forked repo or alibaba/neug)
| make build EXTRA_CMAKE_FLAGS="-DOPTIMIZE_FOR_HOST=OFF -DCMAKE_PREFIX_PATH=/opt/neug/ -DOPENSSL_ROOT_DIR=/opt/neug" | ||
| ' | ||
|
|
||
| - name: Pack |
There was a problem hiding this comment.
Separate pack from building. For pull request even, running test on linux x86 is enough.
For packing on different platforms, run it as a nightly job.
| path: ./tools/nodejs_bind/neug-*-linux_x86_64.tgz | ||
| if-no-files-found: error | ||
|
|
||
| build_npm_linux_arm64: |
There was a problem hiding this comment.
The most part of build_npm_linux/macos_x86/arm64 are same. Please refer to https://github.com/alibaba/neug/blob/main/.github/workflows/wheels-common.yml merge them as a single job with params.
| @@ -0,0 +1,142 @@ | |||
| <a id="neug.connection"></a> | |||
|
|
|||
| # Module neug.connection | |||
There was a problem hiding this comment.
@Spockkk0225 @longbinlai We may need to review the generated documentation?
There was a problem hiding this comment.
Please follow https://github.com/alibaba/neug/blob/main/doc/README.md to build doc at local
| @@ -0,0 +1,208 @@ | |||
| /** Copyright 2020 Alibaba Group Holding Limited. | |||
There was a problem hiding this comment.
Could we generate this with protoc?
|
|
||
| namespace neug { | ||
|
|
||
| void SetupLogging() { |
There was a problem hiding this comment.
Duplicated to python_bind/neug_bindings.cc
|
|
||
| } // namespace neug | ||
|
|
||
| static Napi::Object InitAll(Napi::Env env, Napi::Object exports) { |
There was a problem hiding this comment.
Is Napi the best practice for nodejs bindings?
| @@ -0,0 +1,2435 @@ | |||
| /** Copyright 2020 Alibaba Group Holding Limited. | |||
There was a problem hiding this comment.
Duplicated to test_db_query.py, we don't NEED so many code
| @@ -0,0 +1,11 @@ | |||
| node_modules/ | |||
There was a problem hiding this comment.
Please merge .gitignore to repo root .gitignore
|
|
||
| # outer build directory | ||
| build/ | ||
| build_nodejs/ |
There was a problem hiding this comment.
Maybe we don't need this line
| endif() | ||
|
|
||
| if (BUILD_NODEJS) | ||
| if (TARGET neug_main) |
There was a problem hiding this comment.
neug_main must be built. Remove the dummy check
Related Issues
Fixes #423
What does this PR do?
Add Node.js bindings for NeuG, providing a native C++ addon (N-API / node-addon-api) and a high-level JavaScript API layer for embedded graph database access with Cypher query support.
What changes in this PR?
tools/nodejs_bind/src/):NodeDatabase,NodeConnection,NodeQueryResult,NodeQueryRequestclasses exposed viaNapi::ObjectWraptools/nodejs_bind/lib/):Database,Connection,AsyncConnection,Session,QueryResultand formatting utilities-DBUILD_NODEJS=ON, producesneug_node_bind.nodeaddonpackage.jsonwith N-API v8, Node >= 18,node-addon-api ^8.0.0lib/being ignored by root.gitignore