-
Notifications
You must be signed in to change notification settings - Fork 1.6k
T/1: Introduce CKEditor 5 builds #3
Conversation
build-config.js
Outdated
|
||
'use strict'; | ||
|
||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a real config, not a sample from the spec.
What I'm missing here are:
|
Also missing: And finally, I'm curious whether the build works as a CJS module. Let's try to verify this somehow. |
Ready to review. |
Manual tests verify this. |
@@ -0,0 +1,175 @@ | |||
<!DOCTYPE html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we talked – please use absolutely minimal HTML for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No images, no styling, just minimal HTML and perhaps max-width: 800px; margin: 0 auto
for the body, so the editor doesn't take the whole width.
ckeditor.js
Outdated
EnterPlugin, | ||
HeadingPlugin, | ||
ImagePlugin, | ||
ImagecaptionPlugin, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ImageCaptionPlugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is generated by script automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right. Then ok.
bin/build.js
Outdated
runWebpack( webpackConfig ).then( () => log.info( 'The "ES6" build has been created.' ) ), | ||
runWebpack( webpackCompactConfig ).then( () => log.info( 'The "Compact" build has been created.' ) ) | ||
] ) | ||
.then( () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't indent these lines. We write such code like this:
x( [
a,
b
] )
.then( () => {
c
} );
bin/build.js
Outdated
const webpackConfig = webpackUtils.getWebpackConfig( webpackParams ); | ||
const webpackCompactConfig = webpackUtils.getWebpackCompactConfig( webpackParams ); | ||
|
||
log.info( `Creating the "ES6" and "Compact" builds...` ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compat, not Compact ;). Remember to also fix file names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides, you're not creating anything here. You're building the editor. So you can just log "Building..." and it is enough.
tests/ckeditor.js
Outdated
return editor.destroy(); | ||
} ); | ||
|
||
it( 'should load all its dependencies', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we shouldn't test this. It's 1:1 with the code so whatever you change there, you change here and you don't know if it works still. Check the behaviour, not the code.
@Reinmar, ready to review. |
bin/build.js
Outdated
const webpackConfig = webpackUtils.getWebpackConfig( webpackParams ); | ||
const webpackCompatConfig = webpackUtils.getWebpackCompatConfig( webpackParams ); | ||
|
||
log.info( `Building the "ES6" and "Compat" editors...` ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I wrote – KISS, just "Building..." will be fine.
bin/build.js
Outdated
log.info( `Building the "ES6" and "Compat" editors...` ); | ||
|
||
Promise.all( [ | ||
runWebpack( webpackConfig ).then( () => log.info( 'The "ES6" editor has been built.' ) ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finished building "build/ckeditor.js".
Finished building "build/ckeditor.compat.js".
sample/index.html
Outdated
.catch( err => { | ||
console.error( err.stack ); | ||
} ); | ||
.then( editor => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a rule? I was pretty sure that if the code before a method is one-line long, then we're starting the next lines with indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we rather write it this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't right. I thought about such a case:
ClassicEditor.create( document.querySelector( '#editor' ), {
plugins: [ EssentialsPreset, Paragraph, Bold, Italic, Heading ],
toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
} )
.then( editor => {
window.editor = editor;
} )
.catch( err => {
console.error( err.stack );
} );
But here we have } )
ending with indent 0, so that's why we continue with such an indentation.
In this case where .then()
follows an expression which finished in one line we should rather indent them, just like @pomek did.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks for clarifying this.
… module resolution configured - we can use the defaults.
I've checked that in order to run this package's tests on Travis we'd need a couple of new files and a lot of configuration linters. So let's live with those tests being mainly run from ckeditor5 (e.g. after commits to Also, I think that builds might actually be tested differently. In the manual tests we are using the builds themselves but in the automated tests we use the source modules. It'd be better if automated tests also used the bundled modules but that would be super slow, so... yeah – we'd need to figure something out. Anyway, this is enough for now. |
Feature: Introduced build which based on
ClassicEditor
. Closes ckeditor/ckeditor5#2134.Requires: ckeditor/ckeditor5-dev#132.