git-commit.js 762 B

12345678910111213141516171819202122232425262728
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. const git = require( '../utils/git' );
  7. const PassThrough = require( 'stream' ).PassThrough;
  8. /**
  9. * Adds only modified files to git repository and commits them with provided message
  10. *
  11. * @param {String} workdir
  12. * @param {Object} params
  13. * @returns {Object} stream
  14. */
  15. module.exports = ( workdir, params ) => {
  16. if ( !( params.message || params.m ) ) {
  17. throw new Error( 'You must provide commit message with parameter: --message | -m ' );
  18. }
  19. const message = params.message || params.m;
  20. git.commit( message, workdir );
  21. // Return dummy stream to inform gulp about finishing task
  22. return new PassThrough();
  23. };