|
| 1 | +# Contributing to OpenSea Stream API JS SDK |
| 2 | + |
| 3 | +## Developing |
| 4 | + |
| 5 | +We PR off of feature branches that get submitted to `main`. This is the branch that all pull |
| 6 | +requests should be made against. Version releases are bumped using `npm version patch`. Make sure to include the `Developer-Experience` team on any PR you submit. |
| 7 | + |
| 8 | +To develop locally: |
| 9 | + |
| 10 | +1. [clone](https://help.github.com/articles/cloning-a-repository/) this repo to your local device. |
| 11 | + |
| 12 | + ```sh |
| 13 | + git clone https://github.com/ProjectOpenSea/stream-js |
| 14 | + ``` |
| 15 | + |
| 16 | +2. Create a new branch: |
| 17 | + ``` |
| 18 | + git checkout -b MY_BRANCH_NAME |
| 19 | + ``` |
| 20 | +3. If you have Node Version Manager, run `nvm use` to ensure a compatible version is being used. |
| 21 | + |
| 22 | +4. Install the dependencies with: |
| 23 | + ``` |
| 24 | + npm install |
| 25 | + ``` |
| 26 | +5. Start developing and watch for code changes: |
| 27 | + ``` |
| 28 | + npm run dev |
| 29 | + ``` |
| 30 | +6. Look into `package.json` to see what other run configurations (such as `test`, `check-types`, and `lint:check`) you can use. |
| 31 | + |
| 32 | +## Building |
| 33 | + |
| 34 | +You can build the project, including all type definitions, with: |
| 35 | + |
| 36 | +```bash |
| 37 | +npm run build |
| 38 | +``` |
| 39 | + |
| 40 | +### Running tests |
| 41 | + |
| 42 | +```sh |
| 43 | +yarn test |
| 44 | +``` |
| 45 | + |
| 46 | +### Linting |
| 47 | + |
| 48 | +To check the formatting of your code: |
| 49 | + |
| 50 | +```sh |
| 51 | +npm run prettier |
| 52 | +``` |
| 53 | + |
| 54 | +If you get errors, you can fix them with: |
| 55 | + |
| 56 | +```sh |
| 57 | +npm run prettier:fix |
| 58 | +``` |
| 59 | + |
| 60 | +### Set as a local dependency in package.json |
| 61 | + |
| 62 | +While developing and debugging changes to this SDK, you can 'test-run' them locally inside another package using `npm link`. |
| 63 | + |
| 64 | +1. Inside this repo, run |
| 65 | + |
| 66 | + ```sh |
| 67 | + npm link |
| 68 | + ``` |
| 69 | + |
| 70 | +2. In your other package's root directory, make sure to remove `@opensea/stream-js` from `node_modules` with: |
| 71 | + |
| 72 | + ```sh |
| 73 | + rm -rf ./node_modules/@opensea/stream-js |
| 74 | + ``` |
| 75 | + |
| 76 | +3. In your other package's root directory, run: |
| 77 | + |
| 78 | + ```sh |
| 79 | + npm link @opensea/stream-js |
| 80 | + ``` |
| 81 | + |
| 82 | + to re-install all of the dependencies. |
| 83 | + |
| 84 | + Note that this SDK will be copied from the locally compiled version as opposed to from being downloaded from the NPM registry. |
| 85 | + |
| 86 | +4. Run your application as you normally would. |
| 87 | + |
| 88 | +## Publishing |
| 89 | + |
| 90 | +Repository admins can use `npm version patch` to create a new patch version. |
| 91 | + |
| 92 | +- For minor version updates, use `npm version minor`. |
| 93 | +- For major version updates, use `npm version major`. |
| 94 | + |
| 95 | +When creating a new version, submit a PR listing all the chanages that you'd like to roll out with this change (since the last major version). |
0 commit comments