Skip to content
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

Update cleanup directory defaults #467

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

gwleuverink
Copy link
Contributor

@gwleuverink gwleuverink commented Jan 13, 2025

Accompanies PR NativePHP/electron#153

storage/app/framework/{sessions,testing,cache} & storage/logs/laravel.log have been moved to the build command default exclude patterns. Since They should aways be excluded from the final build because of security concerns.

I've added vendor/bin & node_modules as sensible defaults to be tweaked.

@simonhamp What do you think about this? If accepted this should be mentioned in a update guide.

Copy link
Member

@simonhamp simonhamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep this seems fine. I'm ignoring the failing test as it won't apply in the context where this new config gets used, but I can't merge and release this until that Minify command is gone

@gwleuverink
Copy link
Contributor Author

gwleuverink commented Jan 14, 2025

I see. I can delete the minify command aswel. The IgnoreFilesAndFoldersTest should at least be ported over to the other PR i think. Will pick that up!

Edit: This does raise the question of where things belong. The minification / cleaning step is now part of the copy step of the build command on the electron repo. I could argue that that piece of functionality should actually live in this repository. What do you think?

@gwleuverink gwleuverink marked this pull request as draft January 14, 2025 08:17
@simonhamp
Copy link
Member

This does raise the question of where things belong.

Yeh I've found this to be a bit of a challenge. I think this stems from the fact that only have this Laravel adapter and the Electron driver. It may become clearer if/when we add more drivers and adapters...

I have thoughts on how we may divide this better, but I'm keen not to over-engineer stuff on this front until it becomes more obvious.

Maybe for now we do what works and refactor once it becomes clear?

@simonhamp
Copy link
Member

On not merging... actually, maybe we can... I don't think that minify command is even being used any more, right?

@SRWieZ
Copy link
Contributor

SRWieZ commented Jan 14, 2025

Minify command is not used anymore. You even deleted it from your original obfuscation PR: 8b929a6

@gwleuverink
Copy link
Contributor Author

I just noticed something. Slight oversight on my part.

Since the app cleaning is done before running composer install --no-dev inside the build directory, any executables that are not dev-dependencies will be reinstalled. So even though vendor/bin is in the exclude list, this directory will not be empty.

Without the dev dependencies, the footprint still is very small (20kb) in a fresh app.
I'm considering removing vendor/bin from the config array. Or should I rewrite the thing so we do a extra pass of cleaning after composer install ran?

@simonhamp
Copy link
Member

Let's do the extra pass AND remove it from the config array

@gwleuverink
Copy link
Contributor Author

gwleuverink commented Jan 14, 2025

Let's do the extra pass AND remove it from the config array

Cool! I've added that here NativePHP/electron@550922d

I've also removed vendor/bin from the config, but added */tests.

Yeh I've found this to be a bit of a challenge

I moved the list of default patterns to the internal config, this way the definitions are at least inside the laravel repo. Is that okay? I can move them back.

Edit: moved them back. The tests live in the electron repo right now so it's easier if it's not spread out. Still makes sense to move everything that only touches the Laravel side of things over to this repo in my mind. The boundaries of each repo's responsibilities become a bit vague.


I left the content dir in the config, but I don't think it's used at all.

gwleuverink and others added 4 commits January 15, 2025 18:49
@gwleuverink gwleuverink marked this pull request as ready for review January 24, 2025 21:47
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.

3 participants