Skip to content

Commit adc177a

Browse files
committed
feat: Remove "manual" importStrategy - makes no sense nowadays since auto-import is so powerful
1 parent f645ef2 commit adc177a

File tree

3 files changed

+5
-77
lines changed

3 files changed

+5
-77
lines changed

generator/index.js

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,6 @@ const iconMap = {
2323
mdi: 'mdi-v4'
2424
}
2525

26-
const components = [
27-
'QLayout',
28-
'QHeader',
29-
'QDrawer',
30-
'QPageContainer',
31-
'QPage',
32-
'QToolbar',
33-
'QToolbarTitle',
34-
'QBtn',
35-
'QIcon',
36-
'QList',
37-
'QItem',
38-
'QItemSection',
39-
'QItemLabel'
40-
]
41-
42-
const directives = []
4326
const plugins = []
4427

4528
module.exports = (api, opts) => {
@@ -83,7 +66,7 @@ module.exports = (api, opts) => {
8366
pluginOptions.quasar = Object.assign(
8467
pluginOptions.quasar || {},
8568
{
86-
importStrategy: opts.quasar.importStrategy,
69+
importStrategy: 'kebab',
8770
rtlSupport: opts.quasar.rtlSupport
8871
}
8972
)
@@ -122,7 +105,6 @@ module.exports = (api, opts) => {
122105
let lines = `import Vue from 'vue'\n`
123106

124107
const
125-
autoImport = opts.quasar.importStrategy !== 'manual',
126108
hasIconSet = opts.quasar.iconSet !== 'material-icons',
127109
hasLang = opts.quasar.lang !== 'en-us'
128110

@@ -158,47 +140,12 @@ module.exports = (api, opts) => {
158140
})
159141

160142
// build import
161-
if (autoImport) {
162-
lines += `\nimport { Quasar } from 'quasar'`
163-
}
164-
else {
165-
lines += `\nimport {\n Quasar, `
166-
components
167-
.concat(directives)
168-
.concat(plugins)
169-
.forEach(part => {
170-
lines += `\n ${part},`
171-
})
172-
lines += `\n}`
173-
lines += ` from 'quasar'`
174-
}
143+
lines += `\nimport { Quasar } from 'quasar'`
175144

176145
// build Vue.use()
177146
lines += `\n\nVue.use(Quasar, {`
178147
lines += `\n config: {}`
179148

180-
lines += ',\n components: {'
181-
if (autoImport) {
182-
lines += ` /* not needed if importStrategy is not 'manual' */ }`
183-
}
184-
else {
185-
components.forEach(part => {
186-
lines += `\n ${part},`
187-
})
188-
lines += `\n }`
189-
}
190-
191-
lines += ',\n directives: {'
192-
if (autoImport) {
193-
lines += ` /* not needed if importStrategy is not 'manual' */ }`
194-
}
195-
else {
196-
directives.forEach(part => {
197-
lines += `\n ${part},`
198-
})
199-
lines += `\n }`
200-
}
201-
202149
lines += ',\n plugins: {'
203150
plugins.forEach(part => {
204151
lines += `\n ${part},`

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module.exports = (api, options) => {
3838

3939
chain.performance.maxEntrypointSize(512000)
4040

41-
const strategy = options.pluginOptions.quasar.importStrategy
41+
const strategy = options.pluginOptions.quasar.importStrategy || 'kebab'
4242

4343
if (['kebab', 'pascal', 'combined'].includes(strategy)) {
4444
chain.module.rule('vue')
@@ -47,9 +47,9 @@ module.exports = (api, options) => {
4747
.options(strategy)
4848
.before('cache-loader')
4949
}
50-
else if (strategy !== void 0 && strategy !== 'manual') {
50+
else {
5151
console.error(`Incorrect setting for quasar > importStrategy (${strategy})`)
52-
console.error(`Use one of: 'kebab', 'pascal', 'combined', 'manual'.`)
52+
console.error(`Use one of: 'kebab', 'pascal', 'combined'.`)
5353
console.log()
5454
process.exit(1)
5555
}

prompts.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,6 @@ module.exports = [
88
default: true
99
},
1010

11-
{
12-
name: 'quasar.importStrategy',
13-
type: 'list',
14-
message: 'Pick a Quasar components & directives import strategy: (can be changed later)',
15-
choices: [
16-
{
17-
name: `Auto-import in-use Quasar components & directives (kebab-case, can be later changed to 'pascal'/'combined'/'manual')`,
18-
value: 'kebab',
19-
short: 'Auto import (kebab-case)',
20-
checked: true
21-
},
22-
{
23-
name: 'Manually specify what to import',
24-
value: 'manual',
25-
short: 'Manual'
26-
}
27-
]
28-
},
29-
3011
{
3112
name: 'quasar.cssPreprocessor',
3213
type: 'list',

0 commit comments

Comments
 (0)