From a4abddfb6a2ff6865aac0cc65bf52d6ca911378e Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 17 Jan 2018 15:42:28 -0500 Subject: [PATCH] electron npm script --- package.json | 2 +- src/main.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 772aa7f436..ca401ce690 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "lint": "tslint src/**/*.ts || true", "lint:fix": "tslint src/**/*.ts --fix", "server": "webpack-dev-server --inline --progress --port 8080 --config webpack.dev.js", - "electron:dev": "npm run dev && tsc src/main.ts --outDir build && electron ./build --serve" + "electron": "npm run dev && tsc src/main.ts --outDir build && electron ./build --dev --watch" }, "devDependencies": { "@bitwarden/jslib": "git+https://github.com/bitwarden/jslib.git", diff --git a/src/main.ts b/src/main.ts index 1e7253b911..22f359a9a9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,9 +4,10 @@ import * as url from 'url'; let win: BrowserWindow; const args = process.argv.slice(1); -const serve = args.some((val) => val === '--serve'); +const watch = args.some((val) => val === '--watch'); +const dev = args.some((val) => val === '--dev'); -if (serve) { +if (watch) { require('electron-reload')(__dirname, {}); } @@ -29,7 +30,7 @@ function createWindow() { })); // Open the DevTools. - if (serve) { + if (dev) { win.webContents.openDevTools(); }