From f7606c8d59feb0ce72f2879a352ad7707f913f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Wed, 29 Aug 2018 02:29:14 -0700 Subject: [PATCH] rename ~/.sonar to ~/.flipper Summary: renames config folder from sonar to flipper Reviewed By: jknoxville Differential Revision: D9541803 fbshipit-source-id: ef378c46fcbb14e76e99fb0743a99f24c536a434 --- docs/establishing-a-connection.md | 2 +- docs/jssetup.md | 2 +- src/chrome/PluginManager.js | 2 +- src/utils/CertificateProvider.js | 2 +- static/compilePlugins.js | 2 +- static/index.js | 14 ++++++++++---- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/establishing-a-connection.md b/docs/establishing-a-connection.md index d905de0e4..f7e7592aa 100644 --- a/docs/establishing-a-connection.md +++ b/docs/establishing-a-connection.md @@ -23,7 +23,7 @@ In order for the mobile app to know which certificates it can trust, it conducts This is achieved through the following steps: * Desktop app starts an insecure server on port 8089. * Mobile app connects to localhost:8089 and sends a Certificate Signing Request to the desktop app. -* Desktop app uses it's private key (this is generated once and stored in ~/.sonar) to sign a client certificate for the mobile app. +* Desktop app uses it's private key (this is generated once and stored in ~/.flipper) to sign a client certificate for the mobile app. * The desktop uses ADB (for android), or the mounted file system (for iOS simulators) to write the following files to the mobile app's private data partition * Server certificate that the mobile app can now trust. * Client certificate for the mobile app to use going forward. diff --git a/docs/jssetup.md b/docs/jssetup.md index 277e047cf..0daa96450 100644 --- a/docs/jssetup.md +++ b/docs/jssetup.md @@ -34,7 +34,7 @@ Learn more on how to use [Flipper's UI components](ui-components.md). ### Dynamically loading plugins -Once a plugin is created, Flipper can load it from its folder. The path from where the plugins are loaded is specified in `~/.sonar/config.json`. Add the parent folder of your plugin to `pluginPaths` and start Flipper. +Once a plugin is created, Flipper can load it from its folder. The path from where the plugins are loaded is specified in `~/.flipper/config.json`. Add the parent folder of your plugin to `pluginPaths` and start Flipper. ### npm dependencies diff --git a/src/chrome/PluginManager.js b/src/chrome/PluginManager.js index 28ef2becb..d899cbd05 100644 --- a/src/chrome/PluginManager.js +++ b/src/chrome/PluginManager.js @@ -23,7 +23,7 @@ const {spawn} = require('child_process'); const path = require('path'); const {app, shell} = require('electron').remote; -const SONAR_PLUGIN_PATH = path.join(app.getPath('home'), '.sonar'); +const SONAR_PLUGIN_PATH = path.join(app.getPath('home'), '.flipper'); const DYNAMIC_PLUGINS = JSON.parse(window.process.env.PLUGINS || '[]'); type NPMModule = { diff --git a/src/utils/CertificateProvider.js b/src/utils/CertificateProvider.js index a973ddec4..e9d0f65e6 100644 --- a/src/utils/CertificateProvider.js +++ b/src/utils/CertificateProvider.js @@ -486,5 +486,5 @@ export default class CertificateProvider { } function getFilePath(fileName: string): string { - return path.resolve(os.homedir(), '.sonar', 'certs', fileName); + return path.resolve(os.homedir(), '.flipper', 'certs', fileName); } diff --git a/static/compilePlugins.js b/static/compilePlugins.js index 64703d12e..2345a7ea8 100644 --- a/static/compilePlugins.js +++ b/static/compilePlugins.js @@ -69,7 +69,7 @@ const createModuleIdFactory = () => filePath => { return id; }; function pluginEntryPoints(additionalPaths = []) { - const defaultPluginPath = path.join(HOME_DIR, '.sonar', 'node_modules'); + const defaultPluginPath = path.join(HOME_DIR, '.flipper', 'node_modules'); const entryPoints = entryPointForPluginFolder(defaultPluginPath); if (typeof additionalPaths === 'string') { additionalPaths = [additionalPaths]; diff --git a/static/index.js b/static/index.js index 97f0e2287..111dbd9f3 100644 --- a/static/index.js +++ b/static/index.js @@ -38,13 +38,19 @@ if (process.platform === 'darwin') { } } -// ensure .sonar folder and config exist +// ensure .flipper folder and config exist const sonarDir = path.join(os.homedir(), '.sonar'); -if (!fs.existsSync(sonarDir)) { +const flipperDir = path.join(os.homedir(), '.flipper'); +if (fs.existsSync(flipperDir)) { + // nothing to do +} else if (fs.existsSync(sonarDir)) { + // move .sonar to .flipper + fs.renameSync(sonarDir, flipperDir); +} else { fs.mkdirSync(sonarDir); } -const configPath = path.join(sonarDir, 'config.json'); +const configPath = path.join(flipperDir, 'config.json'); let config = {pluginPaths: [], disabledPlugins: [], lastWindowPosition: {}}; try { @@ -88,7 +94,7 @@ compilePlugins( } }, pluginPaths, - path.join(require('os').homedir(), '.sonar', 'plugins'), + path.join(flipperDir, 'plugins'), ).then(dynamicPlugins => { process.env.PLUGINS = JSON.stringify(dynamicPlugins); pluginsCompiled = true;