-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
/
Copy pathconfig.js
126 lines (126 loc) · 5.07 KB
/
config.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
module.exports = api => {
api.describeConfig({
id: 'org.vue.vue-cli',
name: 'Vue CLI',
description: 'org.vue.vue-webpack.config.vue-cli.description',
link: 'https://cli.vuejs.org/config/',
files: {
vue: {
js: ['vue.config.js']
}
},
icon: '/public/vue-cli.png',
onRead: ({ data }) => ({
prompts: [
{
name: 'publicPath',
type: 'input',
default: '/',
value: data.vue && data.vue.publicPath,
message: 'org.vue.vue-webpack.config.vue-cli.publicPath.label',
description: 'org.vue.vue-webpack.config.vue-cli.publicPath.description',
group: 'org.vue.vue-webpack.config.vue-cli.groups.general',
link: 'https://cli.vuejs.org/config/#publicpath'
},
{
name: 'outputDir',
type: 'input',
default: 'dist',
value: data.vue && data.vue.outputDir,
validate: input => !!input,
message: 'org.vue.vue-webpack.config.vue-cli.outputDir.label',
description: 'org.vue.vue-webpack.config.vue-cli.outputDir.description',
group: 'org.vue.vue-webpack.config.vue-cli.groups.general',
link: 'https://cli.vuejs.org/config/#outputdir'
},
{
name: 'assetsDir',
type: 'input',
default: '',
value: data.vue && data.vue.assetsDir,
message: 'org.vue.vue-webpack.config.vue-cli.assetsDir.label',
description: 'org.vue.vue-webpack.config.vue-cli.assetsDir.description',
group: 'org.vue.vue-webpack.config.vue-cli.groups.general',
link: 'https://cli.vuejs.org/config/#assetsdir'
},
{
name: 'staticResourceDir',
type: 'input',
default: '',
value: data.vue && data.vue.staticResourceDir,
message: 'org.vue.vue-webpack.config.vue-cli.staticResourceDir.label',
description: 'org.vue.vue-webpack.config.vue-cli.staticResourceDir.description',
group: 'org.vue.vue-webpack.config.vue-cli.groups.general',
link: 'https://cli.vuejs.org/config/#staticResourceDir'
},
{
name: 'runtimeCompiler',
type: 'confirm',
default: false,
value: data.vue && data.vue.runtimeCompiler,
message: 'org.vue.vue-webpack.config.vue-cli.runtimeCompiler.label',
description: 'org.vue.vue-webpack.config.vue-cli.runtimeCompiler.description',
group: 'org.vue.vue-webpack.config.vue-cli.groups.general',
link: 'https://cli.vuejs.org/config/#runtimecompiler'
},
{
name: 'productionSourceMap',
type: 'confirm',
default: true,
value: data.vue && data.vue.productionSourceMap,
message: 'org.vue.vue-webpack.config.vue-cli.productionSourceMap.label',
description: 'org.vue.vue-webpack.config.vue-cli.productionSourceMap.description',
group: 'org.vue.vue-webpack.config.vue-cli.groups.general',
link: 'https://cli.vuejs.org/config/#productionsourcemap'
},
{
name: 'parallel',
type: 'confirm',
default: require('os').cpus().length > 1,
value: data.vue && data.vue.parallel,
message: 'org.vue.vue-webpack.config.vue-cli.parallel.label',
description: 'org.vue.vue-webpack.config.vue-cli.parallel.description',
group: 'org.vue.vue-webpack.config.vue-cli.groups.general',
link: 'https://cli.vuejs.org/config/#parallel'
},
{
name: 'css.modules',
type: 'confirm',
default: false,
value: data.vue && data.vue.css && data.vue.css.modules,
message: 'org.vue.vue-webpack.config.vue-cli.css.modules.label',
description: 'org.vue.vue-webpack.config.vue-cli.css.modules.description',
group: 'org.vue.vue-webpack.config.vue-cli.groups.css',
link: 'https://cli.vuejs.org/config/#css-modules'
},
{
name: 'css.extract',
type: 'confirm',
default: true,
value: data.vue && data.vue.css && data.vue.css.extract,
message: 'org.vue.vue-webpack.config.vue-cli.css.extract.label',
description: 'org.vue.vue-webpack.config.vue-cli.css.extract.description',
group: 'org.vue.vue-webpack.config.vue-cli.groups.css',
link: 'https://cli.vuejs.org/config/#css-extract'
},
{
name: 'css.sourceMap',
type: 'confirm',
default: false,
value: data.vue && data.vue.css && data.vue.css.sourceMap,
message: 'org.vue.vue-webpack.config.vue-cli.css.sourceMap.label',
description: 'org.vue.vue-webpack.config.vue-cli.css.sourceMap.description',
group: 'org.vue.vue-webpack.config.vue-cli.groups.css',
link: 'https://cli.vuejs.org/config/#css-sourcemap'
}
]
}),
onWrite: async ({ api, prompts }) => {
const vueData = {}
for (const prompt of prompts) {
vueData[prompt.id] = await api.getAnswer(prompt.id)
}
api.setData('vue', vueData)
}
})
}