8
0
Просмотр исходного кода

Refactored part of exec task – functions don't have to return any value now.

Piotrek Koszuliński 9 лет назад
Родитель
Сommit
76eadeb3c4

+ 1 - 1
dev/tasks/exec/functions/bump-year.js

@@ -21,7 +21,7 @@ const year = '2017';
  *		gulp exec --task bump-year
  *
  * @param {String} workdir
- * @returns {Object}
+ * @returns {Stream}
  */
 module.exports = function executeBumpYear( workdir ) {
 	const licenseRegexp = /(@license Copyright \(c\) 2003-)[0-9]{4}(, CKSource - Frederico Knabben\.)/g;

+ 0 - 5
dev/tasks/exec/functions/git-commit.js

@@ -6,7 +6,6 @@
 'use strict';
 
 const git = require( '../utils/git' );
-const PassThrough = require( 'stream' ).PassThrough;
 
 /**
  * Adds only modified files to git repository and commits them with provided message.
@@ -17,7 +16,6 @@ const PassThrough = require( 'stream' ).PassThrough;
  *
  * @param {String} workdir
  * @param {Object} params
- * @returns {Stream}
  */
 module.exports = function executeGitCommit( workdir, params ) {
 	const message = params.message;
@@ -27,7 +25,4 @@ module.exports = function executeGitCommit( workdir, params ) {
 	}
 
 	git.commit( message, workdir );
-
-	// Return dummy stream to inform gulp about finishing task.
-	return new PassThrough();
 };

+ 0 - 5
dev/tasks/exec/functions/git-push.js

@@ -6,7 +6,6 @@
 'use strict';
 
 const git = require( '../utils/git' );
-const PassThrough = require( 'stream' ).PassThrough;
 
 /**
  * Pushes changes of current branch in repository to default origin.
@@ -16,11 +15,7 @@ const PassThrough = require( 'stream' ).PassThrough;
  *		gulp exec --task git-push
  *
  * @param {String} workdir
- * @returns {Stream}
  */
 module.exports = function executeGitPush( workdir ) {
 	git.push( workdir );
-
-	// Return dummy stream to inform gulp about finishing task.
-	return new PassThrough();
 };

+ 5 - 1
dev/tasks/exec/tasks.js

@@ -88,7 +88,11 @@ function execute( execTask, ckeditor5Path, packageJSON, workspaceRoot, params )
 		try {
 			log.out( `Executing task on ${ dir.repositoryURL }...` );
 
-			mergedStream.add( execTask( dir.repositoryPath, params ) );
+			const result = execTask( dir.repositoryPath, params );
+
+			if ( result ) {
+				mergedStream.add( result );
+			}
 		} catch ( err ) {
 			log.err( err );
 		}