克隆/签出git项目的Grunt任务

xve*_*ges 11 npm gruntjs

我正在开发一个使用grunt构建的项目.这取决于我想在或期间克隆/拉动的外部回购(https://github.com/facebook/xctool).npm installgrunt mySetupTask

grunt-gitcohttp://gruntjs.com/plugins/checkout上看过一个插件的踪迹,但它似乎没有.

这有什么好的起点吗?

Sin*_*hus 16

在package.json中设置npm postinstall脚本:

{
    "name": "mypackage",
    "scripts": {
        "postinstall": "git clone git://github.com/facebook/xctool.git"
    }
}
Run Code Online (Sandbox Code Playgroud)

或者使用grunt-shell执行命令来克隆repo:

grunt.initConfig({
    shell: {
        gitclone: {
            command: 'git clone git://github.com/facebook/xctool.git'
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

  • 仅供参考:你的`initConfig`对象缺少一个右括号(特别是`shell`属性对象).所以不会让我进行更改,因为编辑的最小值为6个字符. (2认同)