在Travis CI上运行grunt build命令 [英] Run grunt build command on Travis CI
问题描述
我使用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将执行的步骤流程:
- 要执行的第一步是
before_install
。我唯一的先决条件(除了node.js)是grunt-cli
,所以我使用这一步来安装它。 code> install step,在我的情况下,这将简单地安装我的npm模块 - 脚本之前的
$ c $然后执行c>,运行
grunt build
- 最后,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:
- The first step to be executed is the
before_install
. My only prerequisite (besides node.js) isgrunt-cli
so I use this step to install it. - Next is the
install
step, in my case this will simply install my npm modules - The
before script
is then executed, runninggrunt build
- 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屋!