feat: implement install functionality (under windows, using electron-squirrel-startup)

This commit is contained in:
Xymorot 2020-02-09 20:25:05 +01:00
parent c829193adf
commit 1f920796e0
5 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,4 @@
declare module 'electron-squirrel-startup' {
const checked: boolean;
export = checked;
}

23
package-lock.json generated
View File

@ -3498,6 +3498,29 @@
}
}
},
"electron-squirrel-startup": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/electron-squirrel-startup/-/electron-squirrel-startup-1.0.0.tgz",
"integrity": "sha1-GbTlWTP6Dvj1VnhLnGYPdyVGoLg=",
"requires": {
"debug": "^2.2.0"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"electron-winstaller": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/electron-winstaller/-/electron-winstaller-4.0.0.tgz",

View File

@ -41,6 +41,7 @@
"prepush": "npm run build && npm run coverage"
},
"dependencies": {
"electron-squirrel-startup": "^1.0.0",
"fs-extra": "^8.1.0",
"inversify": "^5.0.1",
"jsdom": "^15.2.1",

View File

@ -1,5 +1,13 @@
import { app } from 'electron';
/* eslint-disable import/order */
/**
* Disable Reasons
*
* import/order: this is the entry point for the application and some things have to happen before others
*/
import { container } from './main/core/container';
import './main/core/install';
import { app } from 'electron';
import { isDev } from './main/core/dev';
import { IAppWindow } from './main/modules/app-window/i-app-window';
import { ISession } from './main/modules/session/i-session';

6
src/main/core/install.ts Normal file
View File

@ -0,0 +1,6 @@
import { app } from 'electron';
import isInstallStartup from 'electron-squirrel-startup';
if (isInstallStartup) {
app.quit();
}