vue-cli-plugin-electron-builder

Easily Build Your Vue.js App For Desktop With Electron

MIT License

Downloads
23.4K
Stars
4.1K
Committers
41
vue-cli-plugin-electron-builder - V3 Alpha! Latest Release

Published by nklayman almost 3 years ago

I'm happy to announce the first alpha of v3 is here! This release mainly updates all dependencies and cleans up some legacy code. There are no docs yet and this hasn't been tested thoroughly so be careful when using this in production. Please give me feedback and issue reports so I can promote this to stable ASAP.

Key Features/Fixes

  • Latest Electron versions are now supported in the generator
  • Spectron is dropped in favor of Playwright which should provide a much better testing experience
  • Webpack 5 is now used for the main process
  • New native dependency checker is enabled by default (#861)
  • A more secure custom protocol implementation is used that prevents path traversal (thanks to https://github.com/moloch--/reasonably-secure-electron for code)

Upgrading/Breaking Changes

  • Install this version with vue add electron-builder@alpha
  • Using Vue CLI v5 is recommended
  • Remove the main field from your package.json
  • Make sure your custom main process webpack config works with webpack v5
  • background.js shouldn't require any changes, but you can remove the enableRemoteModule setting for Spectron if it's there
  • Migrate from Spectron to Playwright: testWithSpectron has been renamed to testWithPlaywright, and doesn't take the Spectron import as an arg. The returned app is now a Playwright ElectronApplication instead of a Spectron instance, and stopServe has been renamed to stop. You don't need to install Playwright, it's a dependency of this plugin.
  • In theory, everything else should continue to work as before, open an issue if it doesn't

TODO

  • Support Mocha for testing (only Jest is supported for now)
  • Update internal testing
  • Update docs
vue-cli-plugin-electron-builder - V 2.0.0!!!!

Published by nklayman over 3 years ago

This release has been long overdue and this plugin has been in the RC state for way too long, sorry for the delay. Anyways, better late than never, so here it is! If you were running the latest RC previously, there aren't any breaking changes or required migration steps. Thank you to all my supporters who have funded this project and made this release possible ❤️❤️!!

Breaking Changes from v1.x

A few major deps were upgraded:

  • teser-webpack-plugin ^1.1.0 -> ^2.0.0
  • webpack-chain ^5.0.0 -> ^6.0.0
  • execa: ^1.0.0 -> ^4.0.0
  • electron-builder: ^21.2.0 -> 22.2.0

These upgrades may cause breaking changes depending on your specific application.

The internal tests are now run on vue cli v4, and it is recommended that you update your app to vue cli v4 as well.

Fixes and Features

  • Support latest electron versions
  • nodeIntegration is now optional (and disabled by default), #610
  • electron-builder will now work on macos catalina, #617
  • You can now use the proper spectron version, #467
  • Removed fonts duplication in build, #694
  • You can now bundle preload files with webpack (docs), #613
  • New native dep checker, try it out now! (#861)
  • Vue devtools enabled by default on Electron v8/9 (#378)
  • Support package.json without dependencies field (#828)
  • Support electron being listed in dependencies as well as devDependencies (#829)
  • Support nested pages (#786)
  • And a lot more smaller fixes

Migrating a v1.x Project:

  1. Run (yarn add | npm install) -D vue-cli-plugin-electron-builder@latest to install the 2.0 version of the plugin.
  2. In your background.(js|ts), replace nodeIntegration:true with:
// Use pluginOptions.nodeIntegration, leave this alone 
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info 
   nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION 
  1. If your app requires nodeIntegration, enable it in vue.config.js:
module.exports = {
  pluginOptions: {
    electronBuilder: {
      nodeIntegration: true
    }
  }
}
  1. If you used the testWithSpectron function, install the proper version of spectron according to the version map, and pass the spectron import at the first argument of all of your testWithSpectron calls. See the docs for more details.
  2. If you used jest, set the test environment to node in each electron test file. See the docs for more details.
  3. Update your main process file (src/background.js by default) to use electron-devtools-installer:
import {
  createProtocol,
- installVueDevtools
} from 'vue-cli-plugin-electron-builder/lib'
+ import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'

... (around line 77)

-await installVueDevtools()
+await installExtension(VUEJS_DEVTOOLS)

And then run npm i -D electron-devtools-installer/yarn add -D electron-devtools-installer.

After following these steps, your project should be good to go with v2.0!

vue-cli-plugin-electron-builder - v2.0.0-rc.4 - Switch to electron-devtools-installer

Published by nklayman over 4 years ago

From now on, whenever you add this plugin to your project, electron-devtools-installer will be used instead of the provided installVueDevtools function. This function was based off of electron-devtools-installer but with some fixes. These fixes have since been merged into electron-devtools-installer (as well as new features like electron v9 support). It is recommended that you switch to electron-devtools-installer as the installVueDevtools function will be removed in the 2.0.0 final release. To do so, edit your background.(js|ts):

import {
  createProtocol,
- installVueDevtools
} from 'vue-cli-plugin-electron-builder/lib'
+ import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'

... (around line 77)

-await installVueDevtools()
+await installExtension(VUEJS_DEVTOOLS)

And then run npm i -D electron-devtools-installer/yarn add -D electron-devtools-installer.

vue-cli-plugin-electron-builder - v2.0.0-rc.3 - New native dep checker

Published by nklayman over 4 years ago

Features:

  • New native dep checker, try it out now! (#861)
  • Vue devtools enabled by default on Electron v8/9 (#378)

Fixes:

  • Support package.json without dependencies field (#828)
  • Support electron being listed in dependencies as well as devDependencies (#829)
vue-cli-plugin-electron-builder - v2.0.0-rc.2

Published by nklayman over 4 years ago

This release contains a handful of fixes:

  • Static assets from public folder wouldn't load due to incorrect process.env.BASE_URL (#803)
  • Type error in background.ts related to process.env.NODE_INTEGRATION (#801)
  • Support nested pages (#786)
vue-cli-plugin-electron-builder - 2.0 Release Candidate!

Published by nklayman over 4 years ago

Breaking Changes

  • The testWithSpectron function requires you pass the spectron module as it's first arg, allowing you to specify the version of spectron to be used. You will need to install spectron as a devDependency
  • Jest tests must be run with testEnvironment set to node, see the examples for more details
  • Node integration is disabled by default

A few major deps were upgraded:

  • teser-webpack-plugin ^1.1.0 -> ^2.0.0
  • webpack-chain ^5.0.0 -> ^6.0.0
  • execa: ^1.0.0 -> ^4.0.0
  • electron-builder: ^21.2.0 -> 22.2.0

These upgrades may cause breaking changes depending on your specific application.

The internal tests are now run on vue cli v4, and it is recommended that you update your app to vue cli v4 as well.

Fixes and Features

  • Support electron v7 (+ v8 and v9), #555
  • nodeIntegration is now optional (and disabled by default), #610
  • electron-builder will now work on macos catalina, #617
  • You can now use the proper spectron version, #467
  • Removed fonts duplication in build, #694
  • You can now bundle preload files with webpack (docs), #613

Migrating a v1.x Project:

  1. Run (yarn add | npm install) -D vue-cli-plugin-electron-builder@latest to install the 2.0 version of the plugin.
  2. In your background.(js|ts), replace nodeIntegration:true with:
// Use pluginOptions.nodeIntegration, leave this alone 
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info 
   nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION 
  1. If your app requires nodeIntegration, enable it in vue.config.js:
module.exports = {
  pluginOptions: {
    electronBuilder: {
      nodeIntegration: true
    }
  }
}
  1. If you used the testWithSpectron function, install the proper version of spectron according to the version map, and pass the spectron import at the first argument of all of your testWithSpectron calls. See the docs for more details.
  2. If you used jest, set the test environment to node in each electron test file. See the docs for more details.
vue-cli-plugin-electron-builder - v2.0.0 Beta - new deps, spectron fixes, disabling nodeIntegration

Published by nklayman almost 5 years ago

Breaking changes

  • The testWithSpectron function requires you pass the spectron module as it's first arg, allowing you to specify the version of spectron to be used. You will need to install spectron as a devDependency
  • Jest tests must be run with testEnvironment set to node, see the examples for more details
  • Node integration is disabled by default

A few major deps were upgraded:
teser-webpack-plugin ^1.1.0 -> ^2.0.0
webpack-chain ^5.0.0 -> ^6.0.0
execa: ^1.0.0 -> ^3.0.0
electron-builder: ^21.2.0 -> 22.2.0

These upgrades may cause breaking changes depending on your specific application.

The internal tests are now run on vue cli v4, and it is recommended that you update your app to vue cli v4 as well.

Fixes and Features

  • Support electron v7, #555
  • nodeIntegration is now optional, #610
  • electron-builder will now work on macos catalina, #617
  • You can now use the proper spectron version, #467
  • Removed fonts duplication in build, #694

Known Issues

  • #647: stopServe() in testWithSpectron() may throw setTimeout(...).unref is not a function

Migrating a v1.x project:

  1. In your background.(js|ts), replace nodeIntegration:true with:
// Use pluginOptions.nodeIntegration, leave this alone 
// See https://github.com/nklayman/vue-cli-plugin-electron-builder/blob/v2/docs/guide/configuration.md#node-integration for more info 
   nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION 
  1. If your app requires nodeIntegration, enable it in vue.config.js:
module.exports = {
  pluginOptions: {
    electronBuilder: {
      nodeIntegration: true
    }
  }
}
  1. If you used the testWithSpectron function, install the proper version of spectron according to the version map, and pass the spectron import at the first argument of all of your testWithSpectron calls. See the docs for more details.
  2. If you used jest, set the test environment to node in each electron test file. See the docs for more details.
vue-cli-plugin-electron-builder - 1.4.0 - Electron 6 support

Published by nklayman about 5 years ago

This release adds support for electron 6.0.0. However, there are issues with devtools extensions, so vue devtools are disabled by default if electron v6.0.0 is selected.

vue-cli-plugin-electron-builder - 1.3.0 - Electron 5.0 support, better main process file watching

Published by nklayman over 5 years ago

Features:

  • Support for electron 5.0 (#250, 34e80e1168c5fc11472fb8d8f5599519e5ba0a0c)
  • Use chokidar for main process file watching to support directory watching (#247, 7e3505b1ef4394a042e3d1b9c2cccb3d74d4effa)

Thanks to @Akryum for the Chokidar PR!

vue-cli-plugin-electron-builder - 1.2.0 - Only include external deps in build, other fixes

Published by nklayman over 5 years ago

With this release, non external deps will not be included in your built app to reduce it's size.

Features:

  • Only include external deps (#223, cd3d9ab413d52a80ea85c8e1ef68fe7482387aae)
    Fixes:
  • rebuild background on change when in debug mode (fb5131374c7114564d1c069adb4c823fd663a517)
  • multi page configuration using objects fixed (2af978aa244ed848e76804078c456ae827bb19cd)
vue-cli-plugin-electron-builder - 1.1.0 - No more legacy builds

Published by nklayman over 5 years ago

With this release, only the modern build is run when building for production (requires @vue/cli-service v3.4.1). Previously, both the legacy and the modern build had to be run, even though the legacy build is never used. It also includes a few bug fixes (check the commit log for more details).

vue-cli-plugin-electron-builder - 1.0.0!🎉

Published by nklayman over 5 years ago

After closing 163 issues, writing thousands of lines of code across 251 commits, and spending countless hours in front of a computer, 1.0.0 is finally here! We now have 0 open issues (not sure how long that will last 🤔), a pretty good sign of stability 👍. This release includes a few features as well:

Features:

  • Mocha tests will be added when plugin is installed (#128, e99bba0f056b2b970b9508c3474163d24f79b778)
  • You can now use a custom file protocol with the customFileProtocol configuration option (#183, 3bf42d47c8ca4e195dbd216f4a062d1fc1715934)

Thanks to everyone who clicked that ⭐ (we're almost at 500!!!), reported an issue, requested a feature, or made a PR (extra thanks)!

vue-cli-plugin-electron-builder - RC 11 - Fix with latest vue-cli, process.env.IS_ELECTRON

Published by nklayman over 5 years ago

This release include a fix with the latest version of vue-cli (publicPath and baseUrl), as well as some other fixes and features.

Features:

  • Command line args are now passed to electron in electron:serve (#185, 0e2b395cc261237135099e77110e501519f609c0)
  • process.env.IS_ELECTRON is now set accordingly (#181, 346701f3252b04a765d52523eee902469f07839d)

Bug Fixes:

  • Broken vue cli ui pages are now removed (#48, 793805e5c5eb11c46ddcfddf995a60a0d37bd616)
  • electron:build now works properly with vue-cli 3.3.0 (#177, 28b5be002b1f719f02a4c5f9b4e0cc99c44acd78)
  • electron-builder install-app-deps is now run on postuninstall as well as postinstall (#168, f9f8b470479dc2671ad149a809abce7322d308e2)
vue-cli-plugin-electron-builder - RC 10 - Small fixes, electron v4

Published by nklayman almost 6 years ago

With 1.0.0-rc.10, electron ^4.0.0 will be available for use when invoking the generator, and ^3.0.0 will be the default. Internally (for testing), electron v4 is used, along with spectron v5. The background.js no longer relies on process.env.NODE_ENV to determine whether to load from the dev server or from the packaged app (#164).

vue-cli-plugin-electron-builder - RC 9 - Fix security vulnerability!

Published by nklayman almost 6 years ago

This release removes use of flatmap-stream, which contains a major security vulnerability, used in event-stream. Also, make sure you read this message and follow the instructions there!

vue-cli-plugin-electron-builder - RC 8 - Bug fixes, automatic testing with Jest

Published by nklayman almost 6 years ago

Features:

  • If your project uses Jest, you will be prompted to set up a Spectron test when adding this plugin (#128, 57895c78a2f5da39a26f0ab0ad6dbaad6e950e24)

Bug fixes:

vue-cli-plugin-electron-builder - RC 6/7 - Issues with electron v3

Published by nklayman almost 6 years ago

These releases fix #117, where installVueDevtools() would not return a promise. If you are using electron@^3.0.0, it is recommended that you upgrade. You do not need to re-invoke the generator.

vue-cli-plugin-electron-builder - RC 5 - Electron 3 issues on linux, remove need for `<base>` tag

Published by nklayman about 6 years ago

This release includes a hotfix for #117, where Electron v3 would only display a blank screen. It also removes the need of the <base> tag in the index.html. After updating, remove that line, and your app will continue to work as normal.

vue-cli-plugin-electron-builder - RC 4 - BREAKING CHANGE, new command names, lots of fixes and features

Published by nklayman about 6 years ago

Breaking Changes

Yes, I know it is in RC phase, but these needed to happen before the final release.

This release changes the command names!
Before:
yarn (serve|build):electron
After:
yarn electron:(serve|build)
This was changed to make it match other Vue CLI Plugins, see #94 for more info.

You MUST re-invoke the generator if you upgrade to this version. To do so, run vue invoke electron-builder. This is caused because:
Previously, your app would be packaged relative to the project's root. Since your built code is placed in dist_electron/bundled, __dirname in a built app would be [path-to-install]/resources/app.asar/dist_electron/bundled/. Now, it is packaged relative to dist_electron/bundled. In a built app, __dirname would be [path-to-install]/resources/app.asar/. __static and process.env.BASE_URL will still function the same.

Features

  • You can now choose your desired Electron version when adding this plugin (ec4836908078cdbe03980058335e0c8cea14562e)
  • CLI output is prettier, and errors when bundling the main process are friendlier (#105, 61510e717860a9cbe58842e157f8d42efb472dc4)
  • Custom electron args are now supported (#93, b45b2ef24151a56d20dd4aa6c9074be825d04575) thanks @zdevwu
  • The output dir can be set with --dest, and changing it no longer requires you to set the main property of your package.json (7e4afa689effb6a4fac999a656f54a52ae44beba)
  • Environment variables prefixed with VUE_APP_ can now be accessed in the main process (#83, 23ff11be10a725af00e77f474494e397f3f2de4d)

Bug Fixes

  • Electron is killed gracefully during development (#110, ed0bcb8e517500fd31bd6a23f9ae38b27da9f474) Huge thanks to @Desuuuu
  • Entry name is now used as output file. This makes it easier to add files to the main process bundling (#106, dc9940b5a13de955f46d1a380e739bb576c0c202)
  • The installation process of VueJS devtools now supports a dynamically set userData path (83229ec573a8a8c8eb4589db51384e9406bcf1f0)
vue-cli-plugin-electron-builder - RC 3 - Bug fixes and some new features

Published by nklayman about 6 years ago

12 issues have been closed since the last release 🎉! This means a lot of small features/fixes.

A few new features

  • Electron's junk output is now stripped from the terminal (#60, da4033e85f64df135bedc320c2812325d0eb046c)
  • --skipBundle only runs electron-builder, skipping all bundling (#70, 368a9e4ab66ad20770611aa724ea42d0d1a261a0)
  • --legacy disables modern mode while bundling the renderer process (#71, 368a9e4ab66ad20770611aa724ea42d0d1a261a0)
  • Add support for custom node_modules folder path when detecting externals (#75, 4cb68866da88778edf1ab77e86bc1e44dd7e8554)

And, the bug fixes

  • Support not having a css folder inside dist_electron/bundled (#64, e3cb7cb2e757e0fdaff8f64f596c8a883245be20)
  • Fixes electron not detecting app's product name (#74, 6c76898874035f98d9160d1f01a8eb2f8fc18244)
Package Rankings
Top 1.19% on Npmjs.org
Top 6.73% on Proxy.golang.org
Badges
Extracted from project README
Build status
Related Projects