Remove remaining Electron imports from product code: paths & env
Summary: This diff removes most remaining Electron imports, by storing env and path constants on the RenderHost. As nice side effect those paths are all cached now as well. To make sure RenderHost is initialised before Flipper itself, forced loading Flipper through a require. Otherwise the setup is super sensitive to circular import statements, since a lot of module initialisation code depends on those paths / env vars. Reviewed By: nikoant Differential Revision: D31992230 fbshipit-source-id: 91beb430902272aaf4b051b35cdf12d2fc993347
This commit is contained in:
committed by
Facebook GitHub Bot
parent
dba09542f9
commit
2e7015388c
@@ -33,6 +33,7 @@ import {
|
||||
getIconsSync,
|
||||
buildLocalIconPath,
|
||||
getIconURLSync,
|
||||
Icons,
|
||||
} from '../app/src/utils/icons';
|
||||
import isFB from './isFB';
|
||||
import copyPackageWithDependencies from './copy-package-with-dependencies';
|
||||
@@ -309,7 +310,12 @@ async function copyStaticFolder(buildFolder: string) {
|
||||
}
|
||||
|
||||
function downloadIcons(buildFolder: string) {
|
||||
const iconURLs = Object.entries(getIconsSync()).reduce<
|
||||
const icons: Icons = JSON.parse(
|
||||
fs.readFileSync(path.join(buildFolder, 'icons.json'), {
|
||||
encoding: 'utf8',
|
||||
}),
|
||||
);
|
||||
const iconURLs = Object.entries(icons).reduce<
|
||||
{
|
||||
name: string;
|
||||
size: number;
|
||||
@@ -326,7 +332,7 @@ function downloadIcons(buildFolder: string) {
|
||||
|
||||
return Promise.all(
|
||||
iconURLs.map(({name, size, density}) => {
|
||||
const url = getIconURLSync(name, size, density);
|
||||
const url = getIconURLSync(name, size, density, buildFolder);
|
||||
return fetch(url, {
|
||||
retryOptions: {
|
||||
// Be default, only 5xx are retried but we're getting the odd 404
|
||||
|
||||
Reference in New Issue
Block a user