Fix fb-stubs replacement for plugin bundling
Reviewed By: nikoant Differential Revision: D39765543 fbshipit-source-id: 14cbf8a9bdf35031e636bbbde3dbc955faedb66b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
61a8fe09e9
commit
dd7ba2d6fc
@@ -16,6 +16,7 @@ import yargs from 'yargs';
|
||||
import tmp from 'tmp';
|
||||
import {execSync} from 'child_process';
|
||||
import {promisify} from 'util';
|
||||
import isFB from './isFB';
|
||||
|
||||
const argv = yargs
|
||||
.usage('yarn build-plugin [args]')
|
||||
@@ -80,7 +81,7 @@ async function buildPlugin() {
|
||||
const outputSourcemapServerAddOnArg = argv['output-sourcemap-server-addon'];
|
||||
const packageJsonPath = path.join(pluginDir, 'package.json');
|
||||
const packageJsonOverridePath = path.join(pluginDir, 'fb', 'package.json');
|
||||
await runBuild(pluginDir, false, {
|
||||
await runBuild(pluginDir, false, isFB, {
|
||||
sourceMapPath: outputSourcemapArg,
|
||||
sourceMapPathServerAddOn: outputSourcemapServerAddOnArg,
|
||||
});
|
||||
|
||||
@@ -36,6 +36,7 @@ import {
|
||||
} from './paths';
|
||||
import pFilter from 'p-filter';
|
||||
import child from 'child_process';
|
||||
import isFB from './isFB';
|
||||
|
||||
const dev = process.env.NODE_ENV !== 'production';
|
||||
|
||||
@@ -63,7 +64,11 @@ export async function prepareDefaultPlugins(isInsidersBuild: boolean = false) {
|
||||
console.log('✅ Copied the provided default plugins dir.');
|
||||
} else {
|
||||
const defaultPlugins = await getDefaultPlugins(isInsidersBuild);
|
||||
await buildDefaultPlugins(defaultPlugins, dev);
|
||||
await buildDefaultPlugins(
|
||||
defaultPlugins,
|
||||
dev,
|
||||
isFB && !process.env.FLIPPER_FORCE_PUBLIC_BUILD,
|
||||
);
|
||||
}
|
||||
console.log('✅ Prepared default plugins.');
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import {pluginsDir} from './paths';
|
||||
import path from 'path';
|
||||
import {runBuild} from 'flipper-pkg-lib';
|
||||
import {getWorkspaces} from './workspaces';
|
||||
import isFB from './isFB';
|
||||
|
||||
async function bundleAllPlugins() {
|
||||
const plugins = await getWorkspaces().then((workspaces) =>
|
||||
@@ -24,7 +25,7 @@ async function bundleAllPlugins() {
|
||||
console.log(`Bundling "${relativeDir}"`);
|
||||
console.time(`Finished bundling "${relativeDir}"`);
|
||||
try {
|
||||
await runBuild(plugin.dir, false);
|
||||
await runBuild(plugin.dir, false, isFB);
|
||||
} catch (err) {
|
||||
console.log(`Failed to bundle "${relativeDir}": ${err.message}`);
|
||||
errors.set(relativeDir, err);
|
||||
|
||||
@@ -413,9 +413,13 @@ function checkDevServer() {
|
||||
await startMetroServer(app, server);
|
||||
outputScreen(socket);
|
||||
await compileMain();
|
||||
await startWatchPlugins(isInsidersBuild, (changedPlugins) => {
|
||||
socket.emit('plugins-source-updated', changedPlugins);
|
||||
});
|
||||
await startWatchPlugins(
|
||||
isInsidersBuild,
|
||||
isFB && !process.env.FLIPPER_FORCE_PUBLIC_BUILD,
|
||||
(changedPlugins) => {
|
||||
socket.emit('plugins-source-updated', changedPlugins);
|
||||
},
|
||||
);
|
||||
if (dotenv && dotenv.parsed) {
|
||||
console.log('✅ Loaded env vars from .env file: ', dotenv.parsed);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user