fix(lifecycle): detect binding.gyp for default install lifecycle#46
fix(lifecycle): detect binding.gyp for default install lifecycle#46zkat merged 1 commit intozkat:latestfrom caleblloyd:fix_lifecycle_install_default
Conversation
zkat
left a comment
There was a problem hiding this comment.
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 |
zkat
left a comment
There was a problem hiding this comment.
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.gypexists in a package without aninstalllifecycle script, and if so adds the default install lifecycle scriptI opted to check for
binding.gypusingstatAsyncinstead of readPkgJson.extras because the only thing needed here wasbinding.gypdetection, not everything else provided byreadPkgJson.extrasI looked at adding a test but was unable to come up with a good way to make a fake
binding.gypthat could output a detectable string. I'm open for suggestions though.