Skip to content

Commit 2f48792

Browse files
committed
chore: setup docs for contribution
1 parent e8694b0 commit 2f48792

19 files changed

+574
-69
lines changed

CODE_OF_CONDUCT.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to make participation in our project and our
7+
community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and
9+
expression, level of experience, education, socio-economic status, nationality,
10+
personal appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or reject
41+
comments, commits, code, wiki edits, issues, and other contributions that are
42+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
43+
contributor for other behaviors that they deem inappropriate, threatening,
44+
offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at **[email protected]**. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an
62+
incident. Further details of specific enforcement policies may be posted
63+
separately.
64+
65+
Project maintainers who do not follow or enforce the Code of Conduct in good
66+
faith may face temporary or permanent repercussions as determined by other
67+
members of the project's leadership.
68+
69+
## Attribution
70+
71+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
72+
version 1.4, available at
73+
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
74+
75+
[homepage]: https://www.contributor-covenant.org
76+
77+
For answers to common questions about this code of conduct, see
78+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

+218
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
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.

README.md

+1-34
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,9 @@ yarn dev
2626

2727
## Development Guide
2828
### Major todos:
29-
- [ ] Documentation (to be based on Nuxt 3)
29+
- [ ] Documentation
3030
- [ ] Accessibility JS hooks (Documented in Roadmap)
3131

32-
### Creating new components
33-
Chakra UI Vue uses [hygen](https://www.hygen.io/) to generate new components. The component templates can be found in the `_templates/generator/component` directory.
34-
35-
* Run the hygen command to generate your new component.
36-
```bash
37-
yarn hygen generator component --name <COMPONENT_NAME> --description="MY_COMPONENT_DESCRIPTION"
38-
```
39-
This creates a new package with the name `<COMPONENT_NAME>` with some basic sanity tests.
40-
41-
* Run `yarn workspace @chakra-ui/COMPONENT_NAME build && yarn bootstrap` to build and link your component in the monorepo.
42-
43-
* Add the script for your package workspace in the global `package.json` file. `"COMPONENT_NAME": "yarn workspace @chakra-ui/COMPONENT_NAME",` goes under `scripts`.
44-
45-
* Before you can play around with your new component in the playground you will have to export your component from the `@chakra-ui/vue-next` package in the `core` directory under `packages`.
46-
47-
* Inside the `index.ts` file, you will have to add `export * from '@chakra-ui/COMPONENT_NAME'`.
48-
49-
* Your component also needs to be added as a dependency inside the `package.json` of the `@chakra-ui/vue-next` package as following:
50-
```jsx
51-
"dependencies": {
52-
...
53-
"@chakra-ui/COMPONENT_NAME": "*",
54-
...
55-
}
56-
```
57-
58-
* Run `yarn core build` and then `yarn dev` to view your new component in the playground.
59-
60-
* When you make changes to your component, you will need to rebuild your package to have the changes applied in for example the playground `yarn workspace @chakra-ui/COMPONENT_NAME build` or `yarn COMPONENT_NAME build`. Alternatively, you can use the watch command. `yarn workspace @chakra-ui/COMPONENT_NAME watch` or `yarn COMPONENT_NAME watch`.
61-
62-
**Additional notes:**
63-
Add a script for your package workspace in the `package.json` file.
64-
6532
### Creating a new commit message
6633
The commits follow the [conventional commit format](https://www.conventionalcommits.org/). Husky is setup to lint your commit messages to match this format.
6734
```bash

_templates/generator/component/component.ts.ejs.t

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ to: packages/<%=h.changeCase.paramCase(name)%>/src/<%=h.changeCase.paramCase(nam
55
import { h, defineComponent, PropType } from 'vue'
66
import { chakra, DOMElements } from '@chakra-ui/vue-system'
77

8-
const <%= h.changeCase.pascalCase(name) %> = defineComponent({
8+
export const <%= h.changeCase.pascalCase(name) %> = defineComponent({
99
props: {
1010
as: {
1111
type: [Object, String] as PropType<DOMElements>,
@@ -16,5 +16,3 @@ const <%= h.changeCase.pascalCase(name) %> = defineComponent({
1616
return () => h(chakra(props.as), { ...attrs }, slots)
1717
},
1818
})
19-
20-
export default <%= h.changeCase.pascalCase(name) %>

_templates/generator/component/index.ts.ejs.t

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
to: packages/<%=h.changeCase.paramCase(name)%>/src/index.ts
33
---
44

5-
export { default as <%= h.changeCase.pascalCase(name) %> } from './<%=h.changeCase.paramCase(name)%>'
5+
export * from './<%=h.changeCase.paramCase(name)%>'

0 commit comments

Comments
 (0)