-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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: asar handling of package.json
#46099
base: main
Are you sure you want to change the base?
Conversation
const realPath = archive.copyFileOut(filePath); | ||
if (!realPath) return undefined; | ||
|
||
return getNearestParentPackageJSON(realPath); |
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 we do this without copyFileOut
, that seems excessive. I also don't think this works correctly. This is going to copy out the file at checkPath
but what it would need copied out is the nearest package.json
.
I think we need to actually re-implement getNearestParentPackageJSON
in JS here and just have it be ASAR aware. i.e. traverse up the path tree until we leave the ASAR, then we hand it back off to native land
const realPath = archive.copyFileOut(filePath); | ||
if (!realPath) return undefined; | ||
|
||
return getNearestParentPackageJSONType(realPath); |
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.
Same here, copyFileOut
isn't copying the file we need, in fact it may be a directory not a file. We should re-implement here
Description of Change
Fixes an issue where packaged apps could sometimes fail to find the correct
package.json
in asar directories.Tested with:
To ensure that it finds the
package.json
inapp.asar
as expected.Checklist
npm test
passesRelease Notes
Notes: Fixed an issue where packaged apps could sometimes fail to find the correct
package.json
in asar directories.