Skip to content

fix(electron): resolve sub-paths inside published electron project - #156

Open
SDJeff wants to merge 1 commit into
NativePHP:mainfrom
SDJeff:fix/electron-path-with-subpath
Open

SDJeff wants to merge 1 commit into
NativePHP:mainfrom
SDJeff:fix/electron-path-with-subpath

Conversation

@SDJeff

@SDJeff SDJeff commented Sep 17, 2026

Copy link
Copy Markdown

Problem

With a published Electron project (nativephp/electron), php artisan native:run fails on macOS:

file_get_contents(.../vendor/nativephp/desktop/resources/electron/node_modules/electron/dist/Electron.app/Contents/Info.plist): Failed to open stream: No such file or directory
at src/Drivers/Electron/Commands/RunCommand.php:76

ElectronServiceProvider::electronPath() checks for package.json inside the requested sub-path (e.g. .../Info.plist/package.json) instead of the project root. Every call with a non-empty $path therefore falls back to the vendor directory, affecting patchPlist(), PatchesPackagesJson, InstallsAppIcon and LivewireDispatcher.

Fix

Check for nativephp/electron/package.json at the project root, then append the sub-path.

Tests

Added tests/Electron/ElectronPathTest.php covering sub-path resolution for a published project (fails without the fix) and the vendor fallback.

Environment

  • nativephp/desktop 2.3.1
  • macOS arm64, PHP 8.4 (Herd), Node 24.21.0 / npm 12.0.2

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 4e0540be-0168-4829-b0b8-9a4851b7f1ef

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant