Only load dev extensions in dev

This commit is contained in:
Gregory Schier 2017-07-20 12:29:16 -07:00
parent 6a391268e5
commit d00f8d1953
4 changed files with 16 additions and 15 deletions

View File

@ -4,7 +4,7 @@ import {isDevelopment, isMac} from './common/constants';
import * as errorHandling from './main/error-handling';
import * as updates from './main/updates';
import * as windowUtils from './main/window-utils';
import installExtension, { REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } from 'electron-devtools-installer';
import installExtension, {REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS} from 'electron-devtools-installer';
// Handle potential auto-update
if (needsRestart) {
@ -55,13 +55,16 @@ app.on('activate', (e, hasVisibleWindows) => {
});
// When the app is first launched
app.on('ready', () => {
installExtension(REACT_DEVELOPER_TOOLS)
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred: ', err));
installExtension(REDUX_DEVTOOLS)
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred: ', err));
app.on('ready', async () => {
// Install developer extensions if we're in dev mode
if (isDevelopment() || process.env.INSOMNIA_FORCE_DEBUG) {
try {
console.log('Installed Extension: ' + await installExtension(REACT_DEVELOPER_TOOLS));
console.log('Installed Extension: ' + await installExtension(REDUX_DEVTOOLS));
} catch (err) {
console.warn('Failed to install devtools extension', err);
}
}
app.removeListener('open-url', addUrlToOpen);
const window = windowUtils.createWindow();

View File

@ -10,6 +10,7 @@
"main": "main.min.js",
"dependencies": {
"electron-context-menu": "^0.9.0",
"electron-devtools-installer": "^2.2.0",
"electron-squirrel-startup": "^1.0.0",
"deep-equal": "^1.0.1",
"hkdf": "^0.0.2",

9
package-lock.json generated
View File

@ -12,8 +12,7 @@
"7zip": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/7zip/-/7zip-0.0.6.tgz",
"integrity": "sha1-nK+xca+CMpSQNTtIFvAzR6oVCjA=",
"dev": true
"integrity": "sha1-nK+xca+CMpSQNTtIFvAzR6oVCjA="
},
"7zip-bin": {
"version": "2.0.4",
@ -1642,8 +1641,7 @@
"cross-unzip": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/cross-unzip/-/cross-unzip-0.0.2.tgz",
"integrity": "sha1-UYO8R6CVWb78+YzEZXlkmZNZNy8=",
"dev": true
"integrity": "sha1-UYO8R6CVWb78+YzEZXlkmZNZNy8="
},
"cryptiles": {
"version": "2.0.5",
@ -2068,8 +2066,7 @@
"electron-devtools-installer": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/electron-devtools-installer/-/electron-devtools-installer-2.2.0.tgz",
"integrity": "sha1-mBPmgRr81p3co8rlQW23Lqfs+2o=",
"dev": true
"integrity": "sha1-mBPmgRr81p3co8rlQW23Lqfs+2o="
},
"electron-dl": {
"version": "1.9.0",

View File

@ -117,6 +117,7 @@
"codemirror": "^5.24.2",
"deep-equal": "^1.0.1",
"electron-context-menu": "^0.9.0",
"electron-devtools-installer": "^2.2.0",
"electron-squirrel-startup": "^1.0.0",
"highlight.js": "^9.12.0",
"hkdf": "^0.0.2",
@ -172,7 +173,6 @@
"css-loader": "^0.26.2",
"electron": "^1.6.11",
"electron-builder": "^10.17.3",
"electron-devtools-installer": "^2.2.0",
"electron-rebuild": "^1.5.7",
"eslint": "^3.16.1",
"eslint-config-semistandard": "^7.0.0",