|
| 1 | +Thanks for showing interest to contribute to Chakra UI 💖, you rock! |
| 2 | + |
| 3 | +When it comes to open source, there are different ways you can contribute, all |
| 4 | +of which are valuable. Here's a few guidelines that should help you as you |
| 5 | +prepare your contribution. |
| 6 | + |
| 7 | +## Setup the Project |
| 8 | + |
| 9 | +The following steps will get you up and running to contribute to Chakra UI: |
| 10 | + |
| 11 | +1. Fork the repo (click the <kbd>Fork</kbd> button at the top right of |
| 12 | + [this page](https://github.com/chakra-ui/chakra-ui-vue-next)) |
| 13 | + |
| 14 | +2. Clone your fork locally |
| 15 | + |
| 16 | +```sh |
| 17 | +git clone https://github.com/<your_github_username>/chakra-ui-vue-next.git |
| 18 | +cd chakra-ui |
| 19 | +``` |
| 20 | + |
| 21 | +3. Setup all the dependencies and packages by running `yarn bootstrap`. This |
| 22 | + command will install dependencies and bootstrap the repo using `lerna` |
| 23 | + |
| 24 | +> If you run into any issues during this step, kindly reach out to the Chakra UI |
| 25 | +> Vue team here:[https://discord.gg/cMpMfvxa](https://discord.gg/cMpMfvxa) |
| 26 | +
|
| 27 | +## Development |
| 28 | + |
| 29 | +To improve our development process, we've set up tooling and systems. Chakra UI |
| 30 | +uses a monorepo structure and we treat each component as an independent package |
| 31 | +that can be consumed in isolation. |
| 32 | + |
| 33 | +### Tooling |
| 34 | + |
| 35 | +- [Lerna](https://lerna.js.org/) to manage installation of dependencies and |
| 36 | + running various scripts. We also have yarn workspaces enabled by default. |
| 37 | +- [Testing Library](https://testing-library.com/) for testing components and |
| 38 | + hooks |
| 39 | +- [Vite SSR](https://www.vitejs.org/) for a blazing fast documentation website. |
| 40 | + versioning and changelogs |
| 41 | +- [Changeset](https://github.com/atlassian/changesets) for changes |
| 42 | + documentation, changelog generation, and release management. |
| 43 | + |
| 44 | +### Commands |
| 45 | + |
| 46 | +**`yarn install`**: bootstraps the entire project, symlinks all dependencies for |
| 47 | +cross-component development and builds all components. |
| 48 | + |
| 49 | +**`yarn bootstrap`**: bootstraps the entire project and symlinks all |
| 50 | +dependencies for cross-component development. |
| 51 | + |
| 52 | +**`yarn dev`**: starts components playground server and loads stories in SFCs in the `packages/**/examples/*.vue` file. |
| 53 | + |
| 54 | +**`yarn docs:dev`**: run the documentation site locally. |
| 55 | + |
| 56 | +**`yarn docs:build`**: run build for all component packages. |
| 57 | + |
| 58 | +**`yarn test`**: run test for all component packages. |
| 59 | + |
| 60 | +**`yarn release`**: publish changed packages. |
| 61 | + |
| 62 | +**`yarn pkg [package] <cmd>`**: Run a command on the specific package you're |
| 63 | +working on. You can run `build`, `test`, `lint` commands. |
| 64 | + |
| 65 | +#### Package Aliasing and Yarn Workspace |
| 66 | + |
| 67 | +Since we're using lerna monorepo + yarn workspaces by default, this enables us |
| 68 | +to run commands within component packages directly from the root. |
| 69 | + |
| 70 | +Each component is named this way: `@chakra-ui/[component]`. Let's say we want to |
| 71 | +build the button component. Here's how to do it: |
| 72 | + |
| 73 | +> *Take note that in order to prevent template tags name clashing with HTML elements or other Vue library components,* |
| 74 | +> *we prefix all component names with a `c-` in kebab-case or a capital `C` in PascalCase.* |
| 75 | +
|
| 76 | +```bash |
| 77 | +yarn workspace @chakra-ui/c-button build |
| 78 | + |
| 79 | +# or |
| 80 | + |
| 81 | +lerna run build --scope @chakra-ui/c-button |
| 82 | +``` |
| 83 | + |
| 84 | +**Shortcut:** |
| 85 | +```bash |
| 86 | +# to build |
| 87 | +yarn pkg @chakra-ui/c-tabs build |
| 88 | + |
| 89 | +# to test |
| 90 | +yarn pkg @chakra-ui/c-tabs test |
| 91 | +yarn pkg @chakra-ui/c-tabs test --watch |
| 92 | + |
| 93 | +``` |
| 94 | + |
| 95 | +This alias is particularly useful when you're working on a specific component |
| 96 | +and want to avoid running the command for all components. |
| 97 | + |
| 98 | +### Documentation |
| 99 | + |
| 100 | +The documentation site is built with Vite.js on SSR. If you'd like to contribute to the |
| 101 | +docs, simply run `yarn build`, and `yarn docs:dev` |
| 102 | + |
| 103 | +### Components Development Playground |
| 104 | + |
| 105 | +Build components in isolation with Storybook using `yarn dev` |
| 106 | + |
| 107 | +## Think you found a bug? |
| 108 | + |
| 109 | +Please conform to the issue template and provide a clear path to reproduction |
| 110 | +with a code example. The best way to show a bug is by sending a CodeSandbox |
| 111 | +link. |
| 112 | + |
| 113 | +You may wish to use our starters to help you get going: |
| 114 | + |
| 115 | +TODO: Add Typescript starter for `@chakra-ui/vue` v1 |
| 116 | +TODO: Add Javascript starter for `@chakra-ui/vue` v1 |
| 117 | + |
| 118 | +## Proposing new or changed API? |
| 119 | + |
| 120 | +Please provide thoughtful comments and some sample API code. Proposals that |
| 121 | +don't line up with our roadmap or don't have a thoughtful explanation will be |
| 122 | +closed. |
| 123 | + |
| 124 | +## Making a Pull Request? |
| 125 | + |
| 126 | +Pull requests need only the :+1: of two or more collaborators to be merged; when |
| 127 | +the PR author is a collaborator, that counts as one. |
| 128 | + |
| 129 | +### Commit Convention |
| 130 | + |
| 131 | +Before you create a Pull Request, please check whether your commits comply with |
| 132 | +the commit conventions used in this repository. |
| 133 | + |
| 134 | +When you create a commit we kindly ask you to follow the convention |
| 135 | +`category(scope or module): message` in your commit message while using one of |
| 136 | +the following categories: |
| 137 | + |
| 138 | +- `feat / feature`: all changes that introduce completely new code or new |
| 139 | + features |
| 140 | +- `fix`: changes that fix a bug (ideally you will additionally reference an |
| 141 | + issue if present) |
| 142 | +- `refactor`: any code related change that is not a fix nor a feature |
| 143 | +- `docs`: changing existing or creating new documentation (i.e. README, docs for |
| 144 | + usage of a lib or cli usage) |
| 145 | +- `build`: all changes regarding the build of the software, changes to |
| 146 | + dependencies or the addition of new dependencies |
| 147 | +- `test`: all changes regarding tests (adding new tests or changing existing |
| 148 | + ones) |
| 149 | +- `ci`: all changes regarding the configuration of continuous integration (i.e. |
| 150 | + github actions, ci system) |
| 151 | +- `chore`: all changes to the repository that do not fit into any of the above |
| 152 | + categories |
| 153 | + |
| 154 | +If you are interested in the detailed specification you can visit |
| 155 | +https://www.conventionalcommits.org/ or check out the |
| 156 | +[Angular Commit Message Guidelines](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines). |
| 157 | + |
| 158 | +### Steps to PR |
| 159 | + |
| 160 | +1. Fork of the chakra-ui-vue repository and clone your fork |
| 161 | + |
| 162 | +2. Create a new branch out of the `main` branch. We follow the convention |
| 163 | + `[type/scope]`. For example `fix/accordion-hook` or `docs/menu-typo`. `type` |
| 164 | + can be either `docs`, `fix`, `feat`, `build`, or any other conventional |
| 165 | + commit type. `scope` is just a short id that describes the scope of work. |
| 166 | + |
| 167 | +3. Make and commit your changes following the |
| 168 | + [commit convention](https://github.com/chakra-ui/chakra-ui/blob/main/CONTRIBUTING.md#commit-convention). |
| 169 | + As you develop, you can run `yarn pkg <module> build` and |
| 170 | + `yarn pkg <module> test` to make sure everything works as expected. Please |
| 171 | + note that you might have to run `yarn boot` first in order to build all |
| 172 | + dependencies. |
| 173 | + |
| 174 | +4. Run `yarn changeset` to create a detailed description of your changes. This |
| 175 | + will be used to generate a changelog when we publish an update. |
| 176 | + [Learn more about Changeset](https://github.com/atlassian/changesets/tree/master/packages/cli). |
| 177 | + Please note that you might have to run `git fetch origin main:master` (where |
| 178 | + origin will be your fork on GitHub) before `yarn changeset` works. |
| 179 | + |
| 180 | +> If you made minor changes like CI config, prettier, etc, you can run |
| 181 | +> `yarn changeset add --empty` to generate an empty changeset file to document |
| 182 | +> your changes. |
| 183 | +
|
| 184 | +### Tests |
| 185 | + |
| 186 | +All commits that fix bugs or add features need a test. |
| 187 | + |
| 188 | +> **Dear Chakra UI Vue team:** Please do not merge code without tests |
| 189 | +
|
| 190 | +## Want to write a blog post or tutorial |
| 191 | + |
| 192 | +That would be amazing! Reach out to the Chakra UI Vue core team here: |
| 193 | +https://discord.gg/dQHfcWF. We would love to support you any way we can. |
| 194 | + |
| 195 | +## Want to help improve the docs? |
| 196 | + |
| 197 | +By default, the GitHub REST API has an anonymous user rate limit. This can be |
| 198 | +hit during heavy local docs development if the server is frequently restarted. |
| 199 | + |
| 200 | +Creating a GitHub token and storing it as the `GITHUB_TOKEN` environment |
| 201 | +variable allows the user to avoid the limit. |
| 202 | + |
| 203 | +Visit |
| 204 | +https://github.com/settings/tokens/new?description=Chakra+website+development to |
| 205 | +create a new personal access token. After creating the token, be sure to copy |
| 206 | +the token string to your clipboard. |
| 207 | + |
| 208 | +You'll then run the following command in the terminal that you'll start the docs |
| 209 | +from: |
| 210 | + |
| 211 | +```sh |
| 212 | +export GITHUB_TOKEN=<PASTE YOUR TOKEN HERE> |
| 213 | +``` |
| 214 | + |
| 215 | +## License |
| 216 | + |
| 217 | +By contributing your code to the chakra-ui-vue GitHub repository, you agree to |
| 218 | +license your contribution under the MIT license. |
0 commit comments