From e0e42aa2d53c264d9ff71287568db4c57851f00d Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Sun, 3 Sep 2017 15:55:11 -0700 Subject: [PATCH] feat(initializer): add electron-squirrel-startup to the default template --- src/init/init-npm.js | 2 +- tmpl/index.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/init/init-npm.js b/src/init/init-npm.js index bceaa7b35a..b8f39a4bec 100644 --- a/src/init/init-npm.js +++ b/src/init/init-npm.js @@ -10,7 +10,7 @@ import yarnOrNpm from '../util/yarn-or-npm'; const d = debug('electron-forge:init:npm'); -export const deps = ['electron-compile']; +export const deps = ['electron-compile', 'electron-squirrel-startup']; export const devDeps = ['babel-preset-env', 'babel-preset-react', 'babel-plugin-transform-async-to-generator', 'electron-forge']; export const exactDevDeps = ['electron-prebuilt-compile']; export const standardDeps = ['standard']; diff --git a/tmpl/index.js b/tmpl/index.js index ede0b3ec77..b15da870e0 100644 --- a/tmpl/index.js +++ b/tmpl/index.js @@ -1,5 +1,10 @@ import { app, BrowserWindow } from 'electron'; +// Handle creating/removing shortcuts on Windows when installing/uninstalling. +if (require('electron-squirrel-startup')) { + app.quit(); +} + // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. let mainWindow;