|
| 1 | +# Contributing Guide |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the Phase Node.js SDK! We welcome all contributions, whether it's fixing bugs, adding new features, or improving documentation. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +1. **Fork the repository** on GitHub. |
| 8 | +2. **Clone your fork** to your local machine: |
| 9 | + ```sh |
| 10 | + git clone https://github.com/your-username/node-sdk.git |
| 11 | + cd node-sdk |
| 12 | + ``` |
| 13 | +3. **Install dependencies**: |
| 14 | + ```sh |
| 15 | + yarn install |
| 16 | + ``` |
| 17 | +4. **Build the package**: |
| 18 | + ```sh |
| 19 | + yarn build |
| 20 | + ``` |
| 21 | +5. **Run tests**: |
| 22 | + ```sh |
| 23 | + yarn test |
| 24 | + ``` |
| 25 | + |
| 26 | +## Making Changes |
| 27 | + |
| 28 | +- Follow the existing code style (Prettier and ESLint are configured). |
| 29 | +- Write clear commit messages following the [Conventional Commits](https://www.conventionalcommits.org/) format. |
| 30 | +- Ensure all tests pass before submitting a pull request. |
| 31 | +- If adding a new feature, consider writing tests to cover your changes. |
| 32 | +- Consider if your changes require an update to [docs](https://github.com/phasehq/docs). |
| 33 | +- Bump the package version in `package.json` and `version.ts`. Use the semver standard to bump the major, minor or patch version depending on the type of change you're making. |
| 34 | + |
| 35 | +## Setting Up a Test Project |
| 36 | + |
| 37 | +To test your local changes in a real project, follow these steps: |
| 38 | + |
| 39 | +1. **Create a new test project:** |
| 40 | + ```sh |
| 41 | + mkdir test-project && cd test-project |
| 42 | + yarn init -y |
| 43 | + ``` |
| 44 | + |
| 45 | +2. **Link the local SDK package:** |
| 46 | + In the SDK root, run: |
| 47 | + ```sh |
| 48 | + yarn link |
| 49 | + ``` |
| 50 | + Then in your test project, |
| 51 | + ```sh |
| 52 | + yarn link '@phase.dev/phase-node' |
| 53 | + ``` |
| 54 | + |
| 55 | + |
| 56 | +3. **Use the SDK in your test project:** |
| 57 | + ```js |
| 58 | + const Phase = require('@phase.dev/phase-node') |
| 59 | + ``` |
| 60 | + |
| 61 | +## Submitting a Pull Request |
| 62 | + |
| 63 | +1. **Create a new branch:** |
| 64 | + ```sh |
| 65 | + git checkout -b feature/your-feature |
| 66 | + ``` |
| 67 | +2. **Make and commit your changes:** |
| 68 | + ```sh |
| 69 | + git commit -m "feat: add new feature" |
| 70 | + ``` |
| 71 | +3. **Push to your fork:** |
| 72 | + ```sh |
| 73 | + git push origin feature/your-feature |
| 74 | + ``` |
| 75 | +4. **Open a Pull Request** on GitHub against the `main` branch. |
| 76 | + |
| 77 | +## Useful Links |
| 78 | + |
| 79 | +[Phase Quickstart](https://docs.phase.dev/quickstart) |
| 80 | + |
| 81 | +[SDK Docs](https://docs.phase.dev/sdks/node) |
| 82 | + |
| 83 | +[Docs repo](https://github.com/phasehq/docs) |
| 84 | + |
| 85 | +[Community Slack](https://slack.phase.dev) |
| 86 | + |
| 87 | + |
0 commit comments