Can I use Grunt with TFS?
continuous-integration, gruntjs, javascript, tfs, tfsbuild
Solution
On our current project, we're using Grunt and TFS. I've integrated Grunt with TFS by caling it from a bat file which you can hook up in the Pre- or Post-BuildEvents section of your project file.
However, because TFS will execute your builds with specific environment variables, you need to use absolute paths.
A list of the things we've done
- Install node.js on your build machine (as well as on your development machine(s) ofcourse)
- Add a `package.json`file on the root of your JavaScript project.
- Use `npm` to install `grunt-cli` locally (!). Use the `--save-dev` flag to add this package to the development dependencies section in `package.json`
- For all other packages you need, use npm with the same flag as in step 3
- Write a bat file (see example below) in which you'll
- make use of absolute paths
- use npm to install all the packages listed in the packages.json file
- call grunt
- In your Pre- or PostBuildEvents, call this bat file
bat file example
rem use call to execute other bat files
echo npm install
call "C:\Program Files\nodejs\npm" install
rem because we have listed grunt-cli as a dev dependency,
rem the executable will be located in the node_modules folder
echo grunt
call "./node_modules/.bin/grunt"
Problem
My new project needs me to work with TFS + Git. Confession: I know nothing about TFS. I want to setup a build for my JavaScript project. I want to use Grunt. Is this possible? Has anybody used Grunt with TFS?