|
| 1 | +## Reactful |
| 2 | + |
| 3 | +A very opinionated React CLI. You can use it to generate an independent full-stack react application that's fully-configured to render on both client and server. |
| 4 | + |
| 5 | +[](https://badge.fury.io/js/reactful) |
| 6 | + |
| 7 | +This CLI requires Node 8.0 or greater, and it would work better if you have [Yarn](https://yarnpkg.com/en/) and [Git](https://git-scm.com/) on the machine. |
| 8 | + |
| 9 | +### Install |
| 10 | + |
| 11 | + npm i -g reactful |
| 12 | + |
| 13 | +Once installed, the package will have a global ```react``` command. |
| 14 | + |
| 15 | +### Create New React App |
| 16 | + |
| 17 | + react new my-awesome-react-app-name |
| 18 | + |
| 19 | +Once created, you'll see instructions on how to start it: |
| 20 | + |
| 21 | + cd my-awesome-react-app-name |
| 22 | + |
| 23 | + ### To start the app (for development): |
| 24 | + react start |
| 25 | + |
| 26 | + # The start command starts a watcher process |
| 27 | + # which will restart node/webpack on save |
| 28 | + |
| 29 | + ### Open the app in browser: |
| 30 | + react open |
| 31 | + |
| 32 | + # The app will be running on localhost:4242 by default |
| 33 | + |
| 34 | + ### To run tests: |
| 35 | + react test |
| 36 | + |
| 37 | + ### To build for production: |
| 38 | + react build |
| 39 | + |
| 40 | + ### To start the app for production: |
| 41 | + react prod |
| 42 | + |
| 43 | +The generated app is completely independent from the reactful package. At this point you can part ways with the reactful package and do your own thing, but if you follow the patterns initialized by the package, you can use a few handy commands from the global react command. |
| 44 | + |
| 45 | +### Create New Redux/React App |
| 46 | + |
| 47 | + react new-full my-awesome-redux-app-name |
| 48 | + |
| 49 | +This will generate a Redux-configured full-stack React application with a state managed by Immutable.js. It will also render on both client and server. |
| 50 | + |
| 51 | + |
| 52 | +### Update Existing React App |
| 53 | + |
| 54 | +While in a React application that's created with this tool, you can always revert things back the default configurations with the init command. You can also use this command in an empty directory. |
| 55 | + |
| 56 | + cd my-awesome-react-app-name |
| 57 | + react init |
| 58 | + |
| 59 | +If that directory already has files, reactful will ask you if you want to override them. |
| 60 | + |
| 61 | +You can also use init-full to update an existing Redux/React app. |
| 62 | + |
| 63 | +### Creating Components |
| 64 | + |
| 65 | +- Create a New Component: ```react c ComponentName``` |
| 66 | +- Create a New Pure Component: ```react pc ComponentName``` |
| 67 | +- Create a New Function Component: ```react fc ComponentName``` |
| 68 | + |
| 69 | +All of these commands will also create a jest snapshot test for the generated component. |
0 commit comments