From cd72eca4e20c5d0fa2174190c47c6bbffe8d6f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Koszuli=C5=84ski?= Date: Wed, 11 Jul 2018 16:54:17 +0200 Subject: [PATCH] Other: Changed the build structure. TODO. Closes ckeditor/ckeditor5#1038. --- bin/build-ckeditor.sh | 9 ---- bin/create-entry-file.js | 18 -------- build-config.js | 90 ---------------------------------------- package.json | 4 +- src/ckeditor.js | 28 ++++++------- webpack.config.js | 11 +++-- 6 files changed, 22 insertions(+), 138 deletions(-) delete mode 100755 bin/build-ckeditor.sh delete mode 100755 bin/create-entry-file.js delete mode 100644 build-config.js diff --git a/bin/build-ckeditor.sh b/bin/build-ckeditor.sh deleted file mode 100755 index d795a2784f..0000000000 --- a/bin/build-ckeditor.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -echo "Building 'build/ckeditor.js'..." -echo "" - -webpack --mode production - -echo "" -echo "Done." diff --git a/bin/create-entry-file.js b/bin/create-entry-file.js deleted file mode 100755 index 8381ae02ab..0000000000 --- a/bin/create-entry-file.js +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env node - -/** - * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -'use strict'; - -const path = require( 'path' ); -const { bundler } = require( '@ckeditor/ckeditor5-dev-utils' ); -const buildConfig = require( '../build-config' ); - -console.log( 'Creating the entry file...' ); - -bundler.createEntryFile( path.join( 'src', 'ckeditor.js' ), buildConfig ); - -console.log( 'Done.' ); diff --git a/build-config.js b/build-config.js deleted file mode 100644 index 36d2aebecb..0000000000 --- a/build-config.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -'use strict'; - -module.exports = { - // The editor creator to use. - editor: '@ckeditor/ckeditor5-editor-decoupled/src/decouplededitor', - - // The name under which the editor will be exported. - moduleName: 'DecoupledEditor', - - // Plugins to include in the build. - plugins: [ - '@ckeditor/ckeditor5-essentials/src/essentials', - - '@ckeditor/ckeditor5-alignment/src/alignment', - '@ckeditor/ckeditor5-font/src/fontsize', - '@ckeditor/ckeditor5-font/src/fontfamily', - '@ckeditor/ckeditor5-highlight/src/highlight', - '@ckeditor/ckeditor5-adapter-ckfinder/src/uploadadapter', - '@ckeditor/ckeditor5-autoformat/src/autoformat', - '@ckeditor/ckeditor5-basic-styles/src/bold', - '@ckeditor/ckeditor5-basic-styles/src/italic', - '@ckeditor/ckeditor5-basic-styles/src/strikethrough', - '@ckeditor/ckeditor5-basic-styles/src/underline', - '@ckeditor/ckeditor5-block-quote/src/blockquote', - '@ckeditor/ckeditor5-easy-image/src/easyimage', - '@ckeditor/ckeditor5-heading/src/heading', - '@ckeditor/ckeditor5-image/src/image', - '@ckeditor/ckeditor5-image/src/imagecaption', - '@ckeditor/ckeditor5-image/src/imagestyle', - '@ckeditor/ckeditor5-image/src/imagetoolbar', - '@ckeditor/ckeditor5-image/src/imageupload', - '@ckeditor/ckeditor5-link/src/link', - '@ckeditor/ckeditor5-list/src/list', - '@ckeditor/ckeditor5-paragraph/src/paragraph', - '@ckeditor/ckeditor5-table/src/table', - '@ckeditor/ckeditor5-table/src/tabletoolbar' - ], - - // Editor config. - config: { - toolbar: { - items: [ - 'heading', - '|', - 'fontsize', - 'fontfamily', - '|', - 'bold', - 'italic', - 'underline', - 'strikethrough', - 'highlight', - '|', - 'alignment', - '|', - 'numberedList', - 'bulletedList', - '|', - 'link', - 'blockquote', - 'imageUpload', - 'insertTable', - '|', - 'undo', - 'redo' - ] - }, - - image: { - styles: [ - 'full', - 'alignLeft', - 'alignRight' - ], - toolbar: [ 'imageStyle:alignLeft', 'imageStyle:full', 'imageStyle:alignRight', '|', 'imageTextAlternative' ] - }, - - table: { - toolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ] - }, - - // UI language. Language codes follow the https://en.wikipedia.org/wiki/ISO_639-1 format. - language: 'en' - } -}; diff --git a/package.json b/package.json index def4ab2f0e..f81ae9c9cd 100644 --- a/package.json +++ b/package.json @@ -65,9 +65,7 @@ "url": "https://github.com/ckeditor/ckeditor5-build-decoupled-document.git" }, "scripts": { - "build": "npm run create-entry-file && npm run build-ckeditor", - "create-entry-file": "node bin/create-entry-file.js", - "build-ckeditor": "sh bin/build-ckeditor.sh", + "build": "webpack --mode production", "preversion": "npm run build; if [ -n \"$(git status src/ckeditor.js build/ --porcelain)\" ]; then git add -u src/ckeditor.js build/ && git commit -m 'Internal: Build.'; fi" } } diff --git a/src/ckeditor.js b/src/ckeditor.js index 3137f909e4..1f3b636bfb 100644 --- a/src/ckeditor.js +++ b/src/ckeditor.js @@ -9,20 +9,20 @@ import AlignmentPlugin from '@ckeditor/ckeditor5-alignment/src/alignment'; import FontsizePlugin from '@ckeditor/ckeditor5-font/src/fontsize'; import FontfamilyPlugin from '@ckeditor/ckeditor5-font/src/fontfamily'; import HighlightPlugin from '@ckeditor/ckeditor5-highlight/src/highlight'; -import UploadadapterPlugin from '@ckeditor/ckeditor5-adapter-ckfinder/src/uploadadapter'; +import UploadAdapterPlugin from '@ckeditor/ckeditor5-adapter-ckfinder/src/uploadadapter'; import AutoformatPlugin from '@ckeditor/ckeditor5-autoformat/src/autoformat'; import BoldPlugin from '@ckeditor/ckeditor5-basic-styles/src/bold'; import ItalicPlugin from '@ckeditor/ckeditor5-basic-styles/src/italic'; import StrikethroughPlugin from '@ckeditor/ckeditor5-basic-styles/src/strikethrough'; import UnderlinePlugin from '@ckeditor/ckeditor5-basic-styles/src/underline'; -import BlockquotePlugin from '@ckeditor/ckeditor5-block-quote/src/blockquote'; -import EasyimagePlugin from '@ckeditor/ckeditor5-easy-image/src/easyimage'; +import BlockQuotePlugin from '@ckeditor/ckeditor5-block-quote/src/blockquote'; +import EasyImagePlugin from '@ckeditor/ckeditor5-easy-image/src/easyimage'; import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading'; import ImagePlugin from '@ckeditor/ckeditor5-image/src/image'; -import ImagecaptionPlugin from '@ckeditor/ckeditor5-image/src/imagecaption'; -import ImagestylePlugin from '@ckeditor/ckeditor5-image/src/imagestyle'; -import ImagetoolbarPlugin from '@ckeditor/ckeditor5-image/src/imagetoolbar'; -import ImageuploadPlugin from '@ckeditor/ckeditor5-image/src/imageupload'; +import ImageCaptionPlugin from '@ckeditor/ckeditor5-image/src/imagecaption'; +import ImageStylePlugin from '@ckeditor/ckeditor5-image/src/imagestyle'; +import ImageToolbarPlugin from '@ckeditor/ckeditor5-image/src/imagetoolbar'; +import ImageUploadPlugin from '@ckeditor/ckeditor5-image/src/imageupload'; import LinkPlugin from '@ckeditor/ckeditor5-link/src/link'; import ListPlugin from '@ckeditor/ckeditor5-list/src/list'; import ParagraphPlugin from '@ckeditor/ckeditor5-paragraph/src/paragraph'; @@ -37,20 +37,20 @@ DecoupledEditor.builtinPlugins = [ FontsizePlugin, FontfamilyPlugin, HighlightPlugin, - UploadadapterPlugin, + UploadAdapterPlugin, AutoformatPlugin, BoldPlugin, ItalicPlugin, StrikethroughPlugin, UnderlinePlugin, - BlockquotePlugin, - EasyimagePlugin, + BlockQuotePlugin, + EasyImagePlugin, HeadingPlugin, ImagePlugin, - ImagecaptionPlugin, - ImagestylePlugin, - ImagetoolbarPlugin, - ImageuploadPlugin, + ImageCaptionPlugin, + ImageStylePlugin, + ImageToolbarPlugin, + ImageUploadPlugin, LinkPlugin, ListPlugin, ParagraphPlugin, diff --git a/webpack.config.js b/webpack.config.js index 84108480da..10599589ed 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -12,7 +12,6 @@ const webpack = require( 'webpack' ); const { bundler, styles } = require( '@ckeditor/ckeditor5-dev-utils' ); const CKEditorWebpackPlugin = require( '@ckeditor/ckeditor5-dev-webpack-plugin' ); const UglifyJsWebpackPlugin = require( 'uglifyjs-webpack-plugin' ); -const buildConfig = require( './build-config' ); module.exports = { devtool: 'source-map', @@ -21,11 +20,13 @@ module.exports = { entry: path.resolve( __dirname, 'src', 'ckeditor.js' ), output: { + // The name under which the editor will be exported. + library: 'DecoupledEditor', + path: path.resolve( __dirname, 'build' ), filename: 'ckeditor.js', libraryTarget: 'umd', - libraryExport: 'default', - library: buildConfig.moduleName + libraryExport: 'default' }, optimization: { @@ -46,7 +47,9 @@ module.exports = { plugins: [ new CKEditorWebpackPlugin( { - language: buildConfig.config.language, + // UI language. Language codes follow the https://en.wikipedia.org/wiki/ISO_639-1 format. + // When changing the built-in language, remember to also change it in the editor's configuration (src/ckeditor.js). + language: 'en', additionalLanguages: 'all' } ), new webpack.BannerPlugin( {