forked from reactplay/react-play
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.js
91 lines (91 loc) · 2.46 KB
/
plopfile.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
module.exports = plop => {
// demo generator
plop.setGenerator('play', {
description: 'Steps to add a new play',
prompts: [
{
type: 'input',
name: 'id',
message:
'Give us a play id(Any string starts with pl and without a space(Example: pl-id-card ):',
},
{
type: 'input',
name: 'name',
message: 'Please provide the name of the play(Example: Identity Card):',
},
{
type: 'input',
name: 'description',
message: 'Tell us more about the play(Max 1024 characters):',
},
{
type: 'input',
name: 'component',
message:
'Provide the React Component name(Example: IdentityCard):',
},
{
type: 'input',
name: 'folder',
message: 'Provide the folder name(Example: identity-card):',
},
{
type: 'input',
name: 'cover',
message: 'Please provide the path(URL) to cover image(When the image is hosted publicly):',
},
{
type: 'list',
name: 'level',
message: 'What is the level of this play?(Example: Intermediate):',
choices: ['Beginner', 'Intermediate', 'Advanced']
},
{
type: 'input',
name: 'tags',
message: 'Provide maximum of 5 tags(Example: JSX, Hooks):',
},
{
type: 'input',
name: 'github',
message: 'Enter your github username(Example: atapas):',
},
{
type: 'input',
name: 'blog',
message: 'Enter your blog url(Example: https://blog.greenroots.info):',
},
{
type: 'input',
name: 'video',
message: 'Enter your video url(Example: https://www.youtube.com/watch?v=dQw4w9WgXcQ):',
},
],
actions: [
{
type: 'add',
path: 'src/plays/{{folder}}/{{component}}.js',
templateFile: 'plop-templates/component.hbs',
},
{
type: 'modify',
path: 'src/plays/index.js',
pattern: /\/\/add export here/gi,
templateFile: 'plop-templates/exportPlay.hbs',
},
{
type: 'modify',
path: 'src/meta/play-meta.js',
pattern: /\/\/import play here/gi,
templateFile: 'plop-templates/importToMeta.hbs',
},
{
type: 'modify',
path: 'src/meta/play-meta.js',
pattern: /\/\/replace new play item here/gi,
templateFile: 'plop-templates/play.hbs',
},
],
});
};