|  | 
|  | 1 | +## Setting up the environment | 
|  | 2 | + | 
|  | 3 | +This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install). | 
|  | 4 | +Other package managers may work but are not officially supported for development. | 
|  | 5 | + | 
|  | 6 | +To set up the repository, run: | 
|  | 7 | + | 
|  | 8 | +```sh | 
|  | 9 | +$ yarn | 
|  | 10 | +$ yarn build | 
|  | 11 | +``` | 
|  | 12 | + | 
|  | 13 | +This will install all the required dependencies and build output files to `dist/`. | 
|  | 14 | + | 
|  | 15 | +## Modifying/Adding code | 
|  | 16 | + | 
|  | 17 | +Most of the SDK is generated code. Modifications to code will be persisted between generations, but may | 
|  | 18 | +result in merge conflicts between manual patches and changes from the generator. The generator will never | 
|  | 19 | +modify the contents of the `src/lib/` and `examples/` directories. | 
|  | 20 | + | 
|  | 21 | +## Adding and running examples | 
|  | 22 | + | 
|  | 23 | +All files in the `examples/` directory are not modified by the generator and can be freely edited or added to. | 
|  | 24 | + | 
|  | 25 | +```ts | 
|  | 26 | +// add an example to examples/<your-example>.ts | 
|  | 27 | + | 
|  | 28 | +#!/usr/bin/env -S npm run tsn -T | 
|  | 29 | +… | 
|  | 30 | +``` | 
|  | 31 | + | 
|  | 32 | +```sh | 
|  | 33 | +$ chmod +x examples/<your-example>.ts | 
|  | 34 | +# run the example against your api | 
|  | 35 | +$ yarn tsn -T examples/<your-example>.ts | 
|  | 36 | +``` | 
|  | 37 | + | 
|  | 38 | +## Using the repository from source | 
|  | 39 | + | 
|  | 40 | +If you’d like to use the repository from source, you can either install from git or link to a cloned repository: | 
|  | 41 | + | 
|  | 42 | +To install via git: | 
|  | 43 | + | 
|  | 44 | +```sh | 
|  | 45 | +$ npm install git+ssh://[email protected] :stainless-sdks/zeroentropy-node.git | 
|  | 46 | +``` | 
|  | 47 | + | 
|  | 48 | +Alternatively, to link a local copy of the repo: | 
|  | 49 | + | 
|  | 50 | +```sh | 
|  | 51 | +# Clone | 
|  | 52 | +$ git clone https://www.github.com/stainless-sdks/zeroentropy-node | 
|  | 53 | +$ cd zeroentropy-node | 
|  | 54 | + | 
|  | 55 | +# With yarn | 
|  | 56 | +$ yarn link | 
|  | 57 | +$ cd ../my-package | 
|  | 58 | +$ yarn link zeroentropy | 
|  | 59 | + | 
|  | 60 | +# With pnpm | 
|  | 61 | +$ pnpm link --global | 
|  | 62 | +$ cd ../my-package | 
|  | 63 | +$ pnpm link -—global zeroentropy | 
|  | 64 | +``` | 
|  | 65 | + | 
|  | 66 | +## Running tests | 
|  | 67 | + | 
|  | 68 | +Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. | 
|  | 69 | + | 
|  | 70 | +```sh | 
|  | 71 | +$ npx prism mock path/to/your/openapi.yml | 
|  | 72 | +``` | 
|  | 73 | + | 
|  | 74 | +```sh | 
|  | 75 | +$ yarn run test | 
|  | 76 | +``` | 
|  | 77 | + | 
|  | 78 | +## Linting and formatting | 
|  | 79 | + | 
|  | 80 | +This repository uses [prettier](https://www.npmjs.com/package/prettier) and | 
|  | 81 | +[eslint](https://www.npmjs.com/package/eslint) to format the code in the repository. | 
|  | 82 | + | 
|  | 83 | +To lint: | 
|  | 84 | + | 
|  | 85 | +```sh | 
|  | 86 | +$ yarn lint | 
|  | 87 | +``` | 
|  | 88 | + | 
|  | 89 | +To format and fix all lint issues automatically: | 
|  | 90 | + | 
|  | 91 | +```sh | 
|  | 92 | +$ yarn fix | 
|  | 93 | +``` | 
0 commit comments