Skip to content

Commit

Permalink
RN-only build flag
Browse files Browse the repository at this point in the history
Summary: Previously I had created a RN build, locally, with a few minor differences. That had to be reverted. Instead of reverting and re-applying changes, I'm introducing a flag that can be used in the interim to produce the RN-only builds.

Reviewed By: LukeDefeo

Differential Revision: D50555055

fbshipit-source-id: edface9a1587fb51e54eebe73724032baf985c83
  • Loading branch information
lblasa authored and facebook-github-bot committed Oct 24, 2023
1 parent 05242b4 commit 94120d6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 182 deletions.
4 changes: 4 additions & 0 deletions desktop/flipper-server-core/src/utils/environmentInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export async function getEnvironmentInfo(
process.env.FLIPPER_FORCE_VERSION ??
(isProduction ? packageJson.version : '0.0.0');

if (packageJson.reactNativeOnly) {
process.env.FLIPPER_REACT_NATIVE_ONLY = 'true';
}

return {
processId: process.pid,
isProduction,
Expand Down
19 changes: 18 additions & 1 deletion desktop/scripts/build-release.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ const argv = yargs
'Unique build identifier to be used as the version patch part for the build',
type: 'number',
},
'react-native-only': {
description: 'React Native only build',
type: 'boolean',
default: false,
},
channel: {
description: 'Release channel for the build',
choices: ['stable', 'insiders'],
Expand Down Expand Up @@ -115,6 +120,10 @@ if (argv['default-plugins-dir']) {
process.env.FLIPPER_DEFAULT_PLUGINS_DIR = argv['default-plugins-dir'];
}

if (argv['react-native-only']) {
process.env.FLIPPER_REACT_NATIVE_ONLY = 'true';
}

async function generateManifest(versionNumber: string) {
await fs.writeFile(
path.join(distDir, 'manifest.json'),
Expand All @@ -130,6 +139,7 @@ async function modifyPackageManifest(
versionNumber: string,
hgRevision: string | null,
channel: string,
reactNativeOnly: boolean,
) {
// eslint-disable-next-line no-console
console.log('Creating package.json manifest');
Expand All @@ -148,6 +158,7 @@ async function modifyPackageManifest(
manifest.revision = hgRevision;
}
manifest.releaseChannel = channel;
manifest.reactNativeOnly = reactNativeOnly;
await fs.writeFile(
path.join(buildFolder, 'package.json'),
JSON.stringify(manifest, null, ' '),
Expand Down Expand Up @@ -299,7 +310,13 @@ async function copyStaticFolder(buildFolder: string) {
await moveSourceMaps(dir, argv['source-map-dir']);
const versionNumber = getVersionNumber(argv.version);
const hgRevision = await genMercurialRevision();
await modifyPackageManifest(dir, versionNumber, hgRevision, argv.channel);
await modifyPackageManifest(
dir,
versionNumber,
hgRevision,
argv.channel,
argv['react-native-only'],
);
await fs.ensureDir(distDir);
await generateManifest(versionNumber);
await buildDist(dir);
Expand Down
8 changes: 8 additions & 0 deletions desktop/scripts/start-dev-server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ const argv = yargs
'[FB-internal only] Will yield `true` on any GK. Disabled by default. Setting env var FLIPPER_ENABLE_ALL_GKS is equivalent',
type: 'boolean',
},
'react-native-only': {
description: '[FB-internal only] React Native only build',
type: 'boolean',
},
channel: {
describe:
'[FB-internal only] Release channel. "stable" by default. Setting env var "FLIPPER_RELEASE_CHANNEL" is equivalent.',
Expand Down Expand Up @@ -148,6 +152,10 @@ if (argv.channel !== undefined) {
process.env.FLIPPER_RELEASE_CHANNEL = argv.channel;
}

if (argv['react-native-only'] === true) {
process.env.FLIPPER_REACT_NATIVE_ONLY = 'true';
}

if (argv['force-version']) {
process.env.FLIPPER_FORCE_VERSION = argv['force-version'];
}
Expand Down
Loading

0 comments on commit 94120d6

Please sign in to comment.