我有一个包含多个未发布模块的 Node 应用程序。我的应用程序的 package.json
包含一些 git 依赖项:
"module-a": "git+ssh://git@github.com:me/module-a.git",
"module-b": "git+ssh://git@github.com:me/module-b.git"
并且每个都有自己的 grunt 配置。例如在 node_modules/module-a/grunt.js
中:
module.exports = function(grunt) {
grunt.initConfig({
lint: {
files: ['server/**/*.js', 'test/**/*.js']
},
jshint: {
options: require('./lint-ci')
}
});
grunt.registerTask('default', 'lint');
};
(他们也运行测试等,但我在这里保持简单)
grunt 有内置的方法吗?请注意,当我只更改该依赖项中的某些内容时,为了方便起见,我想保留相关的 grunt.js 文件。
我找到的唯一解决方案是
- 以编程方式构建我的主要 grunt.js(例如,迭代我在 package.json 中的依赖项以构建 lint 和测试配置)
- 使用
--config node_modules/module-a/grunt.js
多次调用grunt
似乎都不理想。有没有更好的办法?
最佳答案
只是一个想法,但你看过 grunt-hub 了吗?
关于javascript - 运行跨多个 grunt.js 文件配置的任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14721597/