|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thank you for considering contributing to `@txnlab/nfd-sdk`! |
| 4 | + |
| 5 | +> **Note:** This SDK is in early development (pre-v1.0.0) and there are many features that are planned and soon to be added. In some cases, a feature you're considering proposing may already be in the works. Feel free to open an issue to discuss before investing significant time in implementation. |
| 6 | +
|
| 7 | +## Reporting Issues |
| 8 | + |
| 9 | +If you have found an issue with `@txnlab/nfd-sdk`, please follow these steps: |
| 10 | + |
| 11 | +- Provide a clear description of the issue, including the expected behavior and the actual behavior. |
| 12 | +- Provide the version of `@txnlab/nfd-sdk` you are using and any other relevant context about your environment. |
| 13 | +- Describe the exact steps which reproduce the problem in as much detail as possible. |
| 14 | +- To help triage and fix the issue quickly, please provide a minimal reproducible example. |
| 15 | + |
| 16 | +To create a shareable code example, you can use CodeSandbox (https://codesandbox.io/s/new) or Stackblitz (https://stackblitz.com/). |
| 17 | + |
| 18 | +A public GitHub repository also works. 👌 |
| 19 | + |
| 20 | +Please ensure that the reproduction is as minimal as possible. For more information on how to create a minimal reproducible example, please refer to [this guide](https://stackoverflow.com/help/minimal-reproducible-example). |
| 21 | + |
| 22 | +## Suggesting New Features |
| 23 | + |
| 24 | +If you would like to suggest a new feature or enhancement for `@txnlab/nfd-sdk`, please follow these guidelines: |
| 25 | + |
| 26 | +- Use a clear and descriptive title for the issue to identify the suggestion. |
| 27 | +- Provide a step-by-step description of the suggested enhancement in as many details as possible. |
| 28 | +- Provide specific examples to demonstrate the steps or point out the part of `@txnlab/nfd-sdk` where the enhancement could be implemented. |
| 29 | + |
| 30 | +## Development |
| 31 | + |
| 32 | +If you want to contribute to `@txnlab/nfd-sdk`, please follow these steps to get started: |
| 33 | + |
| 34 | +- Fork the repository. |
| 35 | +- Clone the repository. |
| 36 | +- Create a new branch from `main` using the following naming convention: |
| 37 | + |
| 38 | + - For features: `feature/my-awesome-feature` |
| 39 | + - For bug fixes: `fix/my-bug-fix` |
| 40 | + |
| 41 | +- Install dependencies. |
| 42 | + |
| 43 | + ```bash |
| 44 | + pnpm install |
| 45 | + ``` |
| 46 | + |
| 47 | + - We use pnpm v9 as our package manager. If you are not familiar with pnpm, please refer to the [pnpm documentation](https://pnpm.io/cli/install). |
| 48 | + |
| 49 | + - We use [nvm](https://github.com/nvm-sh/nvm) to manage node versions. Please make sure to use the version mentioned in the `.nvmrc` file. |
| 50 | + |
| 51 | + ```bash |
| 52 | + nvm use |
| 53 | + ``` |
| 54 | + |
| 55 | +- Build the SDK. |
| 56 | + |
| 57 | + ```bash |
| 58 | + pnpm build |
| 59 | + ``` |
| 60 | + |
| 61 | +- Implement your changes and tests to files in the `packages/sdk/src/` directory and corresponding test files. |
| 62 | + |
| 63 | +- Git stage your changes and commit (see commit guidelines below). |
| 64 | + |
| 65 | +- Submit PR for review (see PR guidelines below). |
| 66 | + |
| 67 | +### Running Examples |
| 68 | + |
| 69 | +- Make sure you have installed dependencies in the repository's root directory. |
| 70 | + |
| 71 | + ```bash |
| 72 | + pnpm install |
| 73 | + ``` |
| 74 | + |
| 75 | +- If you want to run an example against your local changes, navigate to the project in the `examples/` directory and run the following command: |
| 76 | + |
| 77 | + ```bash |
| 78 | + pnpm dev |
| 79 | + ``` |
| 80 | + |
| 81 | +## Git Commit Guidelines |
| 82 | + |
| 83 | +`TxnLab/nfd-sdk` is using [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines). |
| 84 | + |
| 85 | +We have very precise rules over how our git commit messages can be formatted. This leads to **more readable messages** that are easy to follow when looking through the **project history**. |
| 86 | + |
| 87 | +### Commit Message Format |
| 88 | + |
| 89 | +Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a **type**, a **scope** and a **subject**: |
| 90 | + |
| 91 | +``` |
| 92 | +<type>(<scope>): <subject> |
| 93 | +<BLANK LINE> |
| 94 | +<body> |
| 95 | +<BLANK LINE> |
| 96 | +<footer> |
| 97 | +``` |
| 98 | + |
| 99 | +The **header** is mandatory and the **scope** of the header is optional. |
| 100 | + |
| 101 | +Any line of the commit message cannot be longer than 100 characters! This allows the message to be easier to read on GitHub as well as in various git tools. |
| 102 | + |
| 103 | +### Type |
| 104 | + |
| 105 | +Must be one of the following: |
| 106 | + |
| 107 | +- **feat**: A new feature |
| 108 | +- **fix**: A bug fix |
| 109 | +- **docs**: Documentation only changes |
| 110 | +- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) |
| 111 | +- **refactor**: A code change that neither fixes a bug nor adds a feature |
| 112 | +- **perf**: A code change that improves performance |
| 113 | +- **test**: Adding missing or correcting existing tests |
| 114 | +- **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation |
| 115 | + |
| 116 | +### Scope |
| 117 | + |
| 118 | +The scope could be anything specifying the place of the commit change. For example `core`, `api`, or `contracts`. |
| 119 | + |
| 120 | +You can use `*` when the change affects more than a single scope. |
| 121 | + |
| 122 | +### Subject |
| 123 | + |
| 124 | +The subject contains a succinct description of the change: |
| 125 | + |
| 126 | +- use the imperative, present tense: "change" not "changed" nor "changes" |
| 127 | +- don't capitalize first letter |
| 128 | +- no dot (.) at the end |
| 129 | + |
| 130 | +### Body |
| 131 | + |
| 132 | +Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior. |
| 133 | + |
| 134 | +### Footer |
| 135 | + |
| 136 | +The footer should contain any information about **Breaking Changes** and is also the place to reference GitHub issues that this commit closes. |
| 137 | + |
| 138 | +**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this. |
| 139 | + |
| 140 | +### Revert |
| 141 | + |
| 142 | +If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted. |
| 143 | + |
| 144 | +## Pull Requests |
| 145 | + |
| 146 | +- Pull requests will not be reviewed until all checks pass. Before submitting a pull request, ensure that you have run the following commands in the repository's root directory: |
| 147 | + |
| 148 | + ```bash |
| 149 | + pnpm lint |
| 150 | + ``` |
| 151 | + |
| 152 | + ```bash |
| 153 | + pnpm format |
| 154 | + ``` |
| 155 | + |
| 156 | + ```bash |
| 157 | + pnpm typecheck |
| 158 | + ``` |
| 159 | + |
| 160 | + ```bash |
| 161 | + pnpm test |
| 162 | + ``` |
| 163 | + |
| 164 | +- If possible/appropriate, create new tests that fail without your changes and pass with them. |
| 165 | + |
| 166 | +- Pull requests are merged by squashing all commits and editing the commit message if necessary using the GitHub user interface. |
| 167 | + |
| 168 | +- Use an appropriate commit type. Be especially careful with breaking changes. |
| 169 | + |
| 170 | +## Documentation |
| 171 | + |
| 172 | +Documentation is available in the repository README and code comments. For documentation issues and feature requests, please [open an issue](https://github.com/txnlab/nfd-sdk/issues/new). |
| 173 | + |
| 174 | +## Contact |
| 175 | + |
| 176 | +If you have any questions, please join the NFDomains [Discord server](https://discord.gg/7XcuMTfeZP). |
| 177 | + |
| 178 | +Thank you for contributing to `@txnlab/nfd-sdk`! |
0 commit comments