-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.js
80 lines (72 loc) · 2.53 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
module.exports = function(plop){
plop.setGenerator('Node express generator', {
description: 'Plop generator for Node + Express applications',
prompts: [
{
type: 'input',
name: 'project-name',
message: 'Project name?',
validate: function (value) {
if ((/.+/).test(value)) { return true; }
return 'Project name is required';
}
},
{
type: 'input',
name: 'project-description',
message: 'Project description?'
},
{
type: 'input',
name: 'project-author',
message: 'Project author?'
}
],
actions: function(data){
var actions = [];
// Copy package.json changing project name, description and author.
actions.push({
type: 'add',
path: 'package.json',
templateFile: 'node_modules/plop-node-express/templates/package.json'
});
// Copy .gitignore file
actions.push({
type: 'add',
path: '.gitignore',
templateFile: 'node_modules/plop-node-express/templates/.##gitignore##'
});
// Copy .editorconfig file
actions.push({
type: 'add',
path: '.editorconfig',
templateFile: 'node_modules/plop-node-express/templates/.editorconfig'
});
// Copy .babelrc file
actions.push({
type: 'add',
path: '.babelrc',
templateFile: 'node_modules/plop-node-express/templates/.babelrc'
});
// Copy .eslintrc file
actions.push({
type: 'add',
path: '.eslintrc.js',
templateFile: 'node_modules/plop-node-express/templates/.eslintrc.js'
});
// Copy src/main.js files
actions.push({
type: 'add',
path: 'src/main.js',
templateFile: 'node_modules/plop-node-express/templates/src/main.js'
});
// Copy test/main.test.js file
actions.push({
type: 'add',
path: 'test/main.test.js',
templateFile: 'node_modules/plop-node-express/templates/test/main.test.js'
});
return actions;
}
})
};