Explorar el Código

Code refactoring and alignments to changes in deps.

Piotrek Koszuliński hace 9 años
padre
commit
65e3d8cf00
Se han modificado 2 ficheros con 22 adiciones y 22 borrados
  1. 20 20
      gulpfile.js
  2. 2 2
      package.json

+ 20 - 20
gulpfile.js

@@ -10,6 +10,7 @@
 const path = require( 'path' );
 const gulp = require( 'gulp' );
 const runSequence = require( 'run-sequence' );
+const compiler = require( '@ckeditor/ckeditor5-dev-compiler' );
 
 const config = {
 	ROOT_DIR: '.',
@@ -39,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 );
@@ -63,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,
@@ -92,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()
 	} );
@@ -174,15 +173,16 @@ gulp.task( 'docs:editors', [ 'compile:js:esnext', 'compile:themes:esnext' ], ()
 // Tests. ---------------------------------------------------------------------
 
 gulp.task( 'test', () => {
-	const ckeditor5DevTests = require( '@ckeditor/ckeditor5-dev-tests' );
-	const options = ckeditor5DevTests.utils.parseArguments();
+	const tests = require( '@ckeditor/ckeditor5-dev-tests' );
+	const options = tests.utils.parseArguments();
 
-	options.rootPath = path.resolve( config.MODULE_DIR.esnext );
+	options.packages = getCKEditor5PackagesPaths();
 
+	// If --paths weren't specified, then test all packages.
 	if ( !options.paths ) {
-		options.paths = ckeditor5DevCompiler.utils.getPackages( '.' )
-			.map( ( packagePath ) => ckeditor5DevTests.utils.getPackageName( path.resolve( packagePath ) ) );
+		options.paths = options.packages
+			.map( ( packagePath ) => tests.utils.getPackageName( path.resolve( packagePath ) ) );
 	}
 
-	return ckeditor5DevTests.tests.test( options );
+	return tests.tasks.test( options );
 } );

+ 2 - 2
package.json

@@ -30,12 +30,12 @@
   },
   "devDependencies": {
     "@ckeditor/ckeditor5-dev-bundler-rollup": "^2.0.0",
-    "@ckeditor/ckeditor5-dev-compiler": "^3.0.0",
+    "@ckeditor/ckeditor5-dev-compiler": "ckeditor/ckeditor5-dev-compiler#t/51",
     "@ckeditor/ckeditor5-dev-docs": "^3.0.0",
     "@ckeditor/ckeditor5-dev-env": "^1.0.0",
     "@ckeditor/ckeditor5-dev-lint": "^1.0.1",
     "@ckeditor/ckeditor5-dev-utils": "^1.1.0",
-    "@ckeditor/ckeditor5-dev-tests": "ckeditor/ckeditor5-dev-tests",
+    "@ckeditor/ckeditor5-dev-tests": "ckeditor/ckeditor5-dev-tests#t/4",
     "babel-polyfill": "^6.13.0",
     "benderjs": "^0.4.1",
     "benderjs-chai": "^0.2.0",