-
Notifications
You must be signed in to change notification settings - Fork 39
Fixed calling hooks in node_modules/.hooks folder #9
Conversation
Fixed not calling hooks in node_modules/.hooks when there is no script for that event in package.json
@ties-s I feel like I'd like this to be a bigger refactor -- the point of this shortcut is to avoid unnecessary /cc @mikesherov who might be more interested in pulling off the larger refactor. I'm gonna hold off on this PR right now, because it won't fully fix the problem, and I'd rather have this working completely. |
Thanks for contributing! Yeah, that line being removed is an important speed optimization. Luckily, most of the slowdown from going past that point is from the makeEnv call. If you changed the guard to also do an fs.stat call, we retain speed and restore correctness. |
@zkat it might be in more places but removing that line fixed the problem in my case. @mikesherov I added an extra guard in the form of |
@ties-s that looks better. Thanks for sticking with this. However, I’m wondering how this affects performance and if we need a cache for the result of these lookups. Can you run Also, it seems like we should have a unit test for this case. Can you kindly add one? |
@mikesherov Timed on 2 brand new virtual machines. Hardware: MacBook Pro 2016, 2,7 GHz Intel Core i7, 16GB RAM Using angular sample project as test material as it has a nice long list of dependencies. Results:
with extra guard
So it is little bit slower but I think thats acceptable if it makes it work like the documentation says. |
@ties-s thanks for that, and sticking with it. 2 more requests before this can land:
|
@mikesherov looks good. I don’t need credit. I’m happy when this is fixed. Do you have any idea when a npm version with this change might be released? |
@zkat can let us know when this’ll land in npm proper. Thanks again for your help! |
Fixed not calling hooks in node_modules/.hooks when there is no script for that event in package.json.
Fixes: npm/npm#19258