Ckeditor5: Build = compile + bundle

Created on 5 Jul 2016  ·  14Comments  ·  Source: ckeditor/ckeditor5

Currently we call the first step building and the second bundling. So the whole process doesn't have a good name. Also, we can't talk about CKEditor releases in a reasonable way. Normally you would use the word "package" or "build" but package is taken but npm packages and build by the building step.

Therefore, to clarify the naming, we're going to have building (and builds) which are a result of compiling and optional bundling. There may be an optimised build (which is bundled and minified) and dev build which is basically what you can find currently in the build/ directory.

One thing that I'd make sure before we make any changes is that we can use the word "compile" in this sense.

the action or process of producing something, especially a list or book, by assembling information collected from other sources.

In programming compiling is understood as transforming source code into byte code. The meaning used about books or other type of media makes sense in our case, but taken the usual meaning of that word in the programming world, I'm afraid that we may cause a confusion. Any thoughts?

Most helpful comment

Since there is dist folder in it, it makes sense to call it build. At the end of the day it contains build.

But ckeditor5-dev-builder and ckeditor5-dev-bundler-rollup looks bad now, especially with this ticket "Bundler should use builder as depencency". I think they should be renamed:

ckeditor5-dev-builder -> ckeditor5-dev-compiler
ckeditor5-dev-bundler-rollup -> ckeditor5-dev-builder-rollup

All 14 comments

I think that the compiling makes sense here. We use Babel for it and Babel is "The compiler for writing next generation JavaScript". The compiling in IT is transforming one code into another what we do here, even if, in some cases, it is only path fixing.

Also, as far I understand it, in some cases we may do bigger changes in the code at this step, for instance to support IE 11. Then we may compile ES6 to ES5.

Anyway, this step to is transforming our human-readable code, into code which can by understand by the machine. This is even compiling in the popular meaning. It does not matter both are JavaScript.

I was thinking about directory structure because I think we should keep the build/ and not introduce any weird compilation/. At the same time we have to fit bundles somewhere. I thought about something like this:

build/
    # what we've got so far – so compilation results:
    amd/
    cjs/
    esnext/

    # the last bundle
    bundle/

    # docs are here too:
    docs/

Or we may keep bundle/ outside, like we do know and simply don't care.

For me keeping everything in one directory is nice. You have only one "messy" directory, where you have code not tracked by git hub. I think that when you compline any project it is common that all semi-finished products and the final build land in one place.

What I unclear for me is the fact that we have a separate directory for each compilation, but only one for all bundles (as far I understand we may have different types of bundles too). I think we should have it same way so:

build/
    compilation/
    bundle/
    docs/

or:

build/
    amd/
    cjs/
    esnext/
    esnext-bundle/
    amd-bundle/
    docs/

or:

build/
    compilation/
        amd/
        cjs/
        esnext/
    bundle/
        esnext/
        amd/
    docs/

I was wondering if people will not get a bit confused on finding all those folders inside “build” and not understanding really which one to use. Maybe we should group them in a clearer way.

For instance amd, cjs and esnext are compilations of "modules". Wouldn't it be better to have them into a modules folder?

@pjasiun, I don't want to use the name compilation for a directory because it looks weird and I've never seen it used in any other project.

For instance amd, cjs and esnext are compilations of "modules". Wouldn't it be better to have them in to `modules" folder?

But would you put it inside build/ or outside? Outside it would be odd because it would be read as "package's modules", not "whole build's modules". That's why we want to keep all inside build/ or some other directory that has similar meaning.

Yes, I would leave it inside build:

build/
    modules/
        amd
        cjs
        esnext
    buldle/ (or bundles/ because it is still unclear for me as well)
    docs/
    README.md

A readme file may be welcome at this point, as an introduction to the contents of build.

LGTM

I also do not like "compilation", I simply did not find anything better.modules is much better.

Another idea – instead of build/bundle/ we could have build/dist/. Sounds better for me.

Still, note that these paths should be configurable. The structure described above is fine for CKEditor main repo, but if I use it as a dependency I may want to have compiled modules in ckeditor5 folder instead of build/modules/esnext.

After merging https://github.com/ckeditor/ckeditor5/pull/287 directory structure looks like this:

build/
    modules/
        amd
        cjs
        esnext
    dist/
    docs/
    README.md

I am wondering if next step should be to rename build task to compile? This will probably lead to renaming ckeditor5-dev-builder to ckeditor5-dev-compiler.

Since there is dist folder in it, it makes sense to call it build. At the end of the day it contains build.

But ckeditor5-dev-builder and ckeditor5-dev-bundler-rollup looks bad now, especially with this ticket "Bundler should use builder as depencency". I think they should be renamed:

ckeditor5-dev-builder -> ckeditor5-dev-compiler
ckeditor5-dev-bundler-rollup -> ckeditor5-dev-builder-rollup

As I know bundler can but don't have to use our building. When I was talking with @Reinmar his idea was to give possibility to on/off (by some configuration) building in bundling in case of someone will have his own build and will want only to use bundler for bundling.

Builder package is renamed to ckeditor5-dev-compiler and Wiki pages are updated. Gulp task gulp build is renamed to gulp compile. There is an issue created inside bundler package https://github.com/ckeditor/ckeditor5-dev-bundler-rollup/issues/18 that will continue discussion about renaming it to builder. I am closing this ticket as most of the job described here is done/described by follow ups.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oleq picture oleq  ·  3Comments

MCMicS picture MCMicS  ·  3Comments

wwalc picture wwalc  ·  3Comments

Reinmar picture Reinmar  ·  3Comments

msamsel picture msamsel  ·  3Comments