我可以使用Grunt与TFS吗? [英] Can I use Grunt with TFS?
问题描述
我的新项目需要我使用TFS + Git。
My new project needs me to work with TFS + Git.
坦白:我对TFS一无所知。
Confession: I know nothing about TFS.
我想为我的JavaScript项目设置一个构建。我想使用Grunt。
I want to setup a build for my JavaScript project. I want to use Grunt.
这是可能吗?有没有人使用Grunt与TFS?
Is this possible? Has anybody used Grunt with TFS?
推荐答案
在我们当前的项目,我们使用Grunt和TFS。我已经集成Grunt与TFS通过从bat文件,您可以挂接在 Pre-or Post-BuildEvents 部分。
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.
但是,因为TFS将使用特定的环境变量执行构建,需要使用绝对路径。
However, because TFS will execute your builds with specific environment variables, you need to use absolute paths.
我们完成的操作的列表
- 在您的构建机器上(以及在您的开发机器上安装node.js)
- 添加
包 $ c $。
$ - 对于您需要的所有其他软件包,请使用与步骤3中相同的标记的npm
- 编写一个bat文件
c> grunt-cli
本地(!)。使用 - save-dev
标志将此包添加到 package.json中的开发依赖项部分
- 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 installgrunt-cli
locally (!). Use the--save-dev
flag to add this package to the development dependencies section inpackage.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
- 使用绝对路径
- 使用npm安装packages.json文件中列出的所有软件包
bat文件示例
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"
这篇关于我可以使用Grunt与TFS吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!