Table of Contents
The Temporal TypeScript SDK (as well as the rest of the Temporal codebase) is open sourced under the MIT license.
We welcome contributions from the community. To contribute, please start by opening an issue and discussing the proposed change. Once a change has been agreed upon, development may start and be submitted via a pull request.
If you'd like to give a hand, please reach us on our community Slack workspace. We'd be happy to have help with any of these things:
- Triaging issues
- Reviewing PRs
- Submitting PRs to close issues
Contributors must agree to the CLA before their PR can be merged. You only have to do this once. Follow this link and sign in with your GitHub account.
The Temporal TypeScript SDK is officially supported on Node 20, 22, or 24. However, we recommend using the Active LTS for SDK development. For easier testing during development, you may want to use a version manager, such as fnm or nvm.
-
To run tests, you will need access to a local Temporal server, e.g. using the Temporal CLI's integrated dev server.
-
Install the Rust toolchain.
-
Install Protocol Buffers.
-
Clone the sdk-typescript repo:
git clone https://github.com/temporalio/sdk-typescript.git cd sdk-typescript -
Initialize the Core SDK submodule:
git submodule update --init --recursive
If you get a
The authenticity of host 'github.com (192.30.252.123)' can't be established.error, runssh-keyscan github.com >> ~/.ssh/known_hostsand retry. -
Install
pnpmTS SDK uses PNPM to manage dependencies. Corepack is the recommend way to installpnpmand is included in Node 14+
corepack enable-
Install the dependencies:
pnpm install --frozen-lockfile
This may take a few minutes, as it involves downloading and compiling Rust dependencies.
You should now be able to build:
pnpm run buildIf building fails, resetting your environment may help:
pnpm run clean -y
pnpm install --frozen-lockfile
If pnpm install fails in @temporalio/core-bridge on the command pnpm tsx ./scripts/build.ts, you may
need to do rustup update.
To update to the latest version of the Core SDK, run git submodule update followed by pnpm run build to recompile.
After your environment is set up, you can run these commands:
pnpm run buildcompiles protobuf definitions, Rust bridge, C++ isolate extension, and Typescript.pnpm run rebuilddeletes all generated files in the project and reruns build.pnpm run build:watchwatches filesystem for changes and incrementally compiles Typescript on change.pnpm run testruns the test suite.pnpm run test:watchruns the test suite on each change to Typescript files.pnpm run formatformats code with prettier.pnpm run lintverifies code style with prettier and ES lint.pnpm run commitlintvalidates commit messages.
Create a .cargo/config.toml file and override the path to sdk-core and/or sdk-core-protos as
described here
In order to run integration tests:
- Run the Temporal server, e.g. using the Temporal CLI's integrated dev server
- Export
RUN_INTEGRATION_TESTS=true
To replicate the test-npm-init CI test locally, you can start with the below steps:
If you've run
npx @temporalio/createbefore, you may need to delete the version of the package that's stored in~/.npm/_npx/.
pnpm install --frozen-lockfile
pnpm run rebuild
TMP_DIR=$( mktemp -d )
pnpm tsx scripts/publish-to-verdaccio.ts --registry-dir "$TMP_DIR"
pnpm tsx scripts/init-from-verdaccio.ts --registry-dir "$TMP_DIR" --target-dir "./example" --sample hello-world
pnpm tsx scripts/test-example.ts --work-dir "./example"
rm -rf ./example "$TMP_DIR"
- Typescript code is linted with eslint
- Files in this repo are formatted with prettier
- Pull request titles SHOULD adhere to the Conventional Commits specification, for example:
<type>(optional scope): <description>
chore(samples): upgrade commander module
The scope options are listed in commitlint.config.js.
There are various tools out there to help with updating and pruning NPM dependencies.
I personally use the following commands to find NPM packages that needs to be updated. It runs interactively on each package of the repo, making it easy to select and apply packages to be updated.
for i in ./package.json packages/*/package.json ; do
(
cd "${i%%package.json}"
pwd
npm-check-updates -i
)
done
To identify unused dependencies, I run the following script. Note that npm-check may report
false-positive. Search the code before actually deleting any dependency. Also note that runtime
dependencies MUST be added on the actual packages that use them to ensure proper execution in PNPM
and YARN 2+ setups.
for i in ./package.json packages/*/package.json ; do
(
cd "${i%%package.json}"
pwd
npm-check
)
done
To install both tools: npm i -g npm-check npm-check-updates.