Simple create and scraffolding React components and utilities. This cli was created after reading this post So many thanks for idea to David Gilbertson
First of all you need to create src
folder. It's a start for application sources.
For best expirience you may configure aliases for webpack to resolve Components
and Utils
.
// webpack.config.js
// ...
alias: {
// ...
'Components': path.resolve(`${__dirname}/src/components`),
'Utils': path.resolve(`${__dirname}/src/utils`),
// ...
}
// ...
After this you can use simple importing in you React application:
import MyTab from 'Components/MyTab';
import myUtil from 'Utils/myUtil';
import { myUtil1, myUtil2 } from 'Utils';
npm install -g react-app-components-cli
cd my-awesome-react-app
mkdir src # if not exists
rcc config
After running config it will create a .rcc-config.json
in the root folder.
You can edit settings manually in JSON file any time.
rcc component MyAwesomeComponent
rcc util myAwesomeUtil
When you create a new component, automattically will be created new folder with main JSX file, test and style. Also will de created package.json file inside this dir for best resolving names. The same thing happens when create utility. The difference is that utility is not creates package.json. All utilities are stored in index.js filera
If you have any questions you can contact me via email or telegram