forked from posva/vue-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meta.js
82 lines (79 loc) · 1.84 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
let gitConfig
try {
gitConfig = require('git-config').sync()
} catch (e) {
gitConfig = {}
}
function kebabToCamel (name) {
name = name.replace(/\-(\w)/g, (match, p1) => p1.toUpperCase())
name = name.replace(/^\w/, (match) => match.toUpperCase())
return name
}
/*
* TODO
* tests?
* visual tests?
* github contrib
* license
* eslint
* coding style
*/
module.exports = {
prompts: {
name: {
type: 'string',
required: true,
message: 'Plugin name'
},
library: {
type: 'string',
required: true,
message: 'Library name',
default (answers) {
return answers.name ? kebabToCamel(answers.name) : null
}
},
description: {
type: 'string',
required: false,
message: 'Plugin description',
default: 'A Vue.js Plugin'
},
version: {
type: 'string',
required: false,
message: 'Current version',
default: '0.0.0'
},
author: {
type: 'string',
message: 'Author'
},
githubAccount: {
type: 'string',
required: false,
message: 'GitHub Account',
default: gitConfig.github && gitConfig.github.user
}
},
helpers: {
nowYear () {
return new Date().getFullYear()
},
authorFullNameFrom (author) {
const startPosition = author.indexOf('<')
return author.slice(0, startPosition - 1)
},
authorEmailFrom (author) {
const startPosition = author.indexOf('<')
const endPosition = author.indexOf('>')
return author.slice(startPosition + 1, endPosition)
}
},
skipInterpolation: 'src/**/*.vue!src/Component.vue',
"completeMessage": "To get started:\n\n cd {{destDirName}}\n npm install\n npm run dev",
filters: {
'build/build.js': `bundler === 'rollup'`,
'build/webpack.config.{browser,common}.js': `bundler === 'webpack'`
}
}