Skip to content

Commit 408abf6

Browse files
huntiefacebook-github-bot
authored andcommitted
Fix user facing display name for debugger-shell (#53740)
Summary: Pull Request resolved: #53740 Adjusts user facing app name used by Electron, which previously used `package.json#name` and led to this leaking into unwanted parts of the UI — e.g. "[About|Hide|Quit] react-native/debugger-shell" in the macOS menu bar. **Changes** - Set the `productName` field in `package.json` ([docs](https://www.electronjs.org/docs/latest/api/app#appname:~:text=npm%20modules%20spec.-,You%20should%20usually%20also%20specify%20a%20productName%20field%2C%20which%20is%20your%20application%27s%20full%20capitalized%20name%2C%20and%20which%20will%20be%20preferred%20over%20name%20by%20Electron.,-app.userAgentFallback%E2%80%8B)). **Notes** - This **changes** the `User-Agent` header sent by the app, now of the form `"... ReactNativeDevTools/0.82.0-main-dev ..."`. Changelog: [Internal] Reviewed By: vzaidman Differential Revision: D82228307 fbshipit-source-id: dd316ce5580a3ddf4138c7c3bf76aff99e4f4801
1 parent 82708c7 commit 408abf6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/debugger-shell/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "@react-native/debugger-shell",
3+
"productName": "React Native DevTools",
34
"version": "0.82.0-main",
45
"description": "Experimental debugger shell for React Native for use with @react-native/debugger-frontend",
56
"keywords": [

packages/debugger-shell/src/electron/index.flow.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ const util = require('util');
1616
// $FlowFixMe[unclear-type] We have no Flow types for the Electron API.
1717
const {app} = require('electron') as any;
1818

19-
// Set the app name and version early - these are used in --version as well as
20-
// in the User-Agent string.
21-
app.setName(pkg.name);
19+
// Set the application name and version
20+
app.setName(pkg.productName ?? pkg.name);
2221
app.setVersion(pkg.version + '-' + buildInfo.revision);
2322

2423
// Handle global command line arguments which don't require a window
@@ -31,7 +30,7 @@ const {
3130
strict: false,
3231
});
3332
if (version) {
34-
console.log(`${app.getName()} v${app.getVersion()}`);
33+
console.log(`${pkg.name} v${app.getVersion()}`);
3534
// Not app.quit() - we want to exit immediately without initialising the graphical subsystem.
3635
app.exit(0);
3736
}

0 commit comments

Comments
 (0)