reatux v0.4.3
Reatux CLI Tool for React
For the use of this tool you must be familiar with redux.
Description
This is a CLI tool for generating redux ready projects of react, with the capacity of generate more redux or react components too.
Installation
NodeJs 8.0.0 or newer version required.
For installing globally just run the command below:
npm -g install reatuxGenerate a project
You can use
rtxorreatuxcommand for executing the tool, for comfort reasons, in this readme we will usertx.
Create the folder where you want to create a project, open CLI Tool in that folder location, then execute the following command:
rtx appThe console will prompt some questions:
? What is the name of your application? myApp
? What package manager will you use? noneAnswer them and voila, you generated a readux ready react application.
Also we have the way to directly specify the name of our app, we just need to execute the command as the following example:
rtx app myAppWhere myApp is the name given to the application.
Generate components
There are 2 diferent types of components that could be generated with reatux:
- Container
- Presentational
Depending on the component that we want to generate, we could run 1 of the following commands:
rtx containeror
rtx presentationAfter running this command, reatux will just ask for the name of the component.
? Name of the container component? my-comp
create src/containers/my-comp/my-comp.container.js
create src/containers/my-comp/my-comp.container.scssAs app command, we can specify the name or also the route where we want our component to be generated.
rtx container my-componentor
rtx container subfolder1/subfolder2/my-componentreatux will handle both.
Generating Reducers
The command for generating reducer is:
rtx reduceror
rxt reducer my-reducerWhere my-reducer could be the name of the reducer or the route inside the reducers folder.
Configuration File
After generating a project, a file named .reatux.json will be also created into the folder, this file contains some important configuration for the reatux tool, it contains must be something like this:
{
"appName": "myApp",
"folders": {
"reducers": "./src/reducers/",
"actions": "./src/actions/",
"containers": "./src/containers/",
"presentations": "./src/presentations/",
"types": "./src/types/",
"tests": "./__tests__/"
}
}Here we can configure where we want our files to be generated, such as reducers or components, we just need to change the values of folders.
Command List
To see all the available commmands just execute the following command:
rtx --helpCollaborate
If you want to make this tool grow up, dont hesitate to send me an email to justdevelopitmx@gmail.com.