I'm trying to create a task that does add .
, commit
, and push
in a single command line like : gulp gitsend -m "My changes"
var gulp = require('gulp');
var argv = require('yargs').argv;
var git = require('gulp-git');
gulp.task('gitsend', function() {
if (argv.m) {
console.log('adding, commiting and pushing to git...');
return gulp.src('.')
.pipe(git.add())
.pipe(git.commit(argv.m)
.pipe(git.push('origin', 'master', function (err) {
if (err) throw err;
})));
}
});
But this is not working: it throws an exception:
/Users/me/myproj/front/node_modules/gulp-git/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623
var written = dest.write(chunk);
^
TypeError: undefined is not a function
at write (/Users/me/myproj/front/node_modules/gulp-git/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
at flow (/Users/me/myproj/front/node_modules/gulp-git/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)
at DestroyableTransform.pipeOnReadable (/Users/me/myproj/front/node_modules/gulp-git/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:664:5)
at DestroyableTransform.emit (events.js:104:17)
at emitReadable_ (/Users/me/myproj/front/node_modules/gulp-git/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:448:10)
at emitReadable (/Users/me/myproj/front/node_modules/gulp-git/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:444:5)
at readableAddChunk (/Users/me/myproj/front/node_modules/gulp-git/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:187:9)
at DestroyableTransform.Readable.push (/Users/me/myproj/front/node_modules/gulp-git/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:149:10)
at DestroyableTransform.Transform.push (/Users/me/myproj/front/node_modules/gulp-git/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:145:32)
at Array.forEach (native)
Any idea what's wrong and how can I archive my need ? Thank you.