Skip to content

Commit

Permalink
(fix): productName can also be in package.json root
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Oct 12, 2023
1 parent 52ab84d commit 2ad7808
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default class ElectronLaunchService implements Services.ServiceInstance {
* @returns path to the Electron app binary
*/
export async function detectBinaryPath(pkg: NormalizedReadResult, p = process) {
const appName: string = pkg.packageJson.build?.productName || pkg.packageJson.name;
const appName: string = pkg.packageJson.productName || pkg.packageJson.build?.productName || pkg.packageJson.name;
if (!appName) {
return undefined;
}
Expand Down
8 changes: 2 additions & 6 deletions test/launcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,7 @@ describe('detectBinaryPath', () => {
{
path: pkgJSONPath,
packageJson: {
build: {
productName: 'my-app',
},
productName: 'my-app',
devDependencies: {
'@electron-forge/cli': '7.0.0-beta.54',
},
Expand Down Expand Up @@ -554,9 +552,7 @@ describe('detectBinaryPath', () => {
{
path: pkgJSONPath,
packageJson: {
build: {
productName: 'my-app',
},
productName: 'my-app',
devDependencies: {
'electron-builder': '^24.6.4',
},
Expand Down

0 comments on commit 2ad7808

Please sign in to comment.