This repository uses yarn@v1
.
Other package managers may work but are not officially supported for development.
To set up the repository, run:
yarn
yarn build
This will install all the required dependencies and build output files to dist/
.
Most of the SDK is generated code, and any modified code will be overridden on the next generation. The
src/lib/
and examples/
directories are exceptions and will never be overridden.
All files in the examples/
directory are not modified by the Stainless generator and can be freely edited or
added to.
// add an example to examples/<your-example>.ts
#!/usr/bin/env -S npm run tsn -T
…
chmod +x examples/<your-example>.ts
# run the example against your api
yarn tsn -T examples/<your-example>.ts
If you’d like to use the repository from source, you can either install from git or link to a cloned repository:
To install via git:
npm install git+ssh://[email protected]:openai/openai-node.git
Alternatively, to link a local copy of the repo:
# Clone
git clone https://www.github.com/openai/openai-node
cd openai-node
# With yarn
yarn link
cd ../my-package
yarn link openai
# With pnpm
pnpm link --global
cd ../my-package
pnpm link -—global openai
Most tests require you to set up a mock server against the OpenAPI spec to run the tests.
npx prism mock path/to/your/openapi.yml
yarn run test
This repository uses prettier and eslint to format the code in the repository.
To lint:
yarn lint
To format and fix all lint issues automatically:
yarn fix
Changes made to this repository via the automated release PR pipeline should publish to npm automatically. If the changes aren't made through the automated pipeline, you may want to make releases manually.
You can release to package managers by using the Publish NPM
GitHub action. This requires a setup organization or repository secret to be set up.
If you need to manually release a package, you can run the bin/publish-npm
script with an NPM_TOKEN
set on
the environment.