-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplopfile.ts
37 lines (34 loc) · 1008 Bytes
/
plopfile.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const inquirer = require('inquirer');
const inquirerFileTreeSelection = require('inquirer-file-tree-selection-prompt')
inquirer.registerPrompt('file-tree-selection', inquirerFileTreeSelection)
module.exports = function (plop) {
plop.setGenerator('component', {
description: 'React Component',
prompts: [
{
type: 'input',
name: 'name',
message: 'Component name?'
},
{
// Documentation here: https://github.com/anc95/inquirer-file-tree-selection
type: 'file-tree-selection',
name: 'directory',
message: 'Choose a directory to put this component in',
root: 'src',
}
],
actions: [
{
type: 'add',
path: '{{ directory }}/{{ name }}/index.ts',
templateFile: 'templates/component/index.hbs'
},
{
type: 'add',
path: '{{ directory }}/{{ name }}/{{ name }}.component.tsx',
templateFile: 'templates/component/component.hbs'
}
]
})
}