observing / pre-commit

Automatically installs a git pre-commit script in your git repository which runs your `npm test` on pre-commit
MIT License
1.88k stars 150 forks source link

Allow skipping invocation of `npm` binary #94

Closed hawkrives closed 7 years ago

hawkrives commented 7 years ago

An attempt at #93.

I'm not sure if this is an optimal solution, but this allows you to define "npm": false in your pre-commit config to skip invoking npm's binary.

Instead, the current implementation simply takes the cmd name as ./node_modules/.bin/$cmd and runs it.

I suppose that this should use which to look for the binary before running it, which I can do if you'd prefer.

I'm also not sure if/how you'd like this tested, so all I've done is ensure that it works on my project.

Example:

"pre-commit": {
    "npm": false,
    "run": "lint-staged"
},
coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.8%) to 94.619% when pulling c9655d018c7d1065b214d2950dd6136bfe1faf43 on hawkrives:patch-1 into f55b66b9c75b73a903f5b77c7c511a13e0c7edff on observing:master.

hawkrives commented 7 years ago

Well. Um. I guess I have some more work to do. Apologies for the noise!

hawkrives commented 7 years ago

(I wound up not using pre-commit, so I never finished fixing this.)