From f24c6de2451aee121cf39d78a63dde3485b2aec4 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 4 Jun 2017 15:30:44 +0100 Subject: [PATCH] provide react devtools in electron dev builds Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- electron_app/src/electron-main.js | 15 +++++++++++++++ package.json | 1 + 2 files changed, 16 insertions(+) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index ef0d173c..3491ce0f 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -1,6 +1,7 @@ /* Copyright 2016 Aviral Dasgupta Copyright 2016 OpenMarket Ltd +Copyright 2017 Michael Telatynski <7t3chguy@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -216,6 +217,20 @@ electron.ipcMain.on('settings_set', function(ev, key, value) { }); electron.app.on('ready', () => { + + if (argv.devtools) { + try { + const { default: installExtension, REACT_DEVELOPER_TOOLS, REACT_PERF } = require('electron-devtools-installer'); + installExtension(REACT_DEVELOPER_TOOLS) + .then((name) => console.log(`Added Extension: ${name}`)) + .catch((err) => console.log('An error occurred: ', err)); + installExtension(REACT_PERF) + .then((name) => console.log(`Added Extension: ${name}`)) + .catch((err) => console.log('An error occurred: ', err)); + } catch(e) {console.log(e);} + } + + if (vectorConfig.update_base_url) { console.log(`Starting auto update with base URL: ${vectorConfig.update_base_url}`); startAutoUpdate(vectorConfig.update_base_url); diff --git a/package.json b/package.json index 4918d0ec..bb3edc40 100644 --- a/package.json +++ b/package.json @@ -101,6 +101,7 @@ "css-raw-loader": "^0.1.1", "electron-builder": "^11.2.4", "electron-builder-squirrel-windows": "^11.2.1", + "electron-devtools-installer": "^2.2.0", "emojione": "^2.2.7", "eslint": "^3.14.0", "eslint-config-google": "^0.7.1",