Developing Electron Apps

Misc

Upgrade Guide

We’ll cover how to upgrade to a new Quasar version in your project, both for UMD and using the project initialization feature of the CLI. Then we’ll go on to discuss how you can migrate v0.15 to v0.16 and your pre v0.15 project to v0.15+.

Upgrading to a newer Quasar version

This applies when upgrading from v0.15+ to a newer Quasar version, including v0.16 and v0.17.

IMPORTANTQuasar v0.15+ requires Node.js version 8.9.0 or greater

UMD

Simply replace the version string in all the CSS and JS tags that refer to Quasar to the newer version.

The CLI

As you may have noticed, the only dependency in your project (unless you’ve also installed a linter or your own deps) is quasar-cli. All you need is to update this dependency.

Quasar CLI is installed both globally and locally. When you issue a Quasar command, the global installation defers to the project locally installed Quasar CLI. This allows you to skip writing npm scripts in your package.json (for Quasar commands), and also it allows you to run different Quasar versions in multiple projects.

Watch for Quasar CLI version. It’s not the same thing as Quasar version. Type $ quasar info. All you need to know is that the major and minor part of Quasar CLI version matches Quasar version. So for example installing latest Quasar CLI v0.15.x will ensure you are using latest Quasar v0.15.x. While working on v0.15.x, no breaking changes will occur, so you are safe (& recommended) to upgrade to latest Quasar CLI as it’s released.

CaveatSometimes after you npm install a package, or even update current packages, might screw things up. You’ll get errors that some packages are missing and you need to install them. In such cases, delete node_modules and package-lock.json and npm install again.Same goes for Yarn. In case you get errors, delete node_modules and yarn.lock then install again.

Upgrading v0.16 to v0.17

There’s only one breaking change, regarding QLayoutDrawer mini-width prop. It is now a Number (instead of String!) defining width in pixels (default: 60).

v0.17 introduces the SSR mode for Quasar CLI, and the following changes will be required only if you build for SSR too. Otherwise, you can simply upgrade the quasar-cli dependency and benefit from the latest goodies.

A minor change that you should be aware of is that we are deprecating the special boot app plugin and it will be removed in the next version in favor of using the PreFetch Feature in src/App.vue and calling redirect(false) in case you want to abort the initial app render. For the time being it is still available, but you should migrate as soon as possible.

SSR mode (ONLY)

Like mentioned above, these changes will be required by the Quasar CLI only when you build with SSR mode. After doing these changes you’ll still be able to build the other modes (SPA/PWA/Cordova/Electron) too.

src/router/index.js

You need to have a default export set to “function ({ store })” which returns a new instance of Router instead of default exporting the Router instance itself.

Upgrading v0.15 to v0.16

The difference between Quasar v0.15.x and v0.16 is minimal. No big breaking changes as you can see below. The only reason for bumping Quasar’s version is to maintain consistency (same major + minor version) with Quasar CLI (which got an important update: webpack 4, babel 7, Workbox, electron-builder support, ionicons v4 and many more).

Upgrading from v0.15.x should be seamless if you are using Quasar CLI – which will guide you to do some minor changes to your project folder. Note that Ionicons v4 has breaking changes, so if you are using it in your project, then you need to update each such icon to its new name.

If you face any problems, there is probably something conflicting in your npm modules. It is either babel, webpack or eslint. The console messages will tell you more about what is wrong.

Remember you’ll be using Webpack 4, so all your webpack plugins must be compatible with it. For example, you need to upgrade to a newer eslint-loader, babel-eslint etc package if you already have it in your package.json as dev dependency.

If you’re using ESLint, make sure you have these in your package.json (minimum version required):

If you are seeing babel issues when you run quasar dev, then you have probably installed a package that is using babel-core instead of @babel/core - such as cypress-vue-unit-test. To find out which one it is, run: npm ls babel-core and then remove the offending source.

Upgrading pre v0.15 to Quasar v0.15+

There’s been A LOT of work done for v0.15. The Quasar CLI has been rewritten from scratch to allow for a stellar development experience (Mobile App developers and Electron will fall in love with it!). Only one CLI initialized project is required in order to handle websites, PWAs, Mobile Apps and Electron Apps. Building any of those is a matter of just adding a parameter to the dev/build command.

Furthermore, you can now use an UMD/standalone version of Quasar to embed in an existing project. No build step is required.

Take some time to read all “Guide” pages once again. It will help you understand the true power of Quasar v0.15+ and what you can do with it.

So, what is new and what has changed? Everything has been polished. The full list of enhancements and new features is exhausting. We’ll try to cover the major parts only. This is just a guide to get you started so that you know where to look in docs for things that have changed.

First step - when using the CLI

First we make sure we update the globally installed Quasar version (needs to be at least v0.15). Then we create a new project folder:

Observe the new project structure. Start to port out files to the new project folder, taking into account the far superior structure. Using the new project initialization feature will allow you to take advantage of future seamless upgrades! In any case, do not simply copy your /src folder over to the newly initialized project folder.

