It seems that makeSingleInstance will always return true in the MAS
build.* Luckily, OSX mostly enforces single-instance for us when opening
the app from Finder. If the user attempts to run a second instance from
the command line, it will create a window but fail to load.
*TODO: Revisit why makeSingleInstance is broken in the MAS build.
// FREEBIE
Traditionally, NODE_ENV refers to an environment variable. For clarity,
let's keep it that way and don't reuse it in the renderer. Also, add a
note about explicitly overriding env vars for node-config.
// FREEBIE
Add the buildExpiration config and add it to the renderer's config
object. Use grunt to write the build expiration to
config/local-production.json which will override the default value (no
expiration) in production. Finally, run this grunt task as part of the
build process.
// FREEBIE
We only set the environment in package.json when it is packaged for
deployment. When we do that, we don't want to allow a local environment
variable to override it.
// FREEBIE
Add environment-specific configs under `./config` and integrate with the
build system. Also changes package.json `files` from blacklist to
whitelist.
// FREEBIE
Just use the english locale for now. Load locale data from the
filesystem in the main process and pass it to the renderer preload
script via ipc. Note that we need the locale data to be available by the
time view scripts are loaded.
// FREEBIE
Set NODE_ENV at run time or build time to switch the app between dev and
production modes.
At build time, the current NODE_ENV will be included in the packaged
app's package.json file. At runtime we read NODE_ENV from package.json,
but also allow the local environment variable to override. A query
string parsed by a preload script exposes the value to the renderer,
which then determines whether we use the staging or production server.
Additionally, different environments have different user data
directories.
// FREEBIE
It is also important to set the Application User Model ID (AUMID) to the
appId of the application, in order for notifications on Windows 8/8.1 to
function and for Window 10 notifications to display the app icon within
the notifications by default. The AUIMD should be set within the Main
process and before any BrowserWindows have been opened, it is normally
the first piece of code executed.
https://github.com/electron-userland/electron-builder/wiki/NSIS#guid-vs-application-name
// FREEBIE
In package.json, define our main entry point for electron, and add a
node script to start it up.
Add main.js from Electron/electron-quick-start with two modifications.
1. Load background.html instead of index.html
2. Disable node integration in the renderer
At this point we can load the background page in a window
with `npm start`, though it currently breaks on missing chrome app APIs.
// FREEBIE