Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Development

## Contributing

See [`CONTRIBUTING.md`](CONTRIBUTING.md).

## Development setup

To build `libdatadog-nodejs` locally (for example, to run tests or try out changes), you need Node.js, Yarn, and Rust.

**Rust (required for native and WASM builds)**

The project compiles Rust for both native Node.js addons and WebAssembly. Use [rustup](https://rustup.rs/) (the recommended and supported method):

1. **Install rustup and Rust** (see https://rustup.rs/ for more options):

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

2. **Ensure Rust is on `PATH`** — the rustup installer prints the command for your shell; run it or open a new terminal.

3. **Add the WebAssembly target** (required for the full build):

```bash
rustup target add wasm32-unknown-unknown
```

4. **On macOS only** — the WASM build requires LLVM from Homebrew (Apple's Clang has compatibility issues with some crates). Install it before building:

```bash
brew install llvm
```

5. **Install dependencies:**

```bash
yarn install
```

## Building

* `yarn build`: Build the default workspaces in debug mode.
* `yarn build-release`: Build the default workspaces in release mode.
* `yarn build-all`: Build all workspaces in debug mode. This is useful when working on a workspace that is not a default member yet.

## Run tests

* `yarn test`: Run the JavaScript test suite
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,3 @@ Node.js bindings for [libdatadog](https://github.com/DataDog/libdatadog).

This project is currently meant to be used only by [dd-trace-js](https://github.com/DataDog/dd-trace-js)
and installing it directly is not supported at the moment.

## Building
Comment thread
watson marked this conversation as resolved.

* `yarn build`: Build the default workspaces in debug mode.
* `yarn build-release`: Build the default workspaces in release mode.
* `yarn build-all`: Build all workspaces in debug mode. This is useful when working on a workspace that is not a default member yet.
5 changes: 5 additions & 0 deletions scripts/build-wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ if (isMacOS) {
// Add LLVM to PATH if not already included
env.PATH = `${llvmBinDir}:${env.PATH}`;
}

// Force C/C++ code (e.g. zstd-sys) to use Homebrew's clang for wasm32. Otherwise a global
// CC (e.g. ccache cc) can point at Apple Clang, which does not support wasm32-unknown-unknown.
env.CC_wasm32_unknown_unknown = `${llvmBinDir}/clang`;
env.CXX_wasm32_unknown_unknown = `${llvmBinDir}/clang++`;
}

childProcess.execSync(
Expand Down