Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

T/1: Introduce CKEditor 5 builds #3

Merged
merged 30 commits into from
Apr 3, 2017
Merged

T/1: Introduce CKEditor 5 builds #3

merged 30 commits into from
Apr 3, 2017

Conversation

pomek
Copy link
Member

@pomek pomek commented Mar 17, 2017

Feature: Introduced build which based on ClassicEditor. Closes ckeditor/ckeditor5#2134.


Requires: ckeditor/ckeditor5-dev#132.

@pomek pomek requested a review from Reinmar March 17, 2017 12:38
build-config.js Outdated

'use strict';

module.exports = {
Copy link
Member

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.

@Reinmar
Copy link
Member

Reinmar commented Mar 20, 2017

What I'm missing here are:

  • a sample,
  • tests (manual and automatic).

@Reinmar
Copy link
Member

Reinmar commented Mar 20, 2017

Also missing: .gitignore and .npmignore.

And finally, I'm curious whether the build works as a CJS module. Let's try to verify this somehow.

@pomek
Copy link
Member Author

pomek commented Mar 22, 2017

Ready to review.

@pomek
Copy link
Member Author

pomek commented Mar 22, 2017

And finally, I'm curious whether the build works as a CJS module. Let's try to verify this somehow.

Manual tests verify this.

@@ -0,0 +1,175 @@
<!DOCTYPE html>
Copy link
Member

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.

Copy link
Member

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ImageCaptionPlugin

Copy link
Member Author

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.

Copy link
Member

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( () => {
Copy link
Member

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...` );
Copy link
Member

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.

Copy link
Member

@Reinmar Reinmar Mar 24, 2017

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.

return editor.destroy();
} );

it( 'should load all its dependencies', () => {
Copy link
Member

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.

@pomek
Copy link
Member Author

pomek commented Mar 27, 2017

@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...` );
Copy link
Member

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.' ) ),
Copy link
Member

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".

.catch( err => {
console.error( err.stack );
} );
.then( editor => {
Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor

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.

@Reinmar
Copy link
Member

Reinmar commented Apr 3, 2017

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 master-revisions). This will be enough for now.

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.

@Reinmar Reinmar merged commit f88bc52 into master Apr 3, 2017
@Reinmar Reinmar deleted the t/1 branch April 3, 2017 14:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce CKEditor 5 classic build
3 participants