From 5edb8bd77005b1fad52e2ea7a5725d079a65b340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Tue, 26 Jun 2018 07:10:57 -0700 Subject: [PATCH] clean up dynamic plugin loading Summary: There are 3 sources where plugins can be loaded from: * `src/plugins` * `src/fb/plugins` * any path specified in `~/.sonar/config.json` Plugins found in the first two directories are bundled with the app when building. Reviewed By: jknoxville Differential Revision: D8636061 fbshipit-source-id: 2064090d43d11695ffd99df195e5b594559fe087 --- scripts/start-dev-server.js | 1 - src/MenuBar.js | 14 --------- src/chrome/AutoUpdateVersion.js | 2 +- src/chrome/SonarTitleBar.js | 17 ----------- src/chrome/WelcomeScreen.js | 2 +- src/utils/dynamicPluginLoading.js | 47 ------------------------------- src/utils/isProduction.js | 16 +++++++++++ static/compilePlugins.js | 13 +++++---- static/index.js | 10 ++++--- 9 files changed, 31 insertions(+), 91 deletions(-) delete mode 100644 src/utils/dynamicPluginLoading.js create mode 100644 src/utils/isProduction.js diff --git a/scripts/start-dev-server.js b/scripts/start-dev-server.js index 807d640ff..68500cd41 100644 --- a/scripts/start-dev-server.js +++ b/scripts/start-dev-server.js @@ -26,7 +26,6 @@ function launchElectron({bundleURL, electronURL}) { const args = [ path.join(STATIC_DIR, 'index.js'), '--remote-debugging-port=9222', - '--dynamicPlugins=~/fbsource/xplat/sonar/src/plugins,~/fbsource/xplat/sonar/src/fb/plugins', ]; const proc = child.spawn(electronBinary, args, { diff --git a/src/MenuBar.js b/src/MenuBar.js index e677fe922..02e654cb7 100644 --- a/src/MenuBar.js +++ b/src/MenuBar.js @@ -8,11 +8,6 @@ import type {SonarBasePlugin} from './plugin.js'; import {devicePlugins} from './device-plugins/index.js'; -import { - isProduction, - loadsDynamicPlugins, - toggleDynamicPluginLoading, -} from './utils/dynamicPluginLoading.js'; import plugins from './plugins/index.js'; import electron from 'electron'; @@ -332,15 +327,6 @@ function getTemplate(app: Object, shell: Object): Array { { type: 'separator', }, - { - label: `Restart in ${ - loadsDynamicPlugins() ? 'Production' : 'Development' - } Mode`, - enabled: isProduction(), - click: function() { - toggleDynamicPluginLoading(); - }, - }, { label: 'Quit', accelerator: 'Command+Q', diff --git a/src/chrome/AutoUpdateVersion.js b/src/chrome/AutoUpdateVersion.js index 9f57d8854..a7b008ed5 100644 --- a/src/chrome/AutoUpdateVersion.js +++ b/src/chrome/AutoUpdateVersion.js @@ -7,7 +7,7 @@ import {FlexRow, Text, colors, LoadingIndicator, Glyph, Component} from 'sonar'; import {remote} from 'electron'; -import {isProduction} from '../utils/dynamicPluginLoading'; +import isProduction from '../utils/isProduction.js'; import config from '../fb-stubs/config.js'; const version = remote.app.getVersion(); diff --git a/src/chrome/SonarTitleBar.js b/src/chrome/SonarTitleBar.js index fa4baeac9..7f7e14dd1 100644 --- a/src/chrome/SonarTitleBar.js +++ b/src/chrome/SonarTitleBar.js @@ -10,16 +10,10 @@ import { Button, ButtonGroup, FlexRow, - FlexBox, Component, Spacer, - Glyph, GK, } from 'sonar'; -import { - loadsDynamicPlugins, - dynamicPluginPath, -} from '../utils/dynamicPluginLoading.js'; import {connect} from 'react-redux'; import { toggleBugDialogVisible, @@ -60,10 +54,6 @@ const TitleBar = FlexRow.extends( }, ); -const Icon = FlexBox.extends({ - marginRight: 3, -}); - type Props = {| windowIsFocused: boolean, leftSidebarVisible: boolean, @@ -82,13 +72,6 @@ class SonarTitleBar extends Component { - {loadsDynamicPlugins() && ( - - - - )} {process.platform === 'darwin' ? : null} {config.bugReportButtonVisible && (