From d9677611f594431b9e3c41d5fade3e2ae9bbd2e3 Mon Sep 17 00:00:00 2001 From: Dimitri Mitropoulos Date: Wed, 12 May 2021 08:22:40 -0400 Subject: [PATCH] enables react-redux devtools (#3373) * add react and redux devtools * convert to try-catch * updates package-lock.json Co-authored-by: Opender Singh --- package-lock.json | 6 -- packages/insomnia-app/app/main.development.ts | 11 +++ packages/insomnia-app/package-lock.json | 75 +++++++++++++++++++ packages/insomnia-app/package.json | 1 + 4 files changed, 87 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index edd0be3fc..67a6f7143 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4960,12 +4960,6 @@ "integrity": "sha512-KbUpJgx909ZscOc/7CLATBFam7P1Z1QRQInvgT0UztM9Q72aGKCunKASAl7WNW0tnPmPyEMeMhdsfWhfmW037w==", "dev": true }, - "array-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", - "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", - "dev": true - }, "array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", diff --git a/packages/insomnia-app/app/main.development.ts b/packages/insomnia-app/app/main.development.ts index ac0f739b2..47b1a8411 100644 --- a/packages/insomnia-app/app/main.development.ts +++ b/packages/insomnia-app/app/main.development.ts @@ -13,6 +13,7 @@ import type { ToastNotification } from './ui/components/toast'; import type { Stats } from './models/stats'; import { trackNonInteractiveEventQueueable } from './common/analytics'; import log, { initializeLogging } from './common/log'; +import installExtension, { REDUX_DEVTOOLS, REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer'; // Handle potential auto-update if (checkIfRestartNeeded()) { @@ -37,6 +38,16 @@ if (!isDevelopment()) { global.window = global.window || undefined; // When the app is first launched app.on('ready', async () => { + // Enable react dev tools if development + if (isDevelopment()) { + try { + const names = await installExtension([REDUX_DEVTOOLS, REACT_DEVELOPER_TOOLS]); + console.log(`[electron-extensions] Added Extension: ${names}`); + } catch (err) { + console.log('[electron-extensions] An error occurred: ', err); + } + } + // Init some important things first await database.init(models.types()); await _createModelInstances(); diff --git a/packages/insomnia-app/package-lock.json b/packages/insomnia-app/package-lock.json index 87438bb1b..3e06ae91a 100644 --- a/packages/insomnia-app/package-lock.json +++ b/packages/insomnia-app/package-lock.json @@ -10427,6 +10427,35 @@ "electron-is-dev": "^1.0.1" } }, + "electron-devtools-installer": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/electron-devtools-installer/-/electron-devtools-installer-3.2.0.tgz", + "integrity": "sha512-t3UczsYugm4OAbqvdImMCImIMVdFzJAHgbwHpkl5jmfu1izVgUcP/mnrPqJIpEeCK1uZGpt+yHgWEN+9EwoYhQ==", + "dev": true, + "requires": { + "rimraf": "^3.0.2", + "semver": "^7.2.1", + "tslib": "^2.1.0", + "unzip-crx-3": "^0.2.0" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==", + "dev": true + } + } + }, "electron-dl": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/electron-dl/-/electron-dl-3.0.1.tgz", @@ -16995,6 +17024,29 @@ "verror": "1.10.0" } }, + "jszip": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.6.0.tgz", + "integrity": "sha512-jgnQoG9LKnWO3mnVNBnfhkh0QknICd1FGSrXcgrl67zioyJ4wgx25o9ZqwNtrROSflGBCGYnJfjrIyRIby1OoQ==", + "dev": true, + "requires": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "set-immediate-shim": "~1.0.1" + }, + "dependencies": { + "lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dev": true, + "requires": { + "immediate": "~3.0.5" + } + } + } + }, "jwa": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", @@ -22548,6 +22600,12 @@ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "dev": true + }, "set-value": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", @@ -24922,6 +24980,17 @@ } } }, + "unzip-crx-3": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/unzip-crx-3/-/unzip-crx-3-0.2.0.tgz", + "integrity": "sha512-0+JiUq/z7faJ6oifVB5nSwt589v1KCduqIJupNVDoWSXZtWDmjDGO3RAEOvwJ07w90aoXoP4enKsR7ecMrJtWQ==", + "dev": true, + "requires": { + "jszip": "^3.1.0", + "mkdirp": "^0.5.1", + "yaku": "^0.16.6" + } + }, "upath": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", @@ -27612,6 +27681,12 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" }, + "yaku": { + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/yaku/-/yaku-0.16.7.tgz", + "integrity": "sha1-HRlceKqbW/hHnIlblQT9TwhHmE4=", + "dev": true + }, "yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", diff --git a/packages/insomnia-app/package.json b/packages/insomnia-app/package.json index 0e5d563fe..b51c6218c 100644 --- a/packages/insomnia-app/package.json +++ b/packages/insomnia-app/package.json @@ -213,6 +213,7 @@ "electron": "9.3.5", "electron-builder": "^22.5.1", "electron-builder-squirrel-windows": "^22.5.1", + "electron-devtools-installer": "^3.2.0", "electron-notarize": "^0.3.0", "fast-glob": "^3.1.0", "file-loader": "^3.0.1",