diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d31646eaa5..b5c240e326 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,7 @@ Please read https://reactjs.org/ and the Code of Conduct before opening an issue - [Proposing New or Changed API?](#api) - [Issue Not Getting Attention?](#attention) - [Making a Pull Request?](#pr) +- [Setup](#setup) - [Development](#development) - [Hacking](#hacking) @@ -45,10 +46,48 @@ All commits that change or add to the API must be done in a pull request that al - Updates examples - Updates the docs +## Setup + +The following steps will get you setup to contribute changes to this repo: + +1. Fork the repo (click the Fork button at the top right of this page). +2. Clone your fork locally. +```bash +# in a terminal, cd to parent directory where you want your clone to be, then +git clone https://github.com//react-router.git +cd react-router +``` +3. Install dependencies and build. React Router uses `npm`, so you should too. If you install using `yarn`, unnecessary yarn lock files will be generated. +```bash +npm install +npm run build +``` + ## Development -- `npm test` starts a karma test runner and watch for changes -- `npm start` starts a webpack dev server that will watch for changes and build the examples +### Packages + +React Router uses a monorepo to host code for multiple packages. These packages live in the `packages` directory. + +### Testing + +Calling `npm test` from the root directory will run **every** package's tests. If you want to run tests for a specific package, you should `cd` into that directory. +```bash +# all tests +npm test +# react-router-dom tests +cd packages/react-router-dom +npm test +``` +React Router uses Jest to run its tests, so you can provide the `--watch` flag to automatically re-run tests when files change. + +### Website + +The code for the documentation website lives in the `website` directory. `cd` into there and call `npm start` to start a webpack dev server on `localhost:8080` that will watch for changes. +```bash +cd website +npm start +``` ## Hacking