From 24860389a2d793c75967430890fa34361108ef3c Mon Sep 17 00:00:00 2001 From: tomkp Date: Thu, 31 Mar 2016 07:23:14 +0100 Subject: [PATCH] ... --- card-explorer.js | 14 +++++++++++++- package.json | 10 ++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/card-explorer.js b/card-explorer.js index 43325aa..819e7e3 100644 --- a/card-explorer.js +++ b/card-explorer.js @@ -1,11 +1,20 @@ 'use strict'; +process.env.NODE_ENV = process.env.NODE_ENV || 'production'; + + const electron = require('electron'); const smartcard = require('smartcard'); const tlv = require('tlv'); const hexify = require('hexify'); + +if (process.env.NODE_ENV === 'development') { + require('electron-debug')(); +} + + // Module to control application life. const app = electron.app; // Module to create native browser window. @@ -30,7 +39,10 @@ function createWindow() { // Open the DevTools. let webContents = mainWindow.webContents; - webContents.openDevTools(); + //webContents.openDevTools(); + if (process.env.NODE_ENV === 'development') { + webContents.openDevTools(); + } // Emitted when the window is closed. mainWindow.on('closed', function () { diff --git a/package.json b/package.json index 0d6b63b..9a7b6e7 100644 --- a/package.json +++ b/package.json @@ -7,19 +7,21 @@ "license": "MIT", "main": "card-explorer.js", "scripts": { - "start": "electron card-explorer.js", + "start": "cross-env NODE_ENV=development electron card-explorer.js", "compile": "webpack", "compile:watch": "webpack -w", "bump": "salita && npm i", - "build:all": "electron-packager . --overwrite --out='build' --icon='tomkp.icns' --all --appname='Card Explorer'", - "build:win": "electron-packager . --overwrite --out='build' --platform=win32 --appname='Card Explorer' --arch=x64", - "build:osx": "electron-packager . --overwrite --out='build' --icon='tomkp.icns' --platform=darwin --appname='Card Explorer' --arch=x64", + "build:all": "cross-env NODE_ENV=development electron-packager . --overwrite --out='build' --icon='tomkp.icns' --all --appname='Card Explorer'", + "build:win": "cross-env NODE_ENV=development electron-packager . --overwrite --out='build' --platform=win32 --appname='Card Explorer' --arch=x64", + "build:osx": "cross-env NODE_ENV=development electron-packager . --overwrite --out='build' --icon='tomkp.icns' --platform=darwin --appname='Card Explorer' --arch=x64", "publish:win": "npm run build:win && zip -r -X './website/CardExplorerWin.zip' './build/Card Explorer-win32-x64' && surge website explorer.surge.sh", "publish:osx": "npm run build:osx && zip -r -X './website/CardExplorerOSx.zip' './build/Card Explorer-darwin-x64' && surge website explorer.surge.sh" }, "dependencies": { "babel-polyfill": "^6.7.4", "card-reader": "^1.0.3", + "cross-env": "^1.0.7", + "electron-debug": "^0.5.2", "emv": "^1.0.6", "es6-promise": "^3.1.2", "hexify": "^1.0.1",