git-commit.js 789 B

123456789101112131415161718192021222324252627282930
  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. * Example: gulp exec --task git-commit --message "Commit message."
  11. *
  12. * @param {String} workdir
  13. * @param {Object} params
  14. * @returns {Object} stream
  15. */
  16. module.exports = ( workdir, params ) => {
  17. const message = params.message;
  18. if ( !message ) {
  19. throw new Error( 'You must provide commit message with parameter: --message' );
  20. }
  21. git.commit( message, workdir );
  22. // Return dummy stream to inform gulp about finishing task
  23. return new PassThrough();
  24. };