有没有办法在 gulp 中自定义 git 提交消息.js任务运行程序



我已经在我当前的项目构建中实现了gulp.js,并且我正在使用gulp-git。我正在尝试弄清楚是否有一种方法可以允许用户在终端中键入"gulp commit"命令后选择输入唯一的提交消息。这可能吗?

这是当前的吞咽任务。

gulp.task('commit', function(){
  gulp.src('./*', {buffer:false})
  .pipe(git.commit('initial commit'));
});

我正在使用 gulp-git 包 https://github.com/stevelacy/gulp-git

看看gulp-prompt这似乎是你要找的:

https://www.npmjs.com/package/gulp-prompt

我还没有测试过这个,但这样的东西应该可以工作:

安装吞咽提示符npm install gulp-prompt

然后编辑您的吞噬任务。

gulp.task('commit', function(){
    var message;
    gulp.src('./*', {buffer:false})
    .pipe(prompt.prompt({
        type: 'input',
        name: 'commit',
        message: 'Please enter commit message...'
    }, function(res){
        message = res.commit;
    }))
    .pipe(git.commit(message));
});

最新更新