-
Notifications
You must be signed in to change notification settings - Fork 43
fix(lifecycle): detect binding.gyp for default install lifecycle #46
Conversation
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.
Thanks for this patch! I'm glad you found this and fixed it 💚
The patch looks good, but I'm wondering if it makes sense to move this to the updateJson
method -- that's usually used to add the _from
field but you can use it to do the binding.gyp check.
The main difference is that buildTree happens serially, so those statAsync calls are going to block iteration.
My strongest preference is to have pacote
itself detect binding.gyp
on extract, which would allow us to skip the stats altogether (they're pretty expensive, performance-wise, and this one is going to be very common)
I've moved the logic to |
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.
Awesome! And I tested this locally and it seems to not have any noticeable performance impact. Thanks a bunch for this and the changes! 🚢
I've merged this and it's been released as |
Great, thanks! I've patched this fix into my workflow and it seems to fix the original issue with no side effects. Looking forward to pulling it down in the next npm release! |
detect binding.gyp for default install lifecycle PR-URL: zkat/cipm#46 Fixes: zkat/cipm#45 Credit: @caleblloyd Reviewed-By: @zkat
detect binding.gyp for default install lifecycle PR-URL: zkat/cipm#46 Fixes: zkat/cipm#45 Credit: @caleblloyd Reviewed-By: @zkat
This is a continuation of zkat#45, a side-effect of the provided fix for it in zkat#46 and was introduced in `cipm@1.6.2`. For the case where a default `install` script is used and a `binding.gyp` file is present in the package root, `npm ci` will fail with packages that target a different platform that the one currently running. Fixes zkat#49
This is a fix to detect if
binding.gyp
exists in a package without aninstall
lifecycle script, and if so adds the default install lifecycle scriptI opted to check for
binding.gyp
usingstatAsync
instead of readPkgJson.extras because the only thing needed here wasbinding.gyp
detection, not everything else provided byreadPkgJson.extras
I looked at adding a test but was unable to come up with a good way to make a fake
binding.gyp
that could output a detectable string. I'm open for suggestions though.