|
| 1 | +# React (v16.8.0-alpha.0), Typescript, Yarn & Lerna Monorepo |
| 2 | + |
| 3 | +Starting point for a Typescript, React (v16.8.0-alpha.0), Yarn & Lerna monorepo project with full setup for ESLint and Prettier. |
| 4 | + |
| 5 | +## Stack |
| 6 | + |
| 7 | +This project is initialized with [Create React App](https://github.com/facebook/create-react-app) consisting of: |
| 8 | + |
| 9 | +- TypeScript |
| 10 | +- React (v16.8.0-alpha.0) |
| 11 | +- react-scripts (react-scripts v2.1.3 from createReactApp) |
| 12 | +- react-testing-library (not Enzyme) |
| 13 | +- Yarn Workspaces (multiple packages architecture) |
| 14 | +- Lerna (tool for managing the monorepo packages) |
| 15 | +- SASS/SCSS |
| 16 | +- ESLint (instead of deprecated TSLint) |
| 17 | +- Prettier |
| 18 | + |
| 19 | +### Content |
| 20 | + |
| 21 | +The project now consists of 3 packages. |
| 22 | + |
| 23 | +- www: create-react-app with TypeScript (react v16.8.0-alpha.0, react-scripts v2.1.3) |
| 24 | +- shared: react components with TypeScript (react v16.8.0-alpha.0) |
| 25 | +- utils: shared functions with TypeScript |
| 26 | + |
| 27 | +## Get Started |
| 28 | + |
| 29 | +### Make sure you run Node.js v10+ |
| 30 | + |
| 31 | +To install check ([Node.js installation](https://nodejs.org/en/) or [Node Version Manager installation](https://github.com/nvm-sh/nvm)). |
| 32 | + |
| 33 | +### Clone or copy this repo |
| 34 | + |
| 35 | +```bash |
| 36 | +curl -L https://github.com/michielbouw/react-typescript-yarn-lerna-monorepo-eslint-prettier-boilerplate/archive/master.zip | tar zx |
| 37 | +mv react-typescript-eslint-prettier-boilerplate APP_NAME |
| 38 | +cd APP_NAME |
| 39 | +``` |
| 40 | + |
| 41 | +or |
| 42 | + |
| 43 | +```bash |
| 44 | +git clone [email protected]:michielbouw/react-typescript-yarn-lerna-monorepo-eslint-prettier-boilerplate.git APP_NAME |
| 45 | +cd APP_NAME |
| 46 | +``` |
| 47 | + |
| 48 | +### `yarn install` |
| 49 | + |
| 50 | +Note: this project is initialized with Yarn. |
| 51 | + |
| 52 | +### Adding / removing packages |
| 53 | + |
| 54 | +To add a new package |
| 55 | + |
| 56 | +After changing the packages run `yarn clean && npx lerna bootstrap` to clean & reinit the workspaces. |
| 57 | + |
| 58 | +## Development Scripts |
| 59 | + |
| 60 | +In the project directory, you can run: |
| 61 | + |
| 62 | +### `yarn start` |
| 63 | + |
| 64 | +Runs the app in the development mode.<br> |
| 65 | +Open [http://localhost:3000](http://localhost:3000) to view it in the browser. |
| 66 | + |
| 67 | +The page will reload if you make edits.<br> |
| 68 | +You will also see any lint errors in the console. |
| 69 | + |
| 70 | +### `yarn typecheck` |
| 71 | + |
| 72 | +Launches the typescript check for code to check for TypeScript compilation errors or warnings. |
| 73 | + |
| 74 | +### `yarn lint` |
| 75 | + |
| 76 | +Launches the linter for code to check for code layout errors or warnings. |
| 77 | + |
| 78 | +### `yarn lint:fix` |
| 79 | + |
| 80 | +Launches the linter for code to check for code layout errors or warnings, and fixes the ones that can be fixed automatically. |
| 81 | + |
| 82 | +### `yarn test` |
| 83 | + |
| 84 | +Launches the test runner in the interactive watch mode.<br> |
| 85 | +See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. |
| 86 | + |
| 87 | +## Production Scripts |
| 88 | + |
| 89 | +### `yarn build` |
| 90 | + |
| 91 | +Builds the app for production to the build folder.<br> |
| 92 | +It correctly bundles React in production mode and optimizes the build for the best performance. |
| 93 | + |
| 94 | +The build is minified and the filenames include the hashes.<br> |
| 95 | +Your app is ready to be deployed! |
| 96 | + |
| 97 | +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. |
| 98 | + |
| 99 | +## Learn More |
| 100 | + |
| 101 | +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). |
| 102 | + |
| 103 | +To learn React, check out the [React documentation](https://reactjs.org/). |
0 commit comments