From ba24f5f9035ff27c4349969b589525c17c98afc4 Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Wed, 27 Aug 2025 02:50:05 -0700 Subject: [PATCH] Demote `electron` to devDependency (#53438) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53438 Changelog: [Internal] Makes `flavor: 'prebuilt'` the default mode of launching the RNDT standalone shell, and the *only* mode supported in the published version of the package. See D78351931 for more context. With this, we can demote `electron` from `dependencies` to `devDependencies`. This makes it possible to make `debugger-shell` a dependency of `dev-middleware` (and thus of all major frameworks) without significantly impacting `npm install` times. We'll add this dependency on `debugger-shell` in an upcoming diff (D78351937). We also stop publishing the `dist/electron` subdirectory (and `src/electron` for good measure) since the corresponding code will always be bundled into the prebuilt binary instead. Reviewed By: huntie Differential Revision: D78351934 fbshipit-source-id: 2a4b03e852c4d0330250567c41dca09d1c4f3abd --- .../__tests__/electron-dependency-test.js | 2 +- packages/debugger-shell/package.json | 10 ++++++++-- packages/debugger-shell/src/node/index.flow.js | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/debugger-shell/__tests__/electron-dependency-test.js b/packages/debugger-shell/__tests__/electron-dependency-test.js index d0be1077d5b..9b785bd7701 100644 --- a/packages/debugger-shell/__tests__/electron-dependency-test.js +++ b/packages/debugger-shell/__tests__/electron-dependency-test.js @@ -22,7 +22,7 @@ describe('Electron dependency', () => { // $FlowFixMe[untyped-import] - package.json is not typed const ourPackageJson = require('../package.json'); - const declaredElectronVersion = ourPackageJson.dependencies.electron; + const declaredElectronVersion = ourPackageJson.devDependencies.electron; expect(declaredElectronVersion).toBeTruthy(); // $FlowFixMe[untyped-import] - package.json is not typed diff --git a/packages/debugger-shell/package.json b/packages/debugger-shell/package.json index 6c1706dd55d..3d268cbfbfd 100644 --- a/packages/debugger-shell/package.json +++ b/packages/debugger-shell/package.json @@ -30,10 +30,16 @@ }, "dependencies": { "cross-spawn": "^7.0.6", - "electron": "37.2.6", "fb-dotslash": "0.5.8" }, "devDependencies": { + "electron": "37.2.6", "semver": "^7.1.3" - } + }, + "files": [ + "!**/__tests__/**", + "bin", + "dist", + "!src/electron" + ] } diff --git a/packages/debugger-shell/src/node/index.flow.js b/packages/debugger-shell/src/node/index.flow.js index 3b7e0dbcca6..8490b8f42ed 100644 --- a/packages/debugger-shell/src/node/index.flow.js +++ b/packages/debugger-shell/src/node/index.flow.js @@ -29,7 +29,7 @@ async function unstable_spawnDebuggerShellWithArgs( args: string[], { mode = 'detached', - flavor = 'dev', + flavor = 'prebuilt', }: $ReadOnly<{ // In 'syncAndExit' mode, the current process will block until the spawned process exits, and then it will exit // with the same exit code as the spawned process.