From ca5346b524ba494169e5a495bee86e503a0e652f Mon Sep 17 00:00:00 2001 From: William Chargin Date: Fri, 29 Jun 2018 13:09:39 -0700 Subject: [PATCH] Create a bridge for the V1 and V3 apps (#448) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Our build system doesn’t make it easy to have two separate React applications, which we would like to have for the V1 and V3 branches. Instead, we’ll implement a bridge to maintain compatibility. The plan looks like this: 1. Change the app from pointing to V1 to pointing to a bridge 2. Move the router into the bridge and move the V1 app from the `/` route to the `/v1` route (e.g., `/v1/explorer`) 3. Add a V3 app under the `/v3` route 4. ??? 5. Delete the V1 app and remove it from the bridge 6. Delete the bridge and move the V3 app from the `/v3` route to `/` This commit implements Step 1. Test Plan: To verify that the bridge is in fact showing, apply ```diff diff --git a/src/bridge/app/index.js b/src/bridge/app/index.js index 379e289..72e784c 100644 --- a/src/bridge/app/index.js +++ b/src/bridge/app/index.js @@ -9,5 +9,11 @@ const root = document.getElementById("root"); if (root == null) { throw new Error("Unable to find root element!"); } -ReactDOM.render(, root); +ReactDOM.render( + +

Hello

+ +
, + root +); registerServiceWorker(); ``` and say “hello” back to the app. wchargin-branch: bridge --- config/paths.js | 6 +++--- src/{v1 => bridge}/app/index.css | 0 src/{v1 => bridge}/app/index.js | 4 ++-- src/{v1 => bridge}/app/public/index.html | 0 src/{v1 => bridge}/app/registerServiceWorker.js | 0 5 files changed, 5 insertions(+), 5 deletions(-) rename src/{v1 => bridge}/app/index.css (100%) rename src/{v1 => bridge}/app/index.js (80%) rename src/{v1 => bridge}/app/public/index.html (100%) rename src/{v1 => bridge}/app/registerServiceWorker.js (100%) diff --git a/config/paths.js b/config/paths.js index fe9c4c8..15837ac 100644 --- a/config/paths.js +++ b/config/paths.js @@ -36,9 +36,9 @@ function getServedPath() { module.exports = { dotenv: resolveApp(".env"), appBuild: resolveApp("build"), - appPublic: resolveApp("src/v1/app/public"), - appHtml: resolveApp("src/v1/app/public/index.html"), - appIndexJs: resolveApp("src/v1/app/index.js"), + appPublic: resolveApp("src/bridge/app/public"), + appHtml: resolveApp("src/bridge/app/public/index.html"), + appIndexJs: resolveApp("src/bridge/app/index.js"), appPackageJson: resolveApp("package.json"), appSrc: resolveApp("src"), yarnLockFile: resolveApp("yarn.lock"), diff --git a/src/v1/app/index.css b/src/bridge/app/index.css similarity index 100% rename from src/v1/app/index.css rename to src/bridge/app/index.css diff --git a/src/v1/app/index.js b/src/bridge/app/index.js similarity index 80% rename from src/v1/app/index.js rename to src/bridge/app/index.js index 3ef8d8d..379e289 100644 --- a/src/v1/app/index.js +++ b/src/bridge/app/index.js @@ -2,12 +2,12 @@ import React from "react"; import ReactDOM from "react-dom"; import "./index.css"; -import App from "./App"; +import V1App from "../../v1/app/App"; import registerServiceWorker from "./registerServiceWorker"; const root = document.getElementById("root"); if (root == null) { throw new Error("Unable to find root element!"); } -ReactDOM.render(, root); +ReactDOM.render(, root); registerServiceWorker(); diff --git a/src/v1/app/public/index.html b/src/bridge/app/public/index.html similarity index 100% rename from src/v1/app/public/index.html rename to src/bridge/app/public/index.html diff --git a/src/v1/app/registerServiceWorker.js b/src/bridge/app/registerServiceWorker.js similarity index 100% rename from src/v1/app/registerServiceWorker.js rename to src/bridge/app/registerServiceWorker.js