|
|
@@ -7,8 +7,10 @@
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
+const path = require( 'path' );
|
|
|
const gulp = require( 'gulp' );
|
|
|
const runSequence = require( 'run-sequence' );
|
|
|
+const compiler = require( '@ckeditor/ckeditor5-dev-compiler' );
|
|
|
|
|
|
const config = {
|
|
|
ROOT_DIR: '.',
|
|
|
@@ -38,6 +40,11 @@ const config = {
|
|
|
]
|
|
|
};
|
|
|
|
|
|
+// Return an array with paths to the CKEditor 5 dependencies.
|
|
|
+function getCKEditor5PackagesPaths() {
|
|
|
+ return compiler.utils.getPackages( config.ROOT_DIR );
|
|
|
+}
|
|
|
+
|
|
|
// Lint tasks. ---------------------------------------------------------------
|
|
|
|
|
|
const ckeditor5Lint = require( '@ckeditor/ckeditor5-dev-lint' )( config );
|
|
|
@@ -62,24 +69,17 @@ gulp.task( 'exec', ckeditor5DevEnv.execOnRepositories );
|
|
|
|
|
|
// Compilation tasks. ---------------------------------------------------------
|
|
|
|
|
|
-const ckeditor5DevCompiler = require( '@ckeditor/ckeditor5-dev-compiler' );
|
|
|
-
|
|
|
-// Return an array with paths to the CKEditor 5 dependencies.
|
|
|
-function getCKEditor5PackagesPaths() {
|
|
|
- return ckeditor5DevCompiler.utils.getPackages( config.ROOT_DIR );
|
|
|
-}
|
|
|
-
|
|
|
gulp.task( 'default', [ 'compile' ] );
|
|
|
|
|
|
gulp.task( 'compile', () => {
|
|
|
- const args = ckeditor5DevCompiler.utils.parseArguments();
|
|
|
+ const args = compiler.utils.parseArguments();
|
|
|
const formats = {};
|
|
|
|
|
|
for ( const item of args.formats ) {
|
|
|
formats[ item ] = config.MODULE_DIR[ item ];
|
|
|
}
|
|
|
|
|
|
- return ckeditor5DevCompiler.compiler.compile( {
|
|
|
+ return compiler.tasks.compile( {
|
|
|
formats,
|
|
|
packages: getCKEditor5PackagesPaths(),
|
|
|
watch: args.watch,
|
|
|
@@ -91,29 +91,29 @@ gulp.task( 'compile', () => {
|
|
|
// Tasks specific for preparing compiled output with unmodified source files. Used by `gulp docs` or `gulp build`.
|
|
|
// Todo: These tasks should be moved direct to Docs and Bundler.
|
|
|
gulp.task( 'compile:clean:js:esnext', () => {
|
|
|
- return ckeditor5DevCompiler.compiler.clean.js( [ config.MODULE_DIR.esnext ] );
|
|
|
+ return compiler.tasks.clean.js( [ config.MODULE_DIR.esnext ] );
|
|
|
} );
|
|
|
|
|
|
gulp.task( 'compile:clean:themes:esnext', () => {
|
|
|
- return ckeditor5DevCompiler.compiler.clean.themes( [ config.MODULE_DIR.esnext ] );
|
|
|
+ return compiler.tasks.clean.themes( [ config.MODULE_DIR.esnext ] );
|
|
|
} );
|
|
|
|
|
|
gulp.task( 'compile:sass:esnext', () => {
|
|
|
- return ckeditor5DevCompiler.compiler.process.sass( {
|
|
|
+ return compiler.tasks.process.sass( {
|
|
|
formats: { esnext: config.MODULE_DIR.esnext },
|
|
|
packages: getCKEditor5PackagesPaths()
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
gulp.task( 'compile:icons:esnext', () => {
|
|
|
- return ckeditor5DevCompiler.compiler.process.icons( {
|
|
|
+ return compiler.tasks.process.icons( {
|
|
|
formats: { esnext: config.MODULE_DIR.esnext },
|
|
|
packages: getCKEditor5PackagesPaths()
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
gulp.task( 'compile:js:esnext', [ 'compile:clean:js:esnext' ], () => {
|
|
|
- return ckeditor5DevCompiler.compiler.process.js( {
|
|
|
+ return compiler.tasks.process.js( {
|
|
|
formats: { esnext: config.MODULE_DIR.esnext },
|
|
|
packages: getCKEditor5PackagesPaths()
|
|
|
} );
|
|
|
@@ -169,3 +169,33 @@ gulp.task( 'docs:build', docsBuilder.buildDocs );
|
|
|
gulp.task( 'docs:editors', [ 'compile:js:esnext', 'compile:themes:esnext' ], () => {
|
|
|
return docsBuilder.buildEditorsForSamples( getCKEditor5PackagesPaths(), config.DOCUMENTATION.SAMPLES );
|
|
|
} );
|
|
|
+
|
|
|
+// Tests. ---------------------------------------------------------------------
|
|
|
+
|
|
|
+const tests = require( '@ckeditor/ckeditor5-dev-tests' );
|
|
|
+
|
|
|
+gulp.task( 'test', () => {
|
|
|
+ return tests.tasks.test( getTestOptions() );
|
|
|
+} );
|
|
|
+
|
|
|
+// Requires compiled sources. Task should be used in parallel with `gulp compile --formats=esnext --watch`.
|
|
|
+gulp.task( 'test:server', () => {
|
|
|
+ const options = getTestOptions();
|
|
|
+ options.sourcePath = path.resolve( config.MODULE_DIR.esnext );
|
|
|
+
|
|
|
+ return tests.tasks.runTests( options );
|
|
|
+} );
|
|
|
+
|
|
|
+function getTestOptions() {
|
|
|
+ const options = tests.utils.parseArguments();
|
|
|
+
|
|
|
+ options.packages = getCKEditor5PackagesPaths();
|
|
|
+
|
|
|
+ // If --paths weren't specified, then test all packages.
|
|
|
+ if ( !options.paths ) {
|
|
|
+ options.paths = options.packages
|
|
|
+ .map( ( packagePath ) => tests.utils.getPackageName( path.resolve( packagePath ) ) );
|
|
|
+ }
|
|
|
+
|
|
|
+ return options;
|
|
|
+}
|