-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmeta.js
93 lines (93 loc) · 3.02 KB
/
meta.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
92
93
/**
* Created by trigkit4 on 17/6/29.
*/
module.exports = {
template: 'handlebars',
templateOptions: {
helpers: {
'if_eq': function (a,b,opts) {
return a === b
? opts.fn(this)
: opts.inverse(this)
},
'unless_eq': function (a, b, opts) {
return a === b
? opts.inverse(this)
: opts.fn(this)
}
}
},
prompts:{
"name":{
"type": "string",
"required": true,
"message": "Your Project Name"
},
"description":{
"type": "string",
"required": false,
"message": "Project description",
"default": "build project starter kit rapidly by hbuild"
},
"author":{
"type": "string",
"message": "Author"
},
"project": {
"type": "list",
"message": "select your project type",
"choices": ["h5","vue","react","pure"]
},
"template": {
"when": "project =='h5'",
"type": "list",
"message": "select your template engine",
"choices": ["ejs","mustache","art-template"]
},
"vuex": {
"when": "project=='vue'",
"type": "confirm",
"message": "use vuex in your project",
"default": true
},
"preprocessor": {
"when": "project !=='pure'",
"type": "list",
"message": "select one css pre-processor",
"choices": ["LESS","SASS","stylus"]
}
},
filters: {
"src/pages/index/module/*.html": "project == 'h5' && template !== 'art-template'",
"src/pages/index/module/*.art": "project == 'h5' && template == 'art-template'",
"src/pages/index/*.jsx": "project == 'react'",
"src/pages/index/*.js": "project !=='react'",
"src/pages/index/module/*.jsx": "project == 'react'",
"src/pages/index/*.styl": "preprocessor =='stylus' && project =='h5'",
"src/pages/index/*.less": "preprocessor == 'LESS' && project == 'h5'",
"src/pages/index/*.scss": "preprocessor == 'SASS' && project == 'h5'",
"src/components/index/*.vue": "project == 'vue'",
"src/components/router/*.js": "project == 'vue'",
"src/components/counter/*.vue": "project == 'vue' && vuex",
"src/components/store/*.js": "project == 'vue' && vuex",
"src/common/css/*.less": "preprocessor == 'LESS'",
"src/common/css/*.scss": "preprocessor == 'SASS'",
"src/common/css/*.styl": "preprocessor == 'stylus'",
"src/lib/media.less": "preprocessor == 'LESS' ",
"src/lib/media.scss": "preprocessor == 'SASS' ",
"src/lib/media.styl": "preprocessor == 'stylus' ",
"src/**/*": "project !== 'pure'",
"build/**/*": "project !== 'pure'",
"mock/**/*": "project !== 'pure'",
"*.js": "project !=='pure'"
},
completeMessage({log, folderName, chalk}) {
log.success(`Your new project has been successfully generated in ${chalk.underline(folderName)}!`)
console.log(chalk.bold(` To get started:\n`))
console.log(` cd ${folderName}`)
console.log(` yarn`)
console.log(` npm start\n`)
console.log(chalk.bold(` To build for production:\n`))
console.log(` npm run build`)
}
}