浏览代码

Initial commit.

Kamil Piechaczek 8 年之前
父节点
当前提交
6992097a78

+ 55 - 0
packages/ckeditor5-build-classic/bin/build.js

@@ -0,0 +1,55 @@
+#!/usr/bin/env node
+
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+'use strict';
+
+const webpack = require( 'webpack' );
+const tasks = require( '@ckeditor/ckeditor5-dev-bundler-rollup' );
+
+const config = require( '../build-config' );
+const getWebpackEs6Config = require( '../dev/webpackEs6Config' );
+const getWebpackConfig = require( '../dev/webpackConfig' );
+
+console.log( 'Creating an entry file...' );
+
+tasks.createEntryFile( '.', {
+	plugins: config.plugins,
+	moduleName: config.moduleName,
+	editor: config.editor,
+	config: config.editorConfig,
+} );
+
+const webpackEs6Config = getWebpackEs6Config( config.destinationPath, config.moduleName );
+const webpackConfig = getWebpackConfig( config.destinationPath, config.moduleName );
+
+Promise.all( [
+		runWebpack( webpackEs6Config, 'ES6' ),
+		runWebpack( webpackConfig, 'ES5' ),
+	] )
+	.then( () => {
+
+	} )
+	.catch( ( err ) => {
+		process.exitCode = -1;
+
+		console.log( err );
+	} );
+
+function runWebpack( webpackConfig, label ) {
+	console.log( `Creating an ${ label } build...` );
+
+	return new Promise( ( resolve, reject ) => {
+		webpack( webpackConfig, ( err ) => {
+			if ( err ) {
+				return reject( err );
+			}
+
+			console.log( `The ${ label } build has been created.` );
+			return resolve();
+		} );
+	} );
+}

+ 18 - 0
packages/ckeditor5-build-classic/build-config.js

@@ -0,0 +1,18 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+'use strict';
+
+module.exports = {
+	destinationPath: './build/',
+	editor: '@ckeditor/ckeditor5-editor-classic/src/classic',
+	plugins: [
+		'@ckeditor/ckeditor5-presets/src/article'
+	],
+	moduleName: 'ClassicEditor',
+	editorConfig: {
+		toolbar: [ 'image', 'headings' ]
+	}
+};

文件差异内容过多而无法显示
+ 740 - 0
packages/ckeditor5-build-classic/build/ckeditor.es6.js


文件差异内容过多而无法显示
+ 1 - 0
packages/ckeditor5-build-classic/build/ckeditor.es6.js.map


文件差异内容过多而无法显示
+ 233 - 0
packages/ckeditor5-build-classic/build/ckeditor.js


文件差异内容过多而无法显示
+ 1 - 0
packages/ckeditor5-build-classic/build/ckeditor.js.map


+ 19 - 0
packages/ckeditor5-build-classic/ckeditor.js

@@ -0,0 +1,19 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+ 
+import ClassicEditorBase from '@ckeditor/ckeditor5-editor-classic/src/classic';
+import ArticlePlugin from '@ckeditor/ckeditor5-presets/src/article';
+
+export default class ClassicEditor extends ClassicEditorBase {}
+
+ClassicEditor.build = {
+	plugins: [ ArticlePlugin ],
+	config: {
+		toolbar: [
+			'image',
+			'headings'
+		]
+	}
+};

+ 31 - 0
packages/ckeditor5-build-classic/dev/webpackConfig.js

@@ -0,0 +1,31 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+'use strict';
+
+const webpack = require( 'webpack' );
+const getWebpackEs6Config = require( './webpackEs6Config' );
+
+module.exports = function getWebpackConfig( destinationPath, moduleName ) {
+	const config = getWebpackEs6Config( destinationPath, moduleName );
+
+	config.output.filename = 'ckeditor.js';
+
+	config.plugins = [
+		new webpack.optimize.UglifyJsPlugin()
+	];
+
+	config.module.rules.push( {
+		test: /\.js$/,
+		loader: 'babel-loader',
+		options: {
+			presets: [
+				'es2015'
+			]
+		}
+	} );
+
+	return config;
+};

+ 52 - 0
packages/ckeditor5-build-classic/dev/webpackEs6Config.js

@@ -0,0 +1,52 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+'use strict';
+
+const path = require( 'path' );
+const webpack = require( 'webpack' );
+const BabiliPlugin = require( 'babili-webpack-plugin' );
+
+module.exports = function getWebpackConfig( destinationPath, moduleName ) {
+	return {
+		devtool: 'cheap-source-map',
+
+		entry: [
+			path.resolve( __dirname, '..', 'ckeditor.js' )
+		],
+
+		output: {
+			path: path.resolve( __dirname, '..', destinationPath ),
+			filename: 'ckeditor.es6.js',
+			libraryTarget: 'umd',
+			library: moduleName
+		},
+
+		plugins: [
+			new BabiliPlugin()
+		],
+
+		module: {
+			rules: [
+				{
+					// test: **/ckeditor5-*/theme/icons/*.svg
+					test: /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/,
+					use: [ 'raw-loader' ]
+				},
+				{
+					// test: **/ckeditor5-*/theme/**/*.scss
+					test: /\.scss$/,
+					use: [ 'style-loader', 'css-loader', 'sass-loader' ]
+				}
+			]
+		},
+
+		resolveLoader: {
+			modules: [
+				'node_modules'
+			]
+		}
+	};
+};

+ 20 - 0
packages/ckeditor5-build-classic/package.json

@@ -0,0 +1,20 @@
+{
+  "name": "@ckeditor/ckeditor5-build-classic",
+  "version": "0.0.1",
+  "main": "./build/ckeditor.es6.js",
+  "dependencies": {},
+  "devDependencies": {
+    "@ckeditor/ckeditor5-dev-bundler-rollup": "^5.0.7",
+    "@ckeditor/ckeditor5-dev-utils": "^2.4.2",
+    "@ckeditor/ckeditor5-presets": "*",
+    "babel-core": "^6.24.0",
+    "babel-loader": "^6.4.0",
+    "babel-preset-env": "^1.2.2",
+    "babel-preset-es2015": "^6.24.0",
+    "babili-webpack-plugin": "0.0.11",
+    "webpack": "^2.2.1"
+  },
+  "scripts": {
+    "build": "node ./bin/build.js"
+  }
+}