Build configuration no longer required

You’ll notice a newly initialized project doesn’t provide a /build or /config folders. They are no longer required. Everything can be easily configured from /quasar.conf.js now. You don’t need to know Webpack. More Info.

No main.js?

Yes. It’s no longer there because you don’t need it anymore. For initialization code and importing libraries into your website/app, read about App Plugins.

Importing Components/Directives/etc

Quasar Plugins?

Yes, this refers to Action Sheet, Notify (replacement of Toast and Alert), LocalStorage/SessionStorage and so on. They are available globally or under the Vue $q Object injection, and need to be specified in /quasar.conf.js > framework > plugins in order for them to be available.

Revamps

Typography

Flex CSS gutter classes

QLayout & co. You’ll love the new features! Be sure to check this out. Major improvements in syntax and flexibility. Some breaking changes, like slots no longer being used.

QBtn (new features!)

QToolbar (small update regarding buttons)

QBreadcrumbs (powerful component instead of just CSS)

QPagination (major improvements)

QCollapsible (new powerful features!)

QTable (replacing QDataTable – full customization now!)

Lists & List Items – more options, better control, “dark” theme

QTree (the most advanced you’ll ever see and need!)

ActionSheet (now as a Quasar Plugin & QActionSheet component too! – has new features too)

Dialog (now as a Quasar Plugin & QDialog component too for unlimited flexibility! – has new features too)

QModal - Easier to use than ever! Now with full v-model support.

QPopover & QTooltip - new animation, ability to close it without the need of a Vue reference (through v-close-overlay directive), full support for v-model now

We upgrade it to v0.15+. Notice that in order for us to place navigation tabs on header (for Material) and on Footer (for iOS), we also write a NavTabs component. Notice no slots, no QSideLink, “flat round dense” buttons, v-model on left/right drawers, QLayout* components:

Form Components

In previous versions you would listen for @change event to detect changes. Now you can listen to @input for immediate changes or @change for lazy update. Vue v-model.lazy support is a pending change, so until then you can use the equivalent form (details below).

You’ll notice all form components have been polished. Also, you’ll be pleasantly surprised by new properties. To name just a few: “hide-underline”, “inverted-light”, “dark” or “warning” (for highlighting a warning state).

Prior to v0.15, form components had a default margin. This was removed to allow easier customization. You can now use the new Spacing CSS classes to do it.

QCheckbox now supports an indeterminate state as well. You can specify a value for “true”/“false”/“indeterminate” states, so it no longer operates with Booleans (or Arrays) only.

QDatetime now doesn’t require the “Set” button when using Popovers. Clicking on a date will simply select it and close the popover.

QChipsInput (& QChips) have new props that allow for better customization now.

Using Promises

Modals, Popovers, Tooltips, Layout Drawer, Dialog, Notify (just to name a few) now use Promises instead of taking a callback parameter. This allows you to take advantage of async/await and simplifies your code.

Vue refs no longer necessary for a lot of components

You were also used to using Vue refs for a few components (Layout left/right drawer, Modals, …). This is no longer necessary. You can use a “v-model” instead to show (open) / hide (close) them. This wasn’t quite possible pre v0.15 because you needed for them to close in order to, as an example, navigate away. Now it’s no longer needed, so a Boolean scoped variable will suffice.

Some components need .native modifier for events now

Some components, like QItem or QCard & co now need the .native modifier for binding to native DOM events like click. A general rule is: if @click is not mentioned in the component’s docs Vue Events section, then you need to use the native modifier.

A few Quasar components were of functional type. These pass native events right through, so there’s no need to add the native modifier. But during a thorough benchmarking session it turned out having these as regular components meant better performance due to a number of reasons. Switching these components from functional to regular adds this small breaking change where you need to use the native modifier.

We were using different env for dev and production

You still can! Only now it’s even better, due to /quasar.conf.js features. More Info

New directive: v-close-overlay

All components using popups, like Modal, Dialog, Popover, Context Menu, now support a much simplified way of closing them. Instead of using a Vue reference, which is troublesome for some use cases, you can simply add v-close-overlay to the element/component that you wish to close the popup. This directive listens for the @click event, determines the first parent popup component and closes it.

Handling Back Button

Unfortunately, the automatic handling of back button was a one of the features that was the hardest to comprehend. It required you to handle Vue references (which beginners on Vue were struggling with) and didn’t fully allow you to connect components like Drawers & Modals to Vuex in an easy way. Now it only works on Mobile Apps (for example Android has a back button that is handled by Quasar). The removal of this feature for websites greatly simplify your code:

Quasar CLI and Pre-0.15 Apps

The Quasar CLI v0.15+ is not compatible with pre-0.15 apps. You can install the latest CLI globally while still supporting quasar commands in legacy apps by adding quasar-cli as a development dependency. To support 0.14 and earlier you need quasar-cli v0.6.5.