1.6.8 • Published 5 years ago
@fuselab/react-gen v1.6.8
General purpose code generator from template
fuse-gen is a general purpose template based code generator
Get started
npm install -g @fuselab/react-gen
Basic usage
The new sub command has built-in templates to support common usage scenarios of bootstrapping React-redux app.
Create starter React-redux-uifabric app
fuse-gen new -k app -a [appName]
# answer prompts about the configuration of the your app
Create new redux component
cd {appRoot}\components
fuse-gen new -k component -a .
# specify the name of your component
create new redux action
cd {appRoot}\actions
fuse-gen new -k action -a .
# answer prompts about the actions to be created
create new yargs based cli
fuse-gen new -k cli -a .
Advanced usage
The add sub command allows you use custom templates to
fuse-gen add --source [file|folder] --target [file|folder]
Create template
- Create template folder structure. Use {{name}} to place variable entity in your template file content.
- Also use {{name}} in file and folder names to change the generated file names
example
\component
\{{component}}.tsx
\index.ts
\{{component}}Classes.tx
{{component}}.tsx
export interface {{Component}}Attributes {
id: string;
}
export interface {{Component}}Actiosn {
save(): void;
}
export type {{Component}}Props = {{Component}}Attributes & {{Component}}Actions;
export class {{Component}} extends ReactCompoent<{{Component}}Props> {
}