|
| 1 | +module.exports = api => { |
| 2 | + api.describeConfig({ |
| 3 | + id: 'org.vue.vue-cli', |
| 4 | + name: 'Vue CLI', |
| 5 | + description: 'org.vue.vue-webpack.config.vue-cli.description', |
| 6 | + link: 'https://cli.vuejs.org/config/', |
| 7 | + files: { |
| 8 | + vue: { |
| 9 | + js: ['vue.config.js'] |
| 10 | + } |
| 11 | + }, |
| 12 | + icon: '/_plugin/@vue%2Fcli-guijs-plugin/vue-cli.png', |
| 13 | + onRead: ({ data }) => ({ |
| 14 | + prompts: [ |
| 15 | + { |
| 16 | + name: 'publicPath', |
| 17 | + type: 'input', |
| 18 | + default: '/', |
| 19 | + value: data.vue && (data.vue.publicPath || data.vue.baseUrl), // fallback to baseUrl for compatibility |
| 20 | + message: 'org.vue.vue-webpack.config.vue-cli.publicPath.label', |
| 21 | + description: 'org.vue.vue-webpack.config.vue-cli.publicPath.description', |
| 22 | + group: 'org.vue.vue-webpack.config.vue-cli.groups.general', |
| 23 | + link: 'https://cli.vuejs.org/config/#publicPath' |
| 24 | + }, |
| 25 | + { |
| 26 | + name: 'outputDir', |
| 27 | + type: 'input', |
| 28 | + default: 'dist', |
| 29 | + value: data.vue && data.vue.outputDir, |
| 30 | + validate: input => !!input, |
| 31 | + message: 'org.vue.vue-webpack.config.vue-cli.outputDir.label', |
| 32 | + description: 'org.vue.vue-webpack.config.vue-cli.outputDir.description', |
| 33 | + group: 'org.vue.vue-webpack.config.vue-cli.groups.general', |
| 34 | + link: 'https://cli.vuejs.org/config/#outputdir' |
| 35 | + }, |
| 36 | + { |
| 37 | + name: 'assetsDir', |
| 38 | + type: 'input', |
| 39 | + default: '', |
| 40 | + value: data.vue && data.vue.assetsDir, |
| 41 | + message: 'org.vue.vue-webpack.config.vue-cli.assetsDir.label', |
| 42 | + description: 'org.vue.vue-webpack.config.vue-cli.assetsDir.description', |
| 43 | + group: 'org.vue.vue-webpack.config.vue-cli.groups.general', |
| 44 | + link: 'https://cli.vuejs.org/config/#assetsdir' |
| 45 | + }, |
| 46 | + { |
| 47 | + name: 'runtimeCompiler', |
| 48 | + type: 'confirm', |
| 49 | + default: false, |
| 50 | + value: data.vue && data.vue.runtimeCompiler, |
| 51 | + message: 'org.vue.vue-webpack.config.vue-cli.runtimeCompiler.label', |
| 52 | + description: 'org.vue.vue-webpack.config.vue-cli.runtimeCompiler.description', |
| 53 | + group: 'org.vue.vue-webpack.config.vue-cli.groups.general', |
| 54 | + link: 'https://cli.vuejs.org/config/#runtimecompiler' |
| 55 | + }, |
| 56 | + { |
| 57 | + name: 'productionSourceMap', |
| 58 | + type: 'confirm', |
| 59 | + default: true, |
| 60 | + value: data.vue && data.vue.productionSourceMap, |
| 61 | + message: 'org.vue.vue-webpack.config.vue-cli.productionSourceMap.label', |
| 62 | + description: 'org.vue.vue-webpack.config.vue-cli.productionSourceMap.description', |
| 63 | + group: 'org.vue.vue-webpack.config.vue-cli.groups.general', |
| 64 | + link: 'https://cli.vuejs.org/config/#productionsourcemap' |
| 65 | + }, |
| 66 | + { |
| 67 | + name: 'parallel', |
| 68 | + type: 'confirm', |
| 69 | + default: require('os').cpus().length > 1, |
| 70 | + value: data.vue && data.vue.parallel, |
| 71 | + message: 'org.vue.vue-webpack.config.vue-cli.parallel.label', |
| 72 | + description: 'org.vue.vue-webpack.config.vue-cli.parallel.description', |
| 73 | + group: 'org.vue.vue-webpack.config.vue-cli.groups.general', |
| 74 | + link: 'https://cli.vuejs.org/config/#parallel' |
| 75 | + }, |
| 76 | + { |
| 77 | + name: 'css.modules', |
| 78 | + type: 'confirm', |
| 79 | + default: false, |
| 80 | + value: data.vue && data.vue.css && data.vue.css.modules, |
| 81 | + message: 'org.vue.vue-webpack.config.vue-cli.css.modules.label', |
| 82 | + description: 'org.vue.vue-webpack.config.vue-cli.css.modules.description', |
| 83 | + group: 'org.vue.vue-webpack.config.vue-cli.groups.css', |
| 84 | + link: 'https://cli.vuejs.org/config/#css-modules' |
| 85 | + }, |
| 86 | + { |
| 87 | + name: 'css.extract', |
| 88 | + type: 'confirm', |
| 89 | + default: true, |
| 90 | + value: data.vue && data.vue.css && data.vue.css.extract, |
| 91 | + message: 'org.vue.vue-webpack.config.vue-cli.css.extract.label', |
| 92 | + description: 'org.vue.vue-webpack.config.vue-cli.css.extract.description', |
| 93 | + group: 'org.vue.vue-webpack.config.vue-cli.groups.css', |
| 94 | + link: 'https://cli.vuejs.org/config/#css-extract' |
| 95 | + }, |
| 96 | + { |
| 97 | + name: 'css.sourceMap', |
| 98 | + type: 'confirm', |
| 99 | + default: false, |
| 100 | + value: data.vue && data.vue.css && data.vue.css.sourceMap, |
| 101 | + message: 'org.vue.vue-webpack.config.vue-cli.css.sourceMap.label', |
| 102 | + description: 'org.vue.vue-webpack.config.vue-cli.css.sourceMap.description', |
| 103 | + group: 'org.vue.vue-webpack.config.vue-cli.groups.css', |
| 104 | + link: 'https://cli.vuejs.org/config/#css-sourcemap' |
| 105 | + } |
| 106 | + ] |
| 107 | + }), |
| 108 | + onWrite: async ({ api, prompts }) => { |
| 109 | + const vueData = {} |
| 110 | + for (const prompt of prompts) { |
| 111 | + vueData[prompt.id] = await api.getAnswer(prompt.id) |
| 112 | + } |
| 113 | + api.setData('vue', vueData) |
| 114 | + } |
| 115 | + }) |
| 116 | +} |
0 commit comments