Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit 4ada88c

Browse files
committed
refactor(generator): install vite dependencies, replace public html file with root level html file.
1 parent 693a483 commit 4ada88c

File tree

1 file changed

+28
-0
lines changed
  • packages/vue-cli-plugin-vuetify/generator

1 file changed

+28
-0
lines changed

packages/vue-cli-plugin-vuetify/generator/index.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ module.exports = (api, opts) => {
44
const polyfill = require('./tools/polyfill')
55
const vuetify = require('./tools/vuetify')
66

7+
const fs = require("fs")
8+
79
if (opts.preset !== 'configure') {
810
opts = require(`../presets/${opts.preset}`).plugins['vue-cli-plugin-vuetify']
911
}
@@ -19,6 +21,28 @@ module.exports = (api, opts) => {
1921
if (opts.useAlaCarte) alaCarte.addDependencies(api, opts.useV3)
2022
else if (opts.usePolyfill) polyfill.addDependencies(api)
2123

24+
// Vite
25+
if (opts.useVite) {
26+
api.extendPackage({
27+
devDependencies: {
28+
'@vitejs/plugin-vue': '^1.1.5',
29+
'vite': '^2.0.5',
30+
},
31+
scripts: {
32+
'serve': 'vite preview',
33+
'build': 'vite build',
34+
'dev': 'vite',
35+
}
36+
})
37+
38+
const viteFiles = {
39+
'./vite.config.js': './templates/v3/src/vite.config.js',
40+
'./index.html': './templates/v3/src/index.vite.html',
41+
}
42+
43+
api.render(viteFiles, opts)
44+
}
45+
2246
if (opts.installFonts) fonts.addDependencies(api, opts.iconFont)
2347

2448
// Update vue.config.js for transpileDependency if AlaCarte
@@ -36,6 +60,10 @@ module.exports = (api, opts) => {
3660
if (!opts.installFonts) fonts.addLinks(api, opts.iconFont)
3761
vuetify.setHtmlLang(api, opts.locale)
3862

63+
if (fs.existsSync('src/public/index.html')) {
64+
fs.unlinkSync(api.resolve('src/public/index.html'));
65+
}
66+
3967
api.exitLog('Discord community: https://community.vuetifyjs.com')
4068
api.exitLog('Github: https://github.com/vuetifyjs/vuetify')
4169
api.exitLog('Support Vuetify: https://github.com/sponsors/johnleider')

0 commit comments

Comments
 (0)