Create a bridge for the V1 and V3 apps (#448)

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(<V1App />, root);
+ReactDOM.render(
+  <React.Fragment>
+    <h1>Hello</h1>
+    <V1App />
+  </React.Fragment>,
+  root
+);
 registerServiceWorker();
```

and say “hello” back to the app.

wchargin-branch: bridge
This commit is contained in:
William Chargin 2018-06-29 13:09:39 -07:00 committed by GitHub
parent 4184e8594a
commit ca5346b524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 5 deletions

View File

@ -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"),

View File

@ -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(<App />, root);
ReactDOM.render(<V1App />, root);
registerServiceWorker();