Skip to content

Commit 3507d8d

Browse files
committed
Merge branch 'next' into dev
2 parents 11942a8 + bf91ecf commit 3507d8d

File tree

17 files changed

+167
-174
lines changed

17 files changed

+167
-174
lines changed

README.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Quasar Framework: vue-cli-plugin-quasar
44

5-
> :rocket: Start building a Vue app with Quasar Framework v1 (Vue 2) in 2 minutes!
5+
> :rocket: Start building a Vue app with Quasar Framework v2 in 2 minutes!
66
77
> :warning: **For the premium (and recommended) experience with Quasar, including the ability to build Mobile & Electron apps and efortless upgrades to new Quasar versions, you should instead use Quasar CLI**
88
@@ -14,28 +14,32 @@ Please submit a PR to https://github.com/quasarframework/quasar-awesome with you
1414

1515
## Getting started
1616

17-
:warning: Make sure you have vue-cli v3/v4:
17+
:warning: Make sure you have vue-cli 4.5.1+:
1818

1919
```
2020
vue --version
2121
```
2222

23-
If you don't have a project created with vue-cli v3/v4 yet:
23+
If you don't have a project created with vue-cli 4.5.1+ yet:
2424

2525
```
26+
# make sure to pick Vue 3 when asked:
2627
vue create my-app
2728
```
2829

2930
Navigate to the newly created project folder and add the cli plugin. Before installing it, make sure to commit your current changes should you wish to revert them later.
3031

3132
```
32-
cd my-app
33-
vue add quasar
33+
# commands will change after Quasar v2 becomes stable (and out of beta)
34+
35+
$ cd my-app
36+
$ yarn add --dev vue-cli-plugin-quasar@next
37+
$ vue invoke quasar
3438
```
3539

3640
It will ask you if you want the plugin to replace some existing files. It is recommended that you do it if you wish to have an example so you can quickly develop your app.
3741

38-
Your Vue config (in package.json or vue.config.js file, depending on what you chose when you created your vue app) will also contain a `quasar` Object. Most important property is `theme` (with possible values "mat" or "ios"), which you can later change should you want.
42+
Your Vue config (in package.json or vue.config.js file, depending on what you chose when you created your vue app) will also contain a `quasar` Object.
3943

4044
## Supporting Quasar
4145
Quasar Framework is an MIT-licensed open source project. Its ongoing development is made possible thanks to the support by these awesome [backers](https://github.com/rstoenescu/quasar-framework/blob/dev/backers.md).

generator/index.js

+25-39
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const fs = require('fs'),
2-
extendPluginOptions = require('../lib/extendPluginOptions')
1+
const fs = require('fs')
2+
const extendPluginOptions = require('../lib/extendPluginOptions')
33

44
const message = `
55
Documentation can be found at: https://quasar.dev
@@ -27,13 +27,13 @@ const plugins = []
2727

2828
module.exports = (api, opts) => {
2929
const
30-
quasarPath = api.resolve('./src/quasar.js'),
30+
quasarPath = api.resolve('./src/quasar-user-options.js'),
3131
tsPath = api.resolve('./src/main.ts'),
3232
jsPath = api.resolve('./src/main.js'),
3333
hasTS = fs.existsSync(tsPath)
3434

3535
const dependencies = {
36-
quasar: '^1.0.0',
36+
quasar: '^2.0.0',
3737
'@quasar/extras': '^1.0.0'
3838
}
3939

@@ -42,16 +42,10 @@ module.exports = (api, opts) => {
4242
devDependencies: {}
4343
}
4444

45-
if (opts.quasar.cssPreprocessor === 'styl') {
45+
if (['sass', 'scss'].includes(opts.quasar.cssPreprocessor)) {
4646
Object.assign(deps.devDependencies, {
47-
stylus: '^0.54.5',
48-
'stylus-loader': '^3.0.2'
49-
})
50-
}
51-
else if (['sass', 'scss'].includes(opts.quasar.cssPreprocessor)) {
52-
Object.assign(deps.devDependencies, {
53-
'node-sass': '^4.13.0',
54-
'sass-loader': '^8.0.0'
47+
'sass': '1.32.12',
48+
'sass-loader': '^10.1.0'
5549
})
5650
}
5751

@@ -102,64 +96,55 @@ module.exports = (api, opts) => {
10296
}
10397

10498
api.onCreateComplete(() => {
105-
let lines = `import Vue from 'vue'\n`
99+
let qFileLines = ''
106100

107101
const
108102
hasIconSet = opts.quasar.iconSet !== 'material-icons',
109-
hasLang = opts.quasar.lang !== 'en-us'
103+
hasLang = opts.quasar.lang !== 'en-US'
110104

111105
if (!opts.quasar.features.includes(opts.quasar.iconSet)) {
112106
opts.quasar.features.push(opts.quasar.iconSet)
113107
}
114108

115109
if (opts.quasar.cssPreprocessor !== 'none') {
116-
lines += `\nimport './styles/quasar.${opts.quasar.cssPreprocessor}'`
110+
qFileLines += `\nimport './styles/quasar.${opts.quasar.cssPreprocessor}'`
117111
}
118112
else {
119-
lines += `\nimport 'quasar/dist/quasar.css'`
120-
}
121-
122-
if (opts.quasar.features.includes('ie')) {
123-
lines += `\nimport 'quasar/dist/quasar.ie.polyfills'`
113+
qFileLines += `\nimport 'quasar/dist/quasar.css'`
124114
}
125115

126116
if (hasIconSet) {
127117
const set = iconMap[opts.quasar.iconSet] || opts.quasar.iconSet
128-
lines += `\nimport iconSet from 'quasar/icon-set/${set}.js'`
118+
qFileLines += `\nimport iconSet from 'quasar/icon-set/${set}.js'`
129119
}
130120

131121
if (hasLang) {
132-
lines += `\nimport lang from 'quasar/lang/${opts.quasar.lang}.js'`
122+
qFileLines += `\nimport lang from 'quasar/lang/${opts.quasar.lang}.js'`
133123
}
134124

135125
opts.quasar.features
136-
.filter(feat => feat !== 'ie')
137126
.forEach(feat => {
138127
feat = iconMap[feat] || feat
139-
lines += `\nimport '@quasar/extras/${feat}/${feat}.css'`
128+
qFileLines += `\nimport '@quasar/extras/${feat}/${feat}.css'`
140129
})
141130

142-
// build import
143-
lines += `\nimport { Quasar } from 'quasar'`
144-
145-
// build Vue.use()
146-
lines += `\n\nVue.use(Quasar, {`
147-
lines += `\n config: {}`
131+
qFileLines += `\n\n// To be used on app.use(Quasar, { ... })\nexport default {`
132+
qFileLines += `\n config: {}`
148133

149-
lines += ',\n plugins: {'
134+
qFileLines += ',\n plugins: {'
150135
plugins.forEach(part => {
151-
lines += `\n ${part},`
136+
qFileLines += `\n ${part},`
152137
})
153-
lines += `\n }`
138+
qFileLines += `\n }`
154139

155140
if (hasLang) {
156-
lines += `,\n lang: lang`
141+
qFileLines += `,\n lang: lang`
157142
}
158143
if (hasIconSet) {
159-
lines += `,\n iconSet: iconSet`
144+
qFileLines += `,\n iconSet: iconSet`
160145
}
161146

162-
lines += `\n })`
147+
qFileLines += `\n}`
163148

164149
// Now inject additions to main.[js|ts]
165150
{
@@ -169,12 +154,13 @@ module.exports = (api, opts) => {
169154
const mainLines = content.split(/\r?\n/g).reverse()
170155

171156
const index = mainLines.findIndex(line => line.match(/^import/))
172-
mainLines[index] += `\nimport './quasar'`
157+
mainLines[index] += `\nimport { Quasar } from 'quasar'\nimport quasarUserOptions from './quasar-user-options'`
173158

174159
content = mainLines.reverse().join('\n')
160+
content = content.replace('createApp(App)', `createApp(App).use(Quasar, quasarUserOptions)`)
175161
fs.writeFileSync(mainPath, content, { encoding: 'utf8' })
176162

177-
fs.writeFileSync(quasarPath, lines, { encoding: 'utf8' })
163+
fs.writeFileSync(quasarPath, qFileLines, { encoding: 'utf8' })
178164
}
179165

180166
if (api.generator.hasPlugin('@vue/cli-plugin-eslint')) {

generator/templates/styl/src/styles/quasar.styl

-3
This file was deleted.

generator/templates/styl/src/styles/quasar.variables.styl

-15
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
<template>
2-
<div id="app">
3-
<router-view/>
4-
</div>
2+
<router-view/>
53
</template>

generator/templates/with-router-base/src/views/Home.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<q-page class="flex flex-center">
3-
<img alt="Quasar logo" src="../assets/logo.svg" style="width: 200px; height: 200px;">
3+
<img alt="Quasar logo" src="../assets/logo.svg" style="width: 200px; height: 200px">
44
</q-page>
55
</template>
66

Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1-
import Vue from 'vue'
2-
import Router from 'vue-router'
1+
import { createRouter, createWebHistory } from 'vue-router'
32
import DefaultLayout from './layouts/Default.vue'
43
import Home from './views/Home.vue'
54
import About from './views/About.vue'
65

7-
Vue.use(Router)
6+
const routes = [
7+
{
8+
path: '/',
9+
component: DefaultLayout,
10+
children: [
11+
{
12+
path: '',
13+
name: 'home',
14+
component: Home
15+
},
16+
{
17+
path: '/about',
18+
name: 'about',
19+
component: About
20+
}
21+
]
22+
}
23+
]
824

9-
export default new Router({
10-
routes: [
11-
{
12-
path: '/',
13-
component: DefaultLayout,
14-
children: [
15-
{
16-
path: '',
17-
name: 'home',
18-
component: Home
19-
},
20-
{
21-
path: '/about',
22-
name: 'about',
23-
component: About
24-
}
25-
]
26-
}
27-
]
25+
const router = createRouter({
26+
history: createWebHistory(process.env.BASE_URL),
27+
routes
2828
})
29+
30+
export default router
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1-
import Vue from 'vue'
2-
import Router from 'vue-router'
1+
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
32
import DefaultLayout from './layouts/Default.vue'
43
import Home from './views/Home.vue'
54
import About from './views/About.vue'
65

7-
Vue.use(Router)
6+
const routes: Array<RouteRecordRaw> = [
7+
{
8+
path: '/',
9+
component: DefaultLayout,
10+
children: [
11+
{
12+
path: '',
13+
name: 'home',
14+
component: Home
15+
},
16+
{
17+
path: '/about',
18+
name: 'about',
19+
component: About
20+
}
21+
]
22+
}
23+
]
824

9-
export default new Router({
10-
routes: [
11-
{
12-
path: '/',
13-
component: DefaultLayout,
14-
children: [
15-
{
16-
path: '',
17-
name: 'home',
18-
component: Home
19-
},
20-
{
21-
path: '/about',
22-
name: 'about',
23-
component: About
24-
}
25-
]
26-
}
27-
]
25+
const router = createRouter({
26+
history: createWebHistory(process.env.BASE_URL),
27+
routes
2828
})
29+
30+
export default router

generator/templates/with-router/src/layouts/Default.vue

+5-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
v-model="leftDrawerOpen"
2424
show-if-above
2525
bordered
26-
content-class="bg-grey-2"
26+
class="bg-grey-2"
2727
>
2828
<q-list>
2929
<q-item-label header>Navigation</q-item-label>
@@ -100,12 +100,14 @@
100100
</template>
101101

102102
<script>
103+
import { ref } from 'vue'
104+
103105
export default {
104106
name: 'LayoutDefault',
105107
106-
data () {
108+
setup () {
107109
return {
108-
leftDrawerOpen: false
110+
leftDrawerOpen: ref(false)
109111
}
110112
}
111113
}

generator/templates/without-router-base/src/components/HelloWorld.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<q-page class="flex flex-center">
3-
<img alt="Quasar logo" src="../assets/logo.svg" style="width: 200px; height: 200px;">
3+
<img alt="Quasar logo" src="../assets/logo.svg" style="width: 200px; height: 200px">
44
</q-page>
55
</template>
66

generator/templates/without-router/src/App.vue

+4-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
v-model="leftDrawerOpen"
2424
show-if-above
2525
bordered
26-
content-class="bg-grey-2"
26+
class="bg-grey-2"
2727
>
2828
<q-list>
2929
<q-item-label header>Essential Links</q-item-label>
@@ -82,6 +82,7 @@
8282
</template>
8383

8484
<script>
85+
import { ref } from 'vue'
8586
import HelloWorld from './components/HelloWorld.vue'
8687
8788
export default {
@@ -91,13 +92,10 @@ export default {
9192
HelloWorld
9293
},
9394
94-
data () {
95+
setup () {
9596
return {
96-
leftDrawerOpen: false
97+
leftDrawerOpen: ref(false)
9798
}
9899
}
99100
}
100101
</script>
101-
102-
<style>
103-
</style>

0 commit comments

Comments
 (0)