Create templates for common abstractions and leverage Progen's power of automation to generate boilerplate code. This will increase your team's productivity, help you enforce your standards and help on-board new team members.
There is no real requirement for file names, so you can get creative and use the
tool however it yields more value to you and your team, however, a useful pattern
to keep in mind could be would be to start the name with the abstraction layer
followed by "group names". For example component.view.js. This would allow you to
group many templates under with the component prefix but if you only want the view
you can be more specific and use component.view.
In our projects, to create a React component, we separate the view, types and stories into separate files and put it all together before exporting it in an index.js file. We can group our templates like so:
1pure-component.index.js
2pure-component.view.js
3pure-component.view.spec.js
4pure-component.enhancer.js
5pure-component.types.js
6pure-component.styles.scss
Run
progen -w pure -n ComponentNameto use the template group.
Redux Reducer must have a reducer file, a type file and an action file. For this we can group our templates like so:
1reducer.index.js
2reducer.reducer.js
3reducer.reducer.spec.js
4reducer.actions.js
5reducer.actions.spec.js
6reducer.types.js
Run
progen -w reducer -n ReducerNameto use the template group.
Templates can have variables which will be substituted when copying the template.
Simply put a name between dollar signs. For example function $NAME$() { and pass
in the substitution in the CLI with the -s or --substitute command. The value for
the substitute cli argument is a key:value pairs separated by ,.
1progen -w component -n MySection -s "NAME:MySection, TITLE:This is my Section"
This command will substitute $NAME$ for MySection and $TITLE for "This is my Section".
Current Version: 0.0.0
Home
Quick Start
Config
Templates
CLI