|
| 1 | +# Contributing |
| 2 | + |
| 3 | +## Development workflow |
| 4 | + |
| 5 | +To get started with the project, run `yarn` in the root directory to install the required dependencies: |
| 6 | + |
| 7 | +```sh |
| 8 | +yarn |
| 9 | +``` |
| 10 | + |
| 11 | +We use [storybook](https://storybook.js.org/docs) for components development. To run storybook execute |
| 12 | + |
| 13 | +```sh |
| 14 | +yarn dev |
| 15 | +``` |
| 16 | + |
| 17 | +## Linting and tests |
| 18 | + |
| 19 | +We use [TypeScript](https://www.typescriptlang.org/) for type checking |
| 20 | + |
| 21 | +```sh |
| 22 | +yarn type-check |
| 23 | +``` |
| 24 | + |
| 25 | +[ESLint](https://eslint.org/) for linting the code |
| 26 | + |
| 27 | +```sh |
| 28 | +yarn lint |
| 29 | +``` |
| 30 | + |
| 31 | +and [Prettier](https://prettier.io/) for formatting the code |
| 32 | + |
| 33 | +```sh |
| 34 | +yarn format |
| 35 | +``` |
| 36 | + |
| 37 | +> [!TIP] Pre-commit hook |
| 38 | +> |
| 39 | +> Our pre-commit hooks verify that the linter and format pass when committing. |
| 40 | +
|
| 41 | +We use [Chromatic](https://www.chromatic.com/docs/) for visual testing and UI regression. |
| 42 | + |
| 43 | +Our storybook is published to Chromatic and accessible by following: [https://storybook.lw.iog.io/](https://storybook.lw.iog.io/) |
| 44 | + |
| 45 | +## Commit message convention |
| 46 | + |
| 47 | +We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: |
| 48 | + |
| 49 | +- `fix`: bug fixes, e.g. fix crash due to deprecated method. |
| 50 | +- `feat`: new features, e.g. add new method to the module. |
| 51 | +- `docs`: changes into documentation, e.g. add usage example for the module.. |
| 52 | +- `style`: formatting, code style. |
| 53 | +- `refactor`: code refactor, e.g. migrate from class components to hooks. |
| 54 | +- `test`: adding or updating tests, e.g. add integration tests using detox. |
| 55 | +- `ci`: changes to continuous integration, pipelines, workflows. |
| 56 | +- `chore`: other changes not affecting functionality. |
| 57 | + |
| 58 | +> [!TIP] Pre-commit hook |
| 59 | +> |
| 60 | +> Our pre-commit hooks verify that your commit message matches this format when committing. |
| 61 | +
|
| 62 | +### How to write good commit message |
| 63 | + |
| 64 | +**Write the summary line of what you have done in the imperative mood**, that is as if you were |
| 65 | +commanding someone. |
| 66 | + |
| 67 | +Start the line with `fix`, `add`, `change` instead of ~~`fixed`~~, ~~`added`~~, ~~`changed`~~. |
| 68 | + |
| 69 | +Don’t end the summary line with a period`.`. |
| 70 | + |
| 71 | +## Code Review |
| 72 | + |
| 73 | +During the code review, we aim to improve the overall product quality. |
| 74 | + |
| 75 | +- Reviews should be concise and written in neutral language. Critique the code, not the author, and be respectful. |
| 76 | +- Over-communicate your thoughts in the initial message, as it saves time on back and forth communication cycles. |
| 77 | + |
| 78 | +### Merge Review |
| 79 | + |
| 80 | +The PR commit messages plays an essential role in our versioning and publishing process. Rebase your branch with main to keep your code in sync and to have a linear commits history. |
| 81 | + |
| 82 | +Create atomic commits which focuses on single thing at a time, and write good commit message, so it is self-contained and explanatory. |
| 83 | + |
| 84 | +## Versioning and Publishing |
| 85 | + |
| 86 | +We follow [semantic versioning](https://semver.org/) and use [semantic release](https://github.com/semantic-release/semantic-release) for automatic versioning and publishing npm package to [GitHub Package Registry](https://github.com/input-output-hk/lace-ui-toolkit/pkgs/npm/lace-ui-toolkit). |
| 87 | + |
| 88 | +> [!IMPORTANT] |
| 89 | +> |
| 90 | +> It's important to follow [Commit message convention](#commit-message-convention), so semantic-release can automatically determine the right version to be published to registry. |
| 91 | +
|
| 92 | +## Useful links |
| 93 | + |
| 94 | +- [Auto-squashing Git Commits](https://thoughtbot.com/blog/autosquashing-git-commits) |
| 95 | +- [Code Review Developer Guide](https://google.github.io/eng-practices/review/) |
| 96 | +- [Respectful Code Reviews](https://chromium.googlesource.com/chromium/src/+/master/docs/cr_respect.md) |
0 commit comments