Depends on D14989
Add extension-specific logic to its own component. Load this component if env var is for building the extension.
Initially I tried to split this into several diffs, as there are multiple changes required to maintain extension functionality with only one App.js file. However, it's not practical to test these incremental changes, and each one in isolation would break either the prod app or the extension App.js.
So, this diff does "one thing" -- make the extension and the Cashtab web app build from a single App.js file, depending on the presence of an env var at build time.
To do this one thing,
If extension env var is present at build time...
- Include extension-specific css rules with new <ExtensionFrame/> component
- Include extension-specific address sharing logic with new <Extension/> component
If extension env var is NOT PRESENT at build time...
- Include routes to Swap page (extension cannot support this as it relies on external code)
- Support desktop-only easter egg
- Include webapp service worker, <ServiceWorkerWrapper />
extension/src/App.js is deleted. The script extension.sh is modified so that only manifest.json is exchanged at build time.
For this file -- it makes sense to maintain two files because they really are totally different. chrome has manifest.json rules specific to chrome extensions (specifying things like required permission, published version number, manifest version which determines which chrome APIs are available) and react apps have their own rules (for Cashtab, this file is really just specifying the favicon and PWA icon). Changing one version of the manifest.json file does not imply any need to maintain or change the other version at the same time (unlike App.js). Arguably the build script could be optimized so we don't need to move files around at build time, but this should be done in another diff.