我可以使用Grunt与TFS吗? [英] Can I use Grunt with TFS?

查看:125
本文介绍了我可以使用Grunt与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.

我们完成的操作的列表


  1. 在您的构建机器上(以及在您的开发机器上安装node.js)

  2. 添加包 $ c $。
  3. $ c> grunt-cli 本地(!)。使用 - save-dev 标志将此包添加到 package.json中的开发依赖项部分
  4. 对于您需要的所有其他软件包,请使用与步骤3中相同的标记的npm

  5. 编写一个bat文件
  1. Install node.js on your build machine (as well as on your development machine(s) ofcourse)
  2. Add a package.jsonfile on the root of your JavaScript project.
  3. Use npm to install grunt-cli locally (!). Use the --save-dev flag to add this package to the development dependencies section in package.json
  4. For all other packages you need, use npm with the same flag as in step 3
  5. Write a bat file (see example below) in which you'll

  1. 使用绝对路径

  2. 使用npm安装packages.json文件中列出的所有软件包



  • 在您的Pre-或PostBuildEvents中,调用此bat文件

  • 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屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