Building nodejs
bindings requires some extra setup.
For small or first-time contributions, we recommend the dev container method. Prefer to do it yourself? That's fine too!
OpenDAL provides a pre-configured dev container that could be used in GitHub Codespaces, VSCode, JetBrains, JupyterLab. Please pick up your favourite runtime environment.
The fastest way is:
The nodejs
binding requires Node.js@16+
to be built. We recommend using the latest TLS version for development.
OpenDAL provides a .node-version
file that specifies the recommended node versions. You can use any compatible tool to install the correct node version, such as fnm.
Alternatively, you can manually install the LTS node by following these steps:
For Ubuntu and Debian:
> curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && sudo apt-get install -y nodejs
For RHEL, CentOS, CloudLinux, Amazon Linux or Fedora:
> curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
Afterward, you will need to enable corepack
to ensure that pnpm
has been set up correctly:
> sudo corepack enable
To verify that everything is working properly, run pnpm --version
:
> pnpm --version
8.11.0
Using devbox
Launch Development Environment
devbox shell
Contains the following tools:
node
:18
pnpm
:8.14.0
libiconv
: fix nixld
missing issue
devbox run format
devbox run test
devbox run build
devbox run dev
# Install dependencies.
> pnpm install
# Build from source.
> pnpm build
# Build from source with debug info.
> pnpm build:debug
We are using our own developed behavior testing framework. Taking 'service-memory' as an example, you can use the following command to run it.
> OPENDAL_TEST=memory pnpm test
✓ |opendal| tests/service.test.mjs (8 tests | 2 skipped) 40ms
Test Files 1 passed (1)
Tests 6 passed | 2 skipped (8)
Start at 01:42:07
Duration 233ms (transform 25ms, setup 0ms, collect 56ms, tests 40ms, environment 0ms, prepare 52ms)