This repository contains the Hyphen SDKs for JavaScript. It is a pnpm workspace. Each SDK is a package in the packages directory.
| Package | Directory | Description |
|---|---|---|
| @hyphen/sdk | packages/nodejs-sdk | The Hyphen SDK for Node.js |
| @hyphen/browser-sdk | packages/browser-sdk | The Hyphen SDK for the browser |
| @hyphen/react-sdk | packages/react-sdk | The Hyphen SDK for React |
Each package has a README.md file that shows how to install and use the package.
The packages use each other in the workspace:
@hyphen/react-sdkuses@hyphen/browser-sdk.- The tests of
@hyphen/browser-sdkuse@hyphen/sdk.
Use pnpm for all commands. Do not use npm.
Run these commands from the root of the repository. Each command runs in all packages.
| Command | Description |
|---|---|
pnpm install |
Installs the dependencies of all packages |
pnpm build |
Builds all packages |
pnpm lint |
Runs the Biome linter and applies the fixes |
pnpm test |
Builds all packages, then runs the linter and the tests with coverage |
pnpm test:ci |
Builds all packages, then runs the linter with no fixes and the tests with coverage |
pnpm clean |
Removes the dist, node_modules, and coverage directories |
To run a command in one package, use a filter:
pnpm --filter @hyphen/browser-sdk testSome tests call the Hyphen API. The Node.js SDK README gives the environment variables that these tests need. Put the .env file in the directory of the package that you test.
Each package has its own version. To release a package, do these steps:
- Set the new version in the
package.jsonfile of the package. - Merge the change into the
mainbranch. - Publish a GitHub release.
The release workflow then stages each package that has a version that is not on npm. A maintainer promotes each staged version on npm.
We welcome contributions. Follow the Contributing guidelines and our Code of Conduct.
To report a security problem, follow the Security Policy.
This project is licensed under the MIT License. See the LICENSE file for details.
