-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix: electron-builder fails when list of node_modules files is too big to pass in a glob #8725
Open
beyondkmp
wants to merge
9
commits into
electron-userland:master
Choose a base branch
from
beyondkmp:asarUnpackPattern
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6f1078b
use dir pattern
beyondkmp d0938ac
add glob
beyondkmp 9d85eb3
Merge branch 'master' into asarUnpackPattern
beyondkmp 04fad09
add ut
beyondkmp 4ac369a
Merge branch 'asarUnpackPattern' of github.com:beyondkmp/electron-bui…
beyondkmp 86a6aa2
format code
beyondkmp e9470a6
add changeset
beyondkmp 492a2d9
use relative path glob pattern
beyondkmp 7be5628
use relative path glob pattern for all files
beyondkmp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you clarify this area of code with a comment? It looks like we're determining whether all files in the
fileSet
are being unpacked, if so, then we glob them together with an umbrella globdestination/**
to reduce the number of unpacked paths that are being passed tominimatch
?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.
Yes, exactly as you mentioned.
electron/asar doesn't implement
!
filtering. Having to do the conversion at the electron-builder layer is very complicated, and there's currently no good method for conversion.Therefore, we can only solve this problem from a different angle. Exceeding the length limit is always caused by filtering one or more directories. If we're just filtering specific files, it won't exceed the length limit. So solving these directory filtering issues would solve this problem.
Currently, there might still be some edge cases, such as when a directory contains tens of thousands of files, and the requirement is to put just a few files from this directory into asar while putting all other files into asar.unpack.
In practical use, this situation probably won't occur - it's rare to have a directory with tens of thousands of files where only a few files need to be in asar.
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.
For
unpackedPaths.add(
${destination}${path.sep}**)
, is it possible to use${relative}${path.sep}**
to shorten the minimatch paths even further? I can't recall off the top of my head whether it requires absolute paths or if relative works.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.
Good idea. However, we need to use
**${path.sep}${relative}${path.sep}**
.I've changed files to use this format as well, and current testing shows no issues.
electron-builder/packages/app-builder-lib/src/asar/asarUtil.ts
Lines 90 to 95 in 7be5628