Browse Source

Merge pull request #379 from ckeditor/t/374

Changes in gulpfile needed by Rollup bundler.
Piotrek Koszuliński 9 years ago
parent
commit
1ea8f697a4
4 changed files with 51 additions and 57 deletions
  1. 37 0
      build-config.js
  2. 0 30
      dev/bundles/build-config-standard.js
  3. 13 26
      gulpfile.js
  4. 1 1
      package.json

+ 37 - 0
build-config.js

@@ -0,0 +1,37 @@
+/**
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* jshint browser: false, node: true, strict: true */
+
+'use strict';
+
+module.exports = {
+	// Specify path where bundled editor will be saved.
+	destinationPath: './build/dist/',
+
+	editor: 'editor-classic/classic',
+	plugins: [
+		'autoformat',
+		'basic-styles/bold',
+		'basic-styles/italic',
+		'clipboard',
+		'enter',
+		'heading',
+		'image',
+		'link',
+		'list',
+		'paragraph',
+		'typing',
+		'undo'
+	],
+
+	rollupOptions: {
+		// Name of CKEditor instance exposed as global variable by a bundle.
+		moduleName: 'ClassicEditor',
+
+		// The format of the generated bundle.
+		format: 'iife',
+	}
+};

+ 0 - 30
dev/bundles/build-config-standard.js

@@ -1,30 +0,0 @@
-'use strict';
-
-module.exports = {
-	// Name of CKEditor instance exposed as global variable by a bundle.
-	moduleName: 'ClassicEditor',
-
-	// Specify path where bundled editor will be saved.
-	path: '.',
-
-	editor: 'editor-classic/classic',
-
-	// List of plugins.
-	plugins: [
-		'autoformat',
-		'basic-styles/bold',
-		'basic-styles/italic',
-		'clipboard',
-		'enter',
-		'heading',
-		'image',
-		'link',
-		'list',
-		'paragraph',
-		'typing',
-		'undo'
-	],
-
-	// The format of the generated bundle.
-	format: 'iife'
-};

+ 13 - 26
gulpfile.js

@@ -126,34 +126,21 @@ gulp.task( 'compile:themes:esnext', ( callback ) => {
 
 // Building tasks. ------------------------------------------------------------
 
-const ckeditor5DevBundler = require( '@ckeditor/ckeditor5-dev-bundler-rollup' )( config );
-
-gulp.task( 'build', callback => {
-	runSequence(
-		'bundle:generate',
-		[
-			'bundle:minify:js',
-			'bundle:minify:css'
-		],
-		() => ckeditor5DevBundler.showSummaryFromConfig( callback )
-	);
+gulp.task( 'build', () => {
+	const bundler = require( '@ckeditor/ckeditor5-dev-bundler-rollup' );
+
+	return bundler.tasks.build( getBuildOptions() );
 } );
 
-// Helpers. ---------------------------
-
-gulp.task( 'bundle:clean', ckeditor5DevBundler.cleanFromConfig );
-gulp.task( 'bundle:minify:js', ckeditor5DevBundler.minify.jsFromConfig );
-gulp.task( 'bundle:minify:css', ckeditor5DevBundler.minify.cssFromConfig );
-
-// Generates the bundle without minifying it.
-gulp.task( 'bundle:generate',
-	[
-		'bundle:clean',
-		'compile:js:esnext',
-		'compile:themes:esnext'
-	],
-	ckeditor5DevBundler.generateFromConfig
-);
+function getBuildOptions() {
+	const minimist = require( 'minimist' );
+	const pathToConfig = minimist( process.argv.slice( 2 ) ).config || './build-config';
+
+	return {
+		packages: getCKEditor5PackagesPaths(),
+		buildConfig: require( path.resolve( '.', pathToConfig ) ),
+	};
+}
 
 // Documentation. -------------------------------------------------------------
 

+ 1 - 1
package.json

@@ -29,7 +29,7 @@
     "ckeditor5-utils": "ckeditor/ckeditor5-utils"
   },
   "devDependencies": {
-    "@ckeditor/ckeditor5-dev-bundler-rollup": "^4.0.0",
+    "@ckeditor/ckeditor5-dev-bundler-rollup": "^5.0.0",
     "@ckeditor/ckeditor5-dev-compiler": "^6.0.0",
     "@ckeditor/ckeditor5-dev-docs": "^4.1.0",
     "@ckeditor/ckeditor5-dev-env": "^1.0.0",