Skip to content

Commit 8e0e114

Browse files
committed
document all scripts
1 parent 885c3b3 commit 8e0e114

File tree

1 file changed

+78
-5
lines changed

1 file changed

+78
-5
lines changed

.github/CONTRIBUTING.md

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
Thanks for your interest in contributing to Headless UI! Please take a moment to review this document **before submitting a pull request**.
44

5+
- [Pull requests](#pull-requests)
6+
- [Monorepo](#monorepo)
7+
- [Installation](#installation)
8+
- [Coding standards](#coding-standards)
9+
- [Running tests](#running-tests)
10+
- [Running playgrounds](#running-playgrounds)
11+
- [Scripts summary](#scripts-summary)
12+
513
## Pull requests
614

715
**Please ask first before starting work on any significant new features.**
@@ -11,22 +19,28 @@ Also make sure that you are making changes to both the `React` and `Vue` version
1119

1220
## Monorepo
1321

14-
The Headless UI repo is a monorepo using `yarn` workspaces. Note that we are using `yarn` version 1.
22+
The Headless UI repo is a monorepo using `yarn` workspaces. Note that we are using `yarn` **version 1**.
1523

16-
## Coding standards
24+
## Installation
1725

18-
Our code formatting rules are defined by TSDX, which uses `eslint` and we also use `prettier`. You can check your code against these standards by running:
26+
You only require a `yarn install` in the root directory to install everything you need.
1927

2028
```sh
21-
yarn lint
29+
yarn install
2230
```
2331

32+
## Coding standards
33+
34+
We use `prettier` for making sure that the codebase is formatted consistently.
2435
To automatically fix any style violations in your code, you can run:
2536

2637
```sh
27-
yarn lint --fix
38+
yarn lint
2839
```
2940

41+
**Note**: Whenever you commit, the lint check will run on all staged files.
42+
**Note**: In CI, we will only check your code, and not write with the formatted files. If you want to just check, then you can either run `yarn lint-check` or `CI=true yarn lint`
43+
3044
## Running tests
3145

3246
You can run the test suite using the following commands:
@@ -46,3 +60,62 @@ yarn vue test
4660
```
4761

4862
Please ensure that the tests are passing when submitting a pull request. If you're adding new features to Headless UI, please include tests.
63+
64+
## Running playgrounds
65+
66+
Currently the `React` playground (located in `packages/playground-react`) is a Next.js app that contains some examples which you can find in the `pages` directory. The `Vue` playground (located in `packages/playground-vue`) is a Vite app that contains some examples which you can find in the `src/components` directory.
67+
68+
You can launch them by running:
69+
70+
```sh
71+
yarn react playground
72+
73+
# or
74+
75+
yarn vue playground
76+
```
77+
78+
This will also start the necessary watchers so that you don't have to care about them.
79+
80+
## Scripts summary
81+
82+
Global scripts, and some aliases:
83+
84+
- `yarn install`: install all dependencies for all packages
85+
- `yarn clean`: this will call all `yarn {package} clean` commands
86+
- `yarn build`: this will call all `yarn {package} build` commands
87+
- `yarn lint`: this will `lint` all packages
88+
- `yarn test`: this will `test` all packages
89+
- `yarn test`: run all jest tests
90+
- `yarn test --watch`: run all jest tests in interactive mode
91+
- `yarn test tabs`: run all jest tests filtered by `tabs`
92+
- `yarn test tabs --watch`: run all jest tests in interactive mode filtered by `tabs`
93+
94+
Scripts per package:
95+
96+
- `yarn react`: Prefix to run anything in the `@headlessui/react` package
97+
- `yarn react test`: run all jest tests
98+
- `yarn react test --watch`: run all jest tests in interactive mode
99+
- `yarn react test tabs`: run all jest tests filtered by `tabs`
100+
- `yarn react test tabs --watch`: run all jest tests in interactive mode filtered by `tabs`
101+
- `yarn react build`: build the final artefacts
102+
- `yarn react lint`: validate and fix the react codebase using prettier
103+
- `yarn react watch`: start a watcher for the react esm build
104+
- **Note**: this will be executed for you when using the `yarn react playground`
105+
- **Note**: this is not required for jest. You will probably never need this
106+
- `yarn react playground`: (alias) start a development server in the `playground-react` package
107+
- **Note**: this will also run `yarn react watch` for you, which means that you only need to execute `yarn react playground`
108+
- `yarn react clean`: this will remove `dist` files
109+
- `yarn vue`: Prefix to run anything in the `@headlessui/vue` package
110+
- `yarn vue test`: run all jest tests
111+
- `yarn vue test --watch`: run all jest tests in interactive mode
112+
- `yarn vue test tabs`: run all jest tests filtered by `tabs`
113+
- `yarn vue test tabs --watch`: run all jest tests in interactive mode filtered by `tabs`
114+
- `yarn vue build`: build the final artefacts
115+
- `yarn vue lint`: validate and fix the vue codebase using prettier
116+
- `yarn vue watch`: start a watcher for the vue esm build
117+
- **Note**: this will be executed for you when using the `yarn vue playground`
118+
- **Note**: this is not required for jest. You will probably never need this
119+
- `yarn vue playground`: (alias) start a development server in the `playground-vue` package
120+
- **Note**: this will also run `yarn vue watch` for you, which means that you only need to execute `yarn react playground`
121+
- `yarn vue clean`: this will remove `dist` files

0 commit comments

Comments
 (0)