From 44bde1b4948a5a5a23661e1dcc5bebdd928873ce Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Tue, 23 Feb 2021 11:20:55 -0800 Subject: [PATCH 01/16] feat(v3-preset): add v3 preset Update vuetify helper's addDependencies method to determine what vuetify version to add based on the v3 preset option. --- .../vue-cli-plugin-vuetify/generator/index.js | 2 +- .../generator/tools/vuetify.js | 6 +++--- .../vue-cli-plugin-vuetify/presets/v3.json | 18 ++++++++++++++++++ .../vue-cli-plugin-vuetify/util/presets.js | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 packages/vue-cli-plugin-vuetify/presets/v3.json diff --git a/packages/vue-cli-plugin-vuetify/generator/index.js b/packages/vue-cli-plugin-vuetify/generator/index.js index 4bddf271..b8dc4b7b 100644 --- a/packages/vue-cli-plugin-vuetify/generator/index.js +++ b/packages/vue-cli-plugin-vuetify/generator/index.js @@ -15,7 +15,7 @@ module.exports = (api, opts) => { if (opts.installFonts) fonts.addImports(api, opts.iconFont) // Add dependencies - vuetify.addDependencies(api) + vuetify.addDependencies(api, opts.v3) if (opts.useAlaCarte) alaCarte.addDependencies(api) else if (opts.usePolyfill) polyfill.addDependencies(api) diff --git a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js index 21303565..c5486df1 100644 --- a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js +++ b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js @@ -2,12 +2,12 @@ const fs = require('fs') const helpers = require('./helpers') -function addDependencies (api) { +function addDependencies (api, v3) { api.extendPackage({ dependencies: { - vuetify: '^2.4.0', + vuetify: v3 ? "^3.0.0-alpha" : "^2.4.0", // @TODO Check exact version }, - }) + }); } function renderFiles (api, { opts }) { diff --git a/packages/vue-cli-plugin-vuetify/presets/v3.json b/packages/vue-cli-plugin-vuetify/presets/v3.json new file mode 100644 index 00000000..1c6628cd --- /dev/null +++ b/packages/vue-cli-plugin-vuetify/presets/v3.json @@ -0,0 +1,18 @@ +{ + "useConfigFiles": true, + "cssPreprocessor": "scss", + "plugins": { + "vue-cli-plugin-vuetify": { + "preset": "configure", + "replaceComponents": true, + "iconFont": "mdi", + "installFonts": false, + "locale": "en", + "useAlaCarte": true, + "useCustomProperties": false, + "usePolyfill": false, + "useTheme": false, + "useV3": true + } + } +} diff --git a/packages/vue-cli-plugin-vuetify/util/presets.js b/packages/vue-cli-plugin-vuetify/util/presets.js index a18f89aa..8dce80f0 100644 --- a/packages/vue-cli-plugin-vuetify/util/presets.js +++ b/packages/vue-cli-plugin-vuetify/util/presets.js @@ -5,6 +5,7 @@ const resolve = file => path.resolve(__dirname, file) const PRESET_MAP = { default: 'Default (recommended)', prototype: 'Prototype (rapid development)', + v3: 'V3 (alpha)' } module.exports = fs.readdirSync(resolve('../presets')).map(preset => { From 7b921a1d7d86b76fdd9ac0fc72d0160277f0c211 Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Tue, 23 Feb 2021 19:12:55 -0800 Subject: [PATCH 02/16] chore(generator): add correct v3 alpha dependency version. Co-authored-by: Kael --- packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js index c5486df1..33053518 100644 --- a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js +++ b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js @@ -5,7 +5,7 @@ const helpers = require('./helpers') function addDependencies (api, v3) { api.extendPackage({ dependencies: { - vuetify: v3 ? "^3.0.0-alpha" : "^2.4.0", // @TODO Check exact version + vuetify: v3 ? "^3.0.0-alpha.0" : "^2.4.0", }, }); } From 0ca162845d8c52567a71dd9b37b0fcbdc9148300 Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Tue, 23 Feb 2021 19:13:41 -0800 Subject: [PATCH 03/16] chore(gen): remove semi. Co-authored-by: Kael --- packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js index 33053518..0067b24d 100644 --- a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js +++ b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js @@ -7,7 +7,7 @@ function addDependencies (api, v3) { dependencies: { vuetify: v3 ? "^3.0.0-alpha.0" : "^2.4.0", }, - }); + }) } function renderFiles (api, { opts }) { From 4d23c03c16ec08a01bc42245f605d38927e3d283 Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Wed, 24 Feb 2021 00:40:55 -0800 Subject: [PATCH 04/16] refactor(cli-tools): reduce duplicate code --- .../vue-cli-plugin-vuetify/generator/tools/vuetify.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js index 0067b24d..c87879f5 100644 --- a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js +++ b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js @@ -1,5 +1,4 @@ // Imports -const fs = require('fs') const helpers = require('./helpers') function addDependencies (api, v3) { @@ -11,17 +10,18 @@ function addDependencies (api, v3) { } function renderFiles (api, { opts }) { - const ext = api.hasPlugin('typescript') ? 'ts' : 'js' + const hasTS = api.hasPlugin('typescript') + const ext = hasTS ? 'ts' : 'js' const pluginFilename = `vuetify.${ext}` api.render({ [`./src/plugins/${pluginFilename}`]: '../templates/default/src/plugins/vuetify.js', }, { ...opts, - typescript: api.hasPlugin('typescript'), + typescript: hasTS, }) - if (api.hasPlugin('typescript') && opts.useAlaCarte) { + if (hasTS && opts.useAlaCarte) { api.render({ './src/shims-vuetify.d.ts': '../templates/default/src/shims-vuetify.d.ts', }) From 01e2e5f54853dbe13f1a2744cfa5ca60f6f9a53e Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Wed, 24 Feb 2021 14:46:33 -0800 Subject: [PATCH 05/16] chore(v3): start building template. --- .../generator/templates/v3/src/index.js | 16 ++++++++++++++++ .../templates/v3/src/plugins/vuetify.js | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 packages/vue-cli-plugin-vuetify/generator/templates/v3/src/index.js create mode 100644 packages/vue-cli-plugin-vuetify/generator/templates/v3/src/plugins/vuetify.js diff --git a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/index.js b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/index.js new file mode 100644 index 00000000..0eb191ac --- /dev/null +++ b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/index.js @@ -0,0 +1,16 @@ +import { createApp } from "vue"; +import vuetify from "./vuetify"; +import App from "./App"; + +import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; +import { library } from "@fortawesome/fontawesome-svg-core"; +import { fas } from "@fortawesome/free-solid-svg-icons"; + +library.add(fas); + +const app = createApp(App); + +app.use(vuetify); +app.component("FontAwesomeIcon", FontAwesomeIcon); + +app.mount("#app"); diff --git a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/plugins/vuetify.js b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/plugins/vuetify.js new file mode 100644 index 00000000..3bb8e3f8 --- /dev/null +++ b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/plugins/vuetify.js @@ -0,0 +1,18 @@ +import "@mdi/font/css/materialdesignicons.css"; +import { createVuetify } from "vuetify"; +import { aliases, mdi } from "vuetify/src/iconsets/mdi"; +import { fa } from "vuetify/src/iconsets/fa-svg"; + +export default createVuetify({ + // lang: { + // locales, + // }, + icons: { + defaultSet: "mdi", + aliases, + sets: { + mdi, + fa, + }, + }, +}); From ff32bfb98fa18cbb0572787efb00f527c7e6b9d6 Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Wed, 24 Feb 2021 14:50:07 -0800 Subject: [PATCH 06/16] chore(tools): render plugin file based on desired vuetify version. --- packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js index c87879f5..7de3dca0 100644 --- a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js +++ b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js @@ -15,7 +15,7 @@ function renderFiles (api, { opts }) { const pluginFilename = `vuetify.${ext}` api.render({ - [`./src/plugins/${pluginFilename}`]: '../templates/default/src/plugins/vuetify.js', + [`./src/plugins/${pluginFilename}`]: opts.v3 ? '../templates/v3/src/plugins/vuetify.js' : '../templates/default/src/plugins/vuetify.js', }, { ...opts, typescript: hasTS, From 4b6b92d1295a85224efb788b5424c6bb8c9d37a8 Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Wed, 24 Feb 2021 22:40:06 -0800 Subject: [PATCH 07/16] chore(tools): render vuetify preset files depending on v3 option. --- .../generator/tools/vuetify.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js index 7de3dca0..8bc1b13e 100644 --- a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js +++ b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js @@ -30,13 +30,23 @@ function renderFiles (api, { opts }) { // Render files if we're replacing const fs = require('fs') const routerPath = api.resolve(`./src/router.${ext}`) + let files; opts.router = fs.existsSync(routerPath) if (opts.replaceComponents) { - const files = { - './src/App.vue': `../templates/default/src/App.${ext}.vue`, - './src/assets/logo.svg': '../templates/default/src/assets/logo.svg', - './src/components/HelloWorld.vue': `../templates/default/src/components/HelloWorld.${ext}.vue`, + // replaceComponents is always true + if (opts.v3) { + files = { + "./src/App.vue": `../templates/v3/src/App.${ext}.vue`, + "./src/assets/logo.svg": "../templates/v3/src/assets/logo.svg", + "./src/main.js": "../templates/v3/src/index.js", + } + } else { + files = { + "./src/App.vue": `../templates/default/src/App.${ext}.vue`, + "./src/assets/logo.svg": "../templates/default/src/assets/logo.svg", + "./src/components/HelloWorld.vue": `../templates/default/src/components/HelloWorld.${ext}.vue`, + } } if (opts.router) { From f4f5a3d0cd1aaf4e3a9157e8b14a2c12d512e489 Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Wed, 24 Feb 2021 22:40:44 -0800 Subject: [PATCH 08/16] chore(template): add App.vue and logo template. --- .../generator/templates/v3/src/App.js.vue | 10 ++++++++++ .../generator/templates/v3/src/App.ts.vue | 11 +++++++++++ .../generator/templates/v3/src/assets/logo.svg | 1 + 3 files changed, 22 insertions(+) create mode 100644 packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.js.vue create mode 100644 packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.ts.vue create mode 100644 packages/vue-cli-plugin-vuetify/generator/templates/v3/src/assets/logo.svg diff --git a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.js.vue b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.js.vue new file mode 100644 index 00000000..61621faf --- /dev/null +++ b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.js.vue @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.ts.vue b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.ts.vue new file mode 100644 index 00000000..5031b399 --- /dev/null +++ b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.ts.vue @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/assets/logo.svg b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/assets/logo.svg new file mode 100644 index 00000000..7a027fd2 --- /dev/null +++ b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/assets/logo.svg @@ -0,0 +1 @@ +Artboard 46 \ No newline at end of file From 532fdab0dae930e7108ceaed52f73400f856be3d Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Thu, 25 Feb 2021 13:37:56 -0800 Subject: [PATCH 09/16] chore(templates): add base v3 templates for JS. --- .../generator/templates/v3/src/App.js.vue | 21 +++++++++++++++++-- .../v3/src/components/HelloWorld.js.vue | 15 +++++++++++++ .../templates/v3/src/{index.js => main.js} | 0 .../templates/v3/src/router/router.js | 16 ++++++++++++++ .../templates/v3/src/views/Home.js.vue | 17 +++++++++++++++ 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 packages/vue-cli-plugin-vuetify/generator/templates/v3/src/components/HelloWorld.js.vue rename packages/vue-cli-plugin-vuetify/generator/templates/v3/src/{index.js => main.js} (100%) create mode 100644 packages/vue-cli-plugin-vuetify/generator/templates/v3/src/router/router.js create mode 100644 packages/vue-cli-plugin-vuetify/generator/templates/v3/src/views/Home.js.vue diff --git a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.js.vue b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.js.vue index 61621faf..0de8086c 100644 --- a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.js.vue +++ b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.js.vue @@ -1,10 +1,27 @@ \ No newline at end of file diff --git a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/components/HelloWorld.js.vue b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/components/HelloWorld.js.vue new file mode 100644 index 00000000..c8d60c88 --- /dev/null +++ b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/components/HelloWorld.js.vue @@ -0,0 +1,15 @@ + + + diff --git a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/index.js b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/main.js similarity index 100% rename from packages/vue-cli-plugin-vuetify/generator/templates/v3/src/index.js rename to packages/vue-cli-plugin-vuetify/generator/templates/v3/src/main.js diff --git a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/router/router.js b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/router/router.js new file mode 100644 index 00000000..09d218ae --- /dev/null +++ b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/router/router.js @@ -0,0 +1,16 @@ +import { createRouter } from 'vue-router' +import Home from '../views/Home.vue' + +const routes = [ + { + path: '/', + name: 'Home', + component: Home, + }, +] + +const router = createRouter({ + routes, +}) + +export default router diff --git a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/views/Home.js.vue b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/views/Home.js.vue new file mode 100644 index 00000000..465722c7 --- /dev/null +++ b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/views/Home.js.vue @@ -0,0 +1,17 @@ + + + From e0e4978ca8e0bdcd9839f5c0a75683e70849f21f Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Thu, 25 Feb 2021 13:41:59 -0800 Subject: [PATCH 10/16] chore(tools): update helpers to support v3 preset template. --- .../generator/tools/vuetify.js | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js index 8bc1b13e..d0f6ad39 100644 --- a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js +++ b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js @@ -4,7 +4,8 @@ const helpers = require('./helpers') function addDependencies (api, v3) { api.extendPackage({ dependencies: { - vuetify: v3 ? "^3.0.0-alpha.0" : "^2.4.0", + // Will currently prompt to select version for v3 preset, until v3 is released. + vuetify: v3 ? '^3.0.0-alpha.0' : '^2.4.0', }, }) } @@ -15,7 +16,7 @@ function renderFiles (api, { opts }) { const pluginFilename = `vuetify.${ext}` api.render({ - [`./src/plugins/${pluginFilename}`]: opts.v3 ? '../templates/v3/src/plugins/vuetify.js' : '../templates/default/src/plugins/vuetify.js', + [`./src/plugins/${pluginFilename}`]: opts.useV3 ? '../templates/v3/src/plugins/vuetify.js' : '../templates/default/src/plugins/vuetify.js', }, { ...opts, typescript: hasTS, @@ -30,27 +31,30 @@ function renderFiles (api, { opts }) { // Render files if we're replacing const fs = require('fs') const routerPath = api.resolve(`./src/router.${ext}`) - let files; + let files opts.router = fs.existsSync(routerPath) + // replaceComponents is always true if (opts.replaceComponents) { - // replaceComponents is always true - if (opts.v3) { + if (opts.useV3) { files = { "./src/App.vue": `../templates/v3/src/App.${ext}.vue`, "./src/assets/logo.svg": "../templates/v3/src/assets/logo.svg", - "./src/main.js": "../templates/v3/src/index.js", - } + "./src/components/HelloWorld.vue": `../templates/v3/src/components/HelloWorld.${ext}.vue`, + [api.entryFile]: "../templates/v3/src/main.js", + }; } else { files = { - "./src/App.vue": `../templates/default/src/App.${ext}.vue`, - "./src/assets/logo.svg": "../templates/default/src/assets/logo.svg", - "./src/components/HelloWorld.vue": `../templates/default/src/components/HelloWorld.${ext}.vue`, + './src/App.vue': `../templates/default/src/App.${ext}.vue`, + './src/assets/logo.svg': '../templates/default/src/assets/logo.svg', + './src/components/HelloWorld.vue': `../templates/default/src/components/HelloWorld.${ext}.vue`, } } if (opts.router) { - files['./src/views/Home.vue'] = `../templates/default/src/views/Home.${ext}.vue` + files["./src/views/Home.vue"] = opts.v3 + ? "../templates/v3/src/views/Home.js.vue" + : `../templates/default/src/views/Home.${ext}.vue` } api.render(files, opts) @@ -58,8 +62,8 @@ function renderFiles (api, { opts }) { } function addImports (api) { - api.injectImports(api.entryFile, 'import vuetify from \'./plugins/vuetify\';') - api.injectRootOptions(api.entryFile, 'vuetify') + api.injectImports(api.entryFile, "import vuetify from './plugins/vuetify';"); + api.injectRootOptions(api.entryFile, "vuetify"); } function setHtmlLang (api, locale) { From 67fbd8578f91ceb590fc0b83a79413cae865127d Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Thu, 25 Feb 2021 14:43:23 -0800 Subject: [PATCH 11/16] chore(fonts): install font deps based on version. --- .../generator/tools/fonts.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/vue-cli-plugin-vuetify/generator/tools/fonts.js b/packages/vue-cli-plugin-vuetify/generator/tools/fonts.js index d9122d16..a7ff2e10 100644 --- a/packages/vue-cli-plugin-vuetify/generator/tools/fonts.js +++ b/packages/vue-cli-plugin-vuetify/generator/tools/fonts.js @@ -37,13 +37,23 @@ const fonts = { }, } -function addDependencies (api, iconFont) { - api.extendPackage({ +function addDependencies (api, iconFont, useV3) { + let pkgOpts = { dependencies: { ...fonts.roboto.package, ...fonts[iconFont].package, - }, - }) + } + } + + if (useV3) pkgOpts = { + ...pkgOpts, + // Use specified version or latest? + "@fortawesome/fontawesome-svg-core": "latest", + "@fortawesome/free-solid-svg-icons": "latest", + "@fortawesome/vue-fontawesome": "latest", + } + + api.extendPackage(pkgOpts) } function addImports (api, iconFont) { From d8e49415db0b1868be7eb2fd1c57ad90af8b312a Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Thu, 25 Feb 2021 14:46:27 -0800 Subject: [PATCH 12/16] chore(gen): add deps and imports based on preset. --- packages/vue-cli-plugin-vuetify/generator/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vue-cli-plugin-vuetify/generator/index.js b/packages/vue-cli-plugin-vuetify/generator/index.js index b8dc4b7b..e2c3919b 100644 --- a/packages/vue-cli-plugin-vuetify/generator/index.js +++ b/packages/vue-cli-plugin-vuetify/generator/index.js @@ -10,16 +10,16 @@ module.exports = (api, opts) => { // Add imports // Must be before dependencies because of weird bug - vuetify.addImports(api) + if (!opts.useV3) vuetify.addImports(api) if (!opts.useAlaCarte && opts.usePolyfill) polyfill.addImports(api) - if (opts.installFonts) fonts.addImports(api, opts.iconFont) + if (opts.installFonts && !opts.useV3) fonts.addImports(api, opts.iconFont) // Add dependencies - vuetify.addDependencies(api, opts.v3) + vuetify.addDependencies(api, opts.useV3) if (opts.useAlaCarte) alaCarte.addDependencies(api) else if (opts.usePolyfill) polyfill.addDependencies(api) - if (opts.installFonts) fonts.addDependencies(api, opts.iconFont) + if (opts.installFonts) fonts.addDependencies(api, opts.iconFont, opts.useV3) // Update vue.config.js for transpileDependency if AlaCarte if (opts.useAlaCarte) alaCarte.addVueConfigTranspileDependency(api) From 13410e19edb649c54115926c415e6ede25e87001 Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Fri, 26 Feb 2021 09:31:49 -0800 Subject: [PATCH 13/16] chore(tools): make v2 template files default for renderFiles helper. --- .../generator/tools/vuetify.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js index d0f6ad39..e47332ac 100644 --- a/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js +++ b/packages/vue-cli-plugin-vuetify/generator/tools/vuetify.js @@ -31,9 +31,14 @@ function renderFiles (api, { opts }) { // Render files if we're replacing const fs = require('fs') const routerPath = api.resolve(`./src/router.${ext}`) - let files opts.router = fs.existsSync(routerPath) + let files = { + "./src/App.vue": `../templates/default/src/App.${ext}.vue`, + "./src/assets/logo.svg": "../templates/default/src/assets/logo.svg", + "./src/components/HelloWorld.vue": `../templates/default/src/components/HelloWorld.${ext}.vue`, + } + // replaceComponents is always true if (opts.replaceComponents) { if (opts.useV3) { @@ -42,12 +47,6 @@ function renderFiles (api, { opts }) { "./src/assets/logo.svg": "../templates/v3/src/assets/logo.svg", "./src/components/HelloWorld.vue": `../templates/v3/src/components/HelloWorld.${ext}.vue`, [api.entryFile]: "../templates/v3/src/main.js", - }; - } else { - files = { - './src/App.vue': `../templates/default/src/App.${ext}.vue`, - './src/assets/logo.svg': '../templates/default/src/assets/logo.svg', - './src/components/HelloWorld.vue': `../templates/default/src/components/HelloWorld.${ext}.vue`, } } @@ -62,8 +61,8 @@ function renderFiles (api, { opts }) { } function addImports (api) { - api.injectImports(api.entryFile, "import vuetify from './plugins/vuetify';"); - api.injectRootOptions(api.entryFile, "vuetify"); + api.injectImports(api.entryFile, "import vuetify from './plugins/vuetify';") + api.injectRootOptions(api.entryFile, "vuetify") } function setHtmlLang (api, locale) { From 17acf785f5cc5683de94bf963d85e071e51b0787 Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Fri, 26 Feb 2021 12:55:31 -0800 Subject: [PATCH 14/16] chore(templates): start vue file templates. --- .../generator/templates/v3/src/App.js.vue | 12 +++++++----- .../v3/src/components/HelloWorld.js.vue | 19 ++++++++++++++++--- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.js.vue b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.js.vue index 0de8086c..1ed2512a 100644 --- a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.js.vue +++ b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/App.js.vue @@ -1,9 +1,11 @@ From 3f1ffc4fe4f781ea5d464a696afe957ef0fcb6ee Mon Sep 17 00:00:00 2001 From: Elijah Kotyluk Date: Fri, 26 Feb 2021 20:20:18 -0800 Subject: [PATCH 16/16] fix(template): remove prop from hello world cmp. --- .../generator/templates/v3/src/views/Home.js.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/views/Home.js.vue b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/views/Home.js.vue index 465722c7..1ff37bd8 100644 --- a/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/views/Home.js.vue +++ b/packages/vue-cli-plugin-vuetify/generator/templates/v3/src/views/Home.js.vue @@ -1,6 +1,6 @@