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

时间:2013-07-05 05:32:07

标签: npm gruntjs

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

我在http://gruntjs.com/plugins/checkout看到了grunt-gitco插件的踪迹,但似乎没有。

这有什么好的起点吗?

3 个答案:

答案 0 :(得分:16)

在package.json中设置npm postinstall script

{
    "name": "mypackage",
    "scripts": {
        "postinstall": "git clone git://github.com/facebook/xctool.git"
    }
}

或使用grunt-shell执行克隆回购的命令:

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

答案 1 :(得分:4)

现在有一个Grunt插件。不确定它当时是否可用。我仍有一些问题让它发挥作用。

https://npmjs.org/package/grunt-git

gitclone:
  clone:
    options:
      repository: "https://github.com/imaginethepoet/autojqm"
      branch: "master"
      directory: "repo"

答案 2 :(得分:3)

您知道npm install支持git网址吗?

npm install git://github.com/facebook/xctool.git

Docs