temporal_sdk_typescript_bridge
is a native Node.js module written in Rust using neon.
One of the advantages of using Rust is that it's easy to cross compile to various platforms and architectures.
By using Node.js' n-api
we get a binary which should work on all supported Node versions thanks to n-api
's ABI stability.
- Install rosetta with
softwareupdate --install-rosetta
- Make sure you have brew under Rosetta alongside your M1 brew intallation
See: Homebrew/brew#9173
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
- Download rustup.
- Run
rustup target add x86_64-apple-darwin
- if you're using a mac with an M1 chip - Run
rustup target add aarch64-apple-darwin
- if you're using a mac with an Intel chip
NOTE: you can only compile for aarch64 if you have MacOS Big Sur or later - Run
rustup target add x86_64-pc-windows-gnu
- Run
rustup target add x86_64-unknown-linux-gnu
- Run
rustup target add aarch64-unknown-linux-gnu
- Run
brew tap messense/macos-cross-toolchains
- Run
brew install x86_64-unknown-linux-gnu
to enable Linux x86_64 compilation - Run
brew install aarch64-unknown-linux-gnu
to enable Linux aarch64 compilation - Run
brew install mingw-w64
to enable Windows compilation on Intel Macs
Orarch -x86_64 /usr/local/bin/brew install mingw-w64
on M1 Macs - Configure cargo for the Windows and Linux build targets
cp etc/mac-cargo-config.toml ~/.cargo/config.toml
- Install the project's dependencies with
NPM_CONFIG_FOREGROUND_SCRIPTS=true npm ci
if you haven't already - Build the the bridge with
CC_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnu-gcc CC_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-gcc npx lerna run --stream build-rust -- --target all