We want every person that does a push in our git repository to run "grunt" before this is done. We enforce this by having a pre-push hook in
.git/hooks/pre-push and writing
npm install and
grunt in that file.
We also have a TFS repository. I am looking for similar logic to be used here. Meaning, we want a sort of "Gated check-in" when someone tries to check something in. This will only starts up PowerShell and runs
npm install and
We don't want TFS to do anything else (run build, run tests etc. (all this is done in the grunt task)).
Is this possible? Anyone know how?
TFS has nothing to do with what you do locally. You can add as many pre-commit hooks to your repo and push them to TFS. TFS will happily store these hook scripts. ANd when you are using a client that supports them, that client will execute them pre-commit.
But if you expect Visual Studio to run these hooks before commit, you're probably out of luck. There is no "check-in policy" support for Visual Studio when connected to Git. Nor in any other Git client based on LibGit2 at present as far as I can tell.
You could setup a branch policy linked to a CI build, effectively running the grunt tasks on a build server, but I understand this is not what you want. .
There's some background available on the LibGit2 issue section, which is what Visual Studio uses to implement its git functionality. And this corresponding user voice item for Visual Studio. As well as a discussion on the GitHub for Windows client which uses the same underlying library.