meteor-electron lets you easily transform your Meteor webapp to a desktop app. Its ultimate goal is
to build meteor add-platform desktop
.
Some of the things it does:
meteor add meson:electron
meteor-electron will download the Electron binary for your system and build and launch an Electron app pointing to your local development server. The download process may take a few minutes based on your Internet connection but only needs to be done once.
The app, as well as the ready-to-distribute binaries (see Deploy), is built within
YOUR_PROJECT_DIRECTORY/.meteor-electron
. This allows the apps to be easily located as well as the
builds to be cached for speedier startup. You should add this directory to your .gitignore
.
Configuration is possible via Meteor.settings.electron
. For example,
{
"electron": {
"name": "MyApp",
"icon": {
"darwin": "private/MyApp.icns",
"win32": "private/MyApp.ico"
},
"version": "0.1.0",
"description": "A really cool app.",
"rootUrl": "https://myapp.com",
"launchPath": "/app/landing",
"downloadUrls": {
"win32": "https://myapp.com/download/win/",
"darwin": "https://myapp.com/download/osx/{{version}}/MyApp.zip"
},
"sign": "Developer ID Application: ...",
"height": 768,
"width": 1024,
"frame": true,
"title-bar-style": "hidden",
"resizable": true,
"protocols": [{
"name": "MyApp",
"schemes": ["myapp"]
}],
"appSrcDir": "private/app"
}
}
By default, all client web code will be executed in Electron. To include/exclude code use Electron.isDesktop
if (!Electron.isDesktop()){
showModal("Have you considered downloading our Electron app?");
}
Hot code push will work to update your app's UI just like it does on the web, since the app is loading the UI
from the web. If you want to update the part of the app that interfaces with the OS, though—to change
the app icon, to add a menu bar icon, etc.—you'll need to distribute a new version of the .app
or
.exe
. Here's how to do that.
Meteor.settings.electron.autoPackage
to true
to ZIP your app for distribution after it is
built.Meteor.settings.electron.sign
to the name of that certificate.YOUR_PROJECT_DIRECTORY/.meteor-electron/darwin-x64/final/YOUR_APP_NAME.zip
to a publically-accessible
location.downloadUrls.darwin
in Meteor.settings.electron
to the URL of the location where you copied the ZIP.Downloads of the Mac app will be served at your webapp's ROOT_URL
+ /app/download?platform=darwin
.
name
, version
, and description
in Meteor.settings.electron
.Meteor.settings.electron.downloadUrls.win32
has an empty RELEASES
file.remoteReleases
should be your webapp's ROOT_URL
+ '/app/latest'.Meteor.settings.electron.downloadUrls.win32
, to be served
from that location.RELEASES
file,
and new installers. After copying these to Meteor.settings.electron.downloadUrls.win32
again (overwriting
the RELEASES
file and installers), apps that check for updates should receive a new version.Downloads of the Windows installer will be served at your webapp's ROOT_URL
+ /app/download?platform=win32
.
brew update
brew install wine
{
"electron": {
"builds": [
{"platform": "win32",
"arch": "ia32"}
]
}
}
[TODO] Link to an awesome chat app
This package differs from Electrometeor and Electrify by not baking Meteor into the packaged app. This makes things significantly simpler, but if you need strong offline support, one of them is a better solution.
This project selectively exposes such functionality to the client, in a way that is safe and avoids
memory leaks, via the Electron
module--see client.js
. To request that this module
expose additional functionality, please submit a pull request
or file an issue.
You may also substitute your own application code for meteor-electron
's default application by
setting the appSrcDir
settings option. meteor-electron
will continue to package your application
and serve the application update feed and download URLs, but in-app functionality will be your
responsibility. Warning: this responsibility includes setting up your application window and menu,
checking for remote updates, registering the Electron
module (that defines Electron.isDesktop
),
and possibly other things. If you take this route, it's recommended that you start by copying
meteor-electron
's app
directory.
Also, you also probably want to keep your application code in a subdirectory of your application's
private
directory so that Meteor will observe changes to it and restart the server; when it does
so, meteor-electron
will rebuild and relaunch the app.
Set Meteor.settings.electron.autoBuild
to "false"
.