Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mdxprograms/react-do
react-do => A React file generator :pencil:
https://github.com/mdxprograms/react-do
code-generator generator mobx react
Last synced: 8 days ago
JSON representation
react-do => A React file generator :pencil:
- Host: GitHub
- URL: https://github.com/mdxprograms/react-do
- Owner: mdxprograms
- Created: 2017-10-29T19:42:40.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-27T21:50:26.000Z (almost 7 years ago)
- Last Synced: 2024-09-23T08:40:22.623Z (about 2 months ago)
- Topics: code-generator, generator, mobx, react
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# { React Do }
## Install
`yarn add react-do --dev`
or
`npm i react-do --save-dev`
## Description
React Do helps save time by reading `.react-do.json` in your project root and creating
a new file based on the configuration parameters and the `templatesDir` template you provide.```bash
yarn react-do component HelloWorld
```You can also specify a nested filepath
```bash
yarn react-do component People/PersonList
```This will then create this file based off the configuration example below
`./components/People/PersonList.js`
## Configuration
.react-do.json configuration example in project root
```json
{
"templatesDir": "./templates",
"templates": {
"component": {
"ext": "js",
"destination": "./components/"
},
"container": {
"ext": "js",
"destination": "./components/"
},
"model": {
"ext": "js",
"destination": "./models/"
},
"actions": {
"ext": "js",
"destination": "./actions/"
},
"store": {
"ext": "js",
"destination": "./stores/"
}
},
"scaffold": ["component", "model", "actions", "store"]
}
```## Templates
You can then define a templates directory somewhere in your project that
coincides with the `templatesDir`.The script works off of the `templates` keys for finding the correct template in `templatesDir`.
If the `destination` doesn't exist it will create it for you.
Both `ext` and `destination` are mandatory.
An example template created in `./example-templates/component.js`
```javascript
import React from 'react';const YourComponent = () => (
•I am render, bringer of fun
);export default YourComponent;
```This will then create a component with your supplied filename via `yarn react-do component YourComponent`
in `./components/YourComponent.js`## Scaffold
You can also setup a scaffolding command by adding the templates you want to get auto generated based off the scaffold name.
example command using the config above:
```bash
yarn react-do scaffold People
```This would then create `./components/People.js`, `./models/People.js`, `./actions/People.js`, `./stores/People.js`
## Coming Soon
- [ ] optional `filename` added to templates config will create a default filename to use for that template
- [ ] destroy command for templates created individually or through scaffold