Piotrek Koszuliński преди 9 години
родител
ревизия
39232359c2
променени са 1 файла, в които са добавени 53 реда и са изтрити 42 реда
  1. 53 42
      gulpfile.js

+ 53 - 42
gulpfile.js

@@ -37,15 +37,18 @@ const config = {
 	]
 };
 
-// Lint tasks.
+// Lint tasks. ---------------------------------------------------------------
+
 const ckeditor5Lint = require( 'ckeditor5-dev-lint' )( config );
+
 gulp.task( 'lint', ckeditor5Lint.lint );
 gulp.task( 'lint-staged', ckeditor5Lint.lintStaged );
-gulp.task( 'default', [ 'compile' ] );
 gulp.task( 'pre-commit', [ 'lint-staged' ] );
 
-// Development environment tasks.
+// Development environment tasks. ---------------------------------------------
+
 const ckeditor5DevEnv = require( 'ckeditor5-dev-env' )( config );
+
 gulp.task( 'init', ckeditor5DevEnv.initRepository );
 gulp.task( 'create-package', ckeditor5DevEnv.createPackage );
 gulp.task( 'update', ckeditor5DevEnv.updateRepositories );
@@ -56,45 +59,29 @@ gulp.task( 'relink', ckeditor5DevEnv.relink );
 gulp.task( 'install', ckeditor5DevEnv.installPackage );
 gulp.task( 'exec', ckeditor5DevEnv.execOnRepositories );
 
-// Bundling and building tasks.
-const ckeditor5DevBundle = require( 'ckeditor5-dev-bundler-rollup' )( config );
-gulp.task( 'bundle:clean', ckeditor5DevBundle.cleanFromConfig );
-gulp.task( 'bundle:minify:js', ckeditor5DevBundle.minify.jsFromConfig );
-gulp.task( 'bundle:minify:css', ckeditor5DevBundle.minify.cssFromConfig );
+// Compilation tasks. ---------------------------------------------------------
 
-gulp.task( 'build:generate',
-	[
-		'bundle:clean',
-		'compile:js:esnext',
-		'compile:themes:esnext'
-	],
-	ckeditor5DevBundle.generateFromConfig
-);
-
-gulp.task( 'build', ( callback ) => {
-	runSequence( 'build:generate',
-		[
-			'bundle:minify:js',
-			'bundle:minify:css'
-		],
-		() => ckeditor5DevBundle.showSummaryFromConfig( callback )
-	);
-} );
-
-// Compile tasks.
 const ckeditor5DevCompiler = require( 'ckeditor5-dev-compiler' )( config );
 const compiler = ckeditor5DevCompiler.compiler;
 
+gulp.task( 'default', [ 'compile' ] );
+
 gulp.task( 'compile', callback => {
 	runSequence( 'compile:clean:all', 'compile:themes', 'compile:js', callback );
 } );
 
-// Clean tasks.
+// TODO This task is temporary: https://github.com/ckeditor/ckeditor5-dev-compiler/issues/24
+gulp.task( 'compile:sample-tests', [ 'compile' ], () => compiler.compile.tests.local() );
+gulp.task( 'compile:bundled-sample-tests', [ 'compile:bundled-sample-tests:build-editors' ],
+	() => compiler.compile.tests.bundled() );
+
+// Helpers. ---------------------------
+
 gulp.task( 'compile:clean:all', () => compiler.clean.all() );
 gulp.task( 'compile:clean:themes', () => compiler.clean.themes() );
 gulp.task( 'compile:clean:js', () => compiler.clean.js() );
 
-gulp.task( 'compile:themes', ( callback ) => {
+gulp.task( 'compile:themes', callback => {
 	runSequence( 'compile:clean:themes', 'compile:icons', 'compile:sass', callback );
 } );
 
@@ -102,27 +89,49 @@ gulp.task( 'compile:sass', () => compiler.compile.sass() );
 gulp.task( 'compile:icons', () => compiler.compile.icons() );
 gulp.task( 'compile:js', [ 'compile:clean:js' ], () => compiler.compile.js() );
 
-// Tasks specific for preparing compiled output with unmodified source files. Uses by `gulp docs` or `gulp bundle`.
+// Tasks specific for preparing compiled output with unmodified source files. Used by `gulp docs` or `gulp build`.
 gulp.task( 'compile:clean:js:esnext', () => compiler.clean.js( { formats: [ 'esnext' ] } ) );
 gulp.task( 'compile:clean:themes:esnext', () => compiler.clean.themes( { formats: [ 'esnext' ] } ) );
 gulp.task( 'compile:sass:esnext', () => compiler.compile.sass( { formats: [ 'esnext' ] } ) );
 gulp.task( 'compile:icons:esnext', () => compiler.compile.icons( { formats: [ 'esnext' ] } ) );
 gulp.task( 'compile:js:esnext', [ 'compile:clean:js:esnext' ], () => compiler.compile.js( { formats: [ 'esnext' ] } ) );
-gulp.task( 'compile:themes:esnext', ( callback ) => {
+gulp.task( 'compile:themes:esnext', callback => {
 	runSequence( 'compile:clean:themes:esnext', 'compile:icons:esnext', 'compile:sass:esnext', callback );
 } );
 
-// Tasks specific for testing under node.
-gulp.task( 'compile:clean:js:cjs', () => compiler.clean.js( { formats: [ 'cjs' ] } ) );
-gulp.task( 'compile:js:cjs', [ 'compile:clean:js:cjs' ], () => compiler.compile.js( { formats: [ 'cjs' ] } ) );
+// Building tasks. ------------------------------------------------------------
+
+const ckeditor5DevBundle = require( 'ckeditor5-dev-bundler-rollup' )( config );
+
+gulp.task( 'build', callback => {
+	runSequence(
+		'bundle:generate',
+		[
+			'bundle:minify:js',
+			'bundle:minify:css'
+		],
+		() => ckeditor5DevBundle.showSummaryFromConfig( callback )
+	);
+} );
+
+// Helpers. ---------------------------
 
-// Tasks specific for testing releases.
-gulp.task( 'test:samples:local', [ 'compile' ], () => compiler.compile.tests.local() );
-gulp.task( 'test:samples:bundled', [ 'compile:samples' ], () => compiler.compile.tests.bundled() );
-gulp.task( 'test:samples', [ 'test:samples:local', 'test:samples:bundled' ] );
+gulp.task( 'bundle:clean', ckeditor5DevBundle.cleanFromConfig );
+gulp.task( 'bundle:minify:js', ckeditor5DevBundle.minify.jsFromConfig );
+gulp.task( 'bundle:minify:css', ckeditor5DevBundle.minify.cssFromConfig );
 
-// Tasks specific for building editors for testing releases.
-gulp.task( 'compile:samples',
+// Generates the bundle without minifying it.
+gulp.task( 'bundle:generate',
+	[
+		'bundle:clean',
+		'compile:js:esnext',
+		'compile:themes:esnext'
+	],
+	ckeditor5DevBundle.generateFromConfig
+);
+
+// Task specific for building editors for testing releases.
+gulp.task( 'compile:bundled-sample-tests:build-editors',
 	[
 		'compile:js:esnext',
 		'compile:themes:esnext'
@@ -130,6 +139,8 @@ gulp.task( 'compile:samples',
 	ckeditor5DevBundle.buildEditorsForSamples
 );
 
-// Docs.
+// Documentation. -------------------------------------------------------------
+
 const docsBuilder = ckeditor5DevCompiler.docs;
+
 gulp.task( 'docs', [ 'compile:js:esnext' ], docsBuilder.buildDocs );