-
-
Notifications
You must be signed in to change notification settings - Fork 95
Extra files #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extra files #230
Conversation
Linked: NativePHP/laravel#635 @simonhamp Is this ready for testing? Todo:
|
Jotted down some docs for your review NativePHP/nativephp.com#181 |
@gwleuverink should be! I don't think we need an example in the kitchen sink for this to be released. Thanks for doing the docs! 🙏🏼 |
I ran into something weird. After changing to this feature branch I wasn't able to run I had to update the file extension from After this everything installs without issues & the plugin builds like usual. The strange thing is I don't see any changes in this PR that should could have caused this. Again, on the main branch @simonhamp does I've tried with node 22 & 20. Both give the same error.
|
I see now the build & test actions have the same problem. The change to .mjs suggested above will likely fix it |
Thanks @gwleuverink - if this is working for you now, do you fancy approving and I'll get this released |
The The build action fails, but this likely is due to the update to the upgrade to v6 of stefanzweifel/git-auto-commit-action#383 I'll add the workaround suggested in the thread. |
The suggested fix didn't work. I've reverted |
Absolutely. I'm testing it right now. Can you clarify something for me? I've done the following:
Then, when listing the contents of the storage driver it's empty. Storage::disk('extras')->listContents('')->toArray(); // No files in here Turns out the extras disk is pointing to Any idea? I was expecting it to be |
Follow-up:
Note I'm not writing to the disk, this is thrown by the code sample from my previous comment |
It's a head scratcher. It's explained in this issue: electron-userland/electron-builder#8389 Because this package type Updating |
? join(app.getAppPath(), 'nativephp', 'extras') | ||
: join(app.getAppPath(), '..', '..', 'extras'), | ||
? join(process.resourcesPath, '..', 'extras') | ||
: join(process.env.APP_PATH, 'extras'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I installed the electron package from a symlinked directory.
The original join(app.getAppPath(), '..', '..', 'extras')
pointed to a wrong relative path
Using APP_PATH
makes this consistent no matter how you structure your dev setup
NATIVEPHP_EXTRAS_PATH: app.isPackaged | ||
? join(app.getAppPath(), 'nativephp', 'extras') | ||
: join(app.getAppPath(), '..', '..', 'extras'), | ||
? join(process.resourcesPath, '..', 'extras') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original join(app.getAppPath(), 'nativephp', 'extras')
pointed to playground.app/Contents/Resources/app.asar/nativephp/extras
Electron builder automatically the extra files in playground.app/Contents/extras
.
Using process.resourcesPath
instead points it to the right place
'dist', | ||
'build', | ||
'temp', | ||
'extras', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to pack it up in the archive. Otherwise the extra files will be included in the app twice
Everything is working for me now 👌🏻 |
Great work @gwleuverink - feel free to review and merge |
This build setting allows the developer to add arbitrary files (even pre-compiled executables) into their NativePHP application.
They just need to live in a new folder at the root of your project called
extras/
and they will be copied into place.It also adds the relevant environment to expose the
extras
path inside the distributed application to the PHP side.Note: if shipping binaries here, it's the developer's responsibility to ship and execute the appropriate binary for the user's platform.