Repository: electron/electron (language: cpp)

Issue:
[Bug]: V8 flags and desktop name in package.json does not hornored when running local app using electron cli
### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a bug report that matches the one I want to file, without success.

### Electron Version

20.0.3

### What operating system are you using?

Other Linux

### Operating System Version

Linux pc 5.19.13-arch1-1.1 #1 SMP PREEMPT_DYNAMIC Wed, 05 Oct 2022 07:37:04 +0000 x86_64 GNU/Linux

### What arch are you using?

x64

### Last Known Working Electron version

_No response_

### Expected Behavior

Launch local app by `electron /path/to/app/dir` , then `/path/to/app/dir/package.json` data (`productName`, `version`, `desktopName`, etc.) is loaded.

### Actual Behavior

~~Electron's default values are used.~~
**Edit**: Name and version are correctly updated. https://github.com/electron/electron/blob/c2cb97ea298412143e34027fac2c28fd031e169a/default_app/main.ts#L99-L106
It looks like `desktopName` and `v8Flags` should be considered too.
ref:https://github.com/electron/electron/blob/c2cb97ea298412143e34027fac2c28fd031e169a/lib/browser/init.ts#L107-L130

### Testcase Gist URL

_No response_

### Additional Information

_No response_


Discussion / hints:

Fix patch:
diff --git a/default_app/main.ts b/default_app/main.ts
index f2834624f7430..7defe97f3ecf3 100644
--- a/default_app/main.ts
+++ b/default_app/main.ts
@@ -83,7 +83,7 @@ function loadApplicationPackage (packagePath: string) {
   });
 
   try {
-    // Override app name and version.
+    // Override app's package.json data.
     packagePath = path.resolve(packagePath);
     const packageJsonPath = path.join(packagePath, 'package.json');
     let appPath;
@@ -104,6 +104,16 @@ function loadApplicationPackage (packagePath: string) {
       } else if (packageJson.name) {
         app.name = packageJson.name;
       }
+      if (packageJson.desktopName) {
+        app.setDesktopName(packageJson.desktopName);
+      } else {
+        app.setDesktopName(`${app.name}.desktop`);
+      }
+      // Set v8 flags, deliberately lazy load so that apps that do not use this
+      // feature do not pay the price
+      if (packageJson.v8Flags) {
+        require('v8').setFlagsFromString(packageJson.v8Flags);
+      }
       appPath = packagePath;
     }
 


Test patch: