Open rauchg opened 7 years ago
The reason that I hooked into the npm process is because npm introduces a bunch of environment variables and what not when it starts a script. I honestly don't know if this is something that a lot people are using, but I'm all for removing this extra step.
I love the fact that
pre-commit
ties directly intopackage.json
scripts
from an ergonomics perspective.However, I think it'd be a good idea to avoid the npm sub-process altogether, for performance reasons. You could, for example, look up the scripts yourself and run them with the
./node_modules/.bin
prefix.Every commit will pay a penalty of ~380ms per
pre-commit
script defined. See investigation by @vjeux: https://github.com/jlongster/prettier/issues/443Since
pre-commit
is now the recommended way to set up prettier, I think this is very much a worthwhile optimization that'll save a lot of time to many people.