Created
February 3, 2020 10:30
-
-
Save amaankulshreshtha/6e751d4d0e40b33d18aee9693b588f52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AddActionConfig, NodePlopAPI } from 'plop'; | |
export default function(plop: NodePlopAPI) { | |
plop.setGenerator('common', { | |
description: 'add a common component', | |
prompts: [ | |
{ | |
type: 'input', | |
name: 'name', | |
message: 'common component name please' | |
} | |
], | |
actions: [ | |
{ | |
type: 'add', | |
path: 'common/{{pascalCase name}}/index.js', | |
templateFile: 'plop-templates/ReactComponents/index.hbs' | |
}, | |
{ | |
type: 'add', | |
path: 'common/{{pascalCase name}}/index.styles.js', | |
templateFile: 'plop-templates/ReactComponents/index.styles.hbs' | |
} | |
] as Array<AddActionConfig> | |
}); | |
plop.setGenerator('components', { | |
description: 'add a smart component', | |
prompts: [ | |
{ | |
type: 'input', | |
name: 'name', | |
message: 'smart component name please' | |
} | |
], | |
actions: [ | |
{ | |
type: 'add', | |
path: 'components/{{pascalCase name}}/index.js', | |
templateFile: 'plop-templates/ReactComponents/index.hbs' | |
}, | |
{ | |
type: 'add', | |
path: 'components/{{pascalCase name}}/index.styles.js', | |
templateFile: 'plop-templates/ReactComponents/index.styles.hbs' | |
} | |
] as Array<AddActionConfig> | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment