1
0
Fork 0
This commit is contained in:
Travis Fischer 2018-03-04 15:49:34 -05:00 committed by Joost De Cock
parent 907845feb1
commit 5050f9f7b6

View file

@ -42,30 +42,28 @@ react-modern-library-cli
After you answer some basic prompts about your module, the CLI will perform the following:
- copy over the template to a new folder in the current directory
- initialize yarn or npm package manager
- install dependencies via yarn or npm
- link packages together for development
- initialize local git repo
At this point, you're new module is all setup for local development.
At this point, your new module is all setup for local development.
## Development
#### Local Development
Local development is broken into two parts.
Note: if you're using yarn, you can skip the `yarn link` steps, as the generated module's example includes a local-link by default.
First, you'll run rollup to watch your `src/` module and automatically recompile it into `dist/` whenever you make changes.
```bash
npm start # runs rollup with watch flag => dist
npm start # runs rollup with watch flag
```
The second part will be running our `example/` create-react-app that's linked to the local version of your module.
The second part will be running the `example/` create-react-app that's linked to the local version of your module.
```bash
# (in another tab)
cd example
npm link <your-module-name> # you may skip this if using yarn
npm link <your-module-name> # optional if using yarn
npm start # runs create-react-app dev server
```
@ -73,6 +71,8 @@ Now, anytime you make a change to your component in `src/` or to the example app
![](https://media.giphy.com/media/12NUbkX6p4xOO4/giphy.gif)
Note: if you're using yarn, there is no need to use `yarn link`, as the generated module's example includes a local-link by default.
#### NPM Stuffs
The only difference when publishing your component to **npm** is to make sure you add any npm modules you want as peer dependencies are properly marked as `peerDependencies` in `package.json`. The rollup config will automatically recognize them as peer dependencies and not try to bundle them in your module.