在Travis CI上运行grunt build命令 [英] Run grunt build command on Travis CI

查看:113
本文介绍了在Travis CI上运行grunt build命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Travis CI来测试和构建我的项目,并且作为它的一部分,我想让travis运行 grunt build 我已经尝试了以下方法,但没有运气。


  • script:grunt build

  • script:./node_modules/grunt build

  • script:./node_modules/grunt / grunt build

  • script:./node_modules/grunt/grunt.js build


解决方案

您是否确定要安装 grunt-cli 在你的Travis节点上全局化?



我的Travis CI配置看起来像:

 语言:node_js 
node_js:
- 0.8
before_install:npm install -g grunt-cli
install:npm install
before_script: grunt build

和我的package.json一样:

  {
...
脚本:{
test:grunt test
},
...
}

我将解释Travis将执行的步骤流程:


  1. 要执行的第一步是 before_install 。我唯一的先决条件(除了node.js)是 grunt-cli ,所以我使用这一步来安装它。 code> install step,在我的情况下,这将简单地安装我的npm模块

  2. 脚本之前的 ,运行 grunt build

  3. 最后,Travis将在package.json中查找脚本,步骤应该运行 grunt test

我想说明这是我个人对如何配置Travis的意见。我当然不倾向你应该使用完全相同的方法。


I am using Travis CI to test and build my project and as part of it I want travis to run grunt build i have tried the following but have had no luck.

  • script: "grunt build"
  • script: "./node_modules/grunt build"
  • script: "./node_modules/grunt/grunt build"
  • script: "./node_modules/grunt/grunt.js build"

解决方案

Have you made sure to install grunt-cli globally on your Travis node?

My Travis CI config looks like:

language: node_js
node_js:
  - "0.8"
before_install: npm install -g grunt-cli
install: npm install
before_script: grunt build

And my package.json:

{
    ...
    "scripts": {
        "test": "grunt test"
    },
    ...
}

I will explain the flow of steps that Travis will execute:

  1. The first step to be executed is the before_install. My only prerequisite (besides node.js) is grunt-cli so I use this step to install it.
  2. Next is the install step, in my case this will simply install my npm modules
  3. The before script is then executed, running grunt build
  4. Lastly Travis will look for scripts in the package.json, there I indicated the test step should run grunt test

I'd like to note that this is my own opinion on how to configure Travis. I'm certainly not inclining you should use exactly the same approach.

这篇关于在Travis CI上运行grunt build命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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