reactifire v1.0.6
npm-cli
CLI for easily publishing modern React libraries with Rollup and example usage via create-react-app.
Intro
The purpose of this CLI is to make publishing our own React components as simple as possible.
Features
- Easy-to-use CLI
- Handles all modern JS features
- Bundles
cjs
andes
module formats - create-react-app for example usage and local dev
- Rollup for build process
- Babel for transpilation
- Jest for testing
- uses storybook
- handles scss files
Prerequisite :
- use yarn
Install
yarn global add @cheetahdigital/npm-cli
ou
npm install -g @cheetahdigital/npm-cli
Creating a New Module
npm-cli
Answer some basic prompts about your module, and then the CLI will perform the following steps:
- copy over the template to a new folder in the current directory
- install dependencies via yarn
- link packages together for local development
- initialize local git repo
At this point, the new module is all setup for local development.
Development
Local development is broken into two parts.
First, you'll run rollup to watch your src/
module and automatically recompile it into dist/
whenever you make changes.
yarn start # runs rollup with watch flag
The second part will be running the example/
create-react-app that's linked to the local version of your module.
cd example
yarn start # runs create-react-app dev server
The third one is for storybook :
yarn storybook
Now, anytime you make a change to your component in src/
or to the example app's example/src
, create-react-app
will live-reload your local dev server so you can iterate on your component in real-time.
License
MIT © Maximilien Garenne
Special Thx to Travis Fischer, this project is a fork of his repo