Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy for Node.js #87

Closed
fredck opened this issue Nov 5, 2015 · 4 comments
Closed

Deploy for Node.js #87

fredck opened this issue Nov 5, 2015 · 4 comments

Comments

@fredck
Copy link
Contributor

fredck commented Nov 5, 2015

I propose to make distributions targeting Node.js. This is related to #86, which involves the ability to create headless editors. In this way one could benefit from the CKEditor API on the server side as well.

@fredck fredck mentioned this issue Nov 5, 2015
@Reinmar
Copy link
Member

Reinmar commented Jan 28, 2016

There's been progress recently on this, when we worked on the new builder (pending documentation).

We can do now this:

(master 8a717df) p@m /www/ckeditor5/ckeditor5> gulp build --formats=cjs
[14:45:46] Using gulpfile /www/ckeditor5/ckeditor5/gulpfile.js
[14:45:46] Starting 'build:clean'...
[14:45:46] Finished 'build:clean' after 13 ms
[14:45:46] Starting 'build'...
[14:45:46] Processing '/www/ckeditor5/ckeditor5/ckeditor.js'...
[14:45:46] Processing '/www/ckeditor5/ckeditor5/tests/ckeditor.js'...
[14:45:46] Processing '/www/ckeditor5/ckeditor5/tests/load.js'...
[14:45:46] Finished writing '/www/ckeditor5/ckeditor5/dist/cjs/ckeditor.js'
[14:45:46] Processing '/www/ckeditor5/ckeditor5/tests/path.js'...
....
....

(master 8a717df) p@m /www/ckeditor5/ckeditor5> node
> const Collection = require( './dist/cjs/ckeditor5/core/collection' );
/www/ckeditor5/ckeditor5/dist/cjs/ckeditor5/core/utils.js:138
    mix(baseClass, ...mixins) {
                   ^^^
SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:54:16)
    at Module._compile (module.js:375:25)
    at Object.Module._extensions..js (module.js:406:10)
    at Module.load (module.js:345:32)
    at Function.Module._load (module.js:302:12)
    at Module.require (module.js:355:17)
    at require (internal/module.js:13:17)
    at Object.<anonymous> (/www/ckeditor5/ckeditor5/dist/cjs/ckeditor5/core/eventinfo.js:12:14)
    at Module._compile (module.js:399:26)
    at Object.Module._extensions..js (module.js:406:10)

So close... :D But it only requires now that we transpile ES6 features which Node.JS does not support yet, or upgrade Node and we're home. The code loads and works unless it depends on DOM, so we'll need to remove these dependencies to make it fully functional.

@Reinmar
Copy link
Member

Reinmar commented Feb 3, 2016

@szymonkups
Copy link

I am working on a task that will enable running our tests in Node.js environment.
In details, main issues to resolve there:

  • remove Bender.js dependencies and mock same environment ( chai, sinon etc. )
  • ignore tests that currently cannot pass ( for example using browser DOM API )
  • ignore manual tests
  • adjust building tools for generating proper, relative paths between required modules for CommonJS build
  • include babel-plugin-transform-es2015-parameters to support rest parameter when transpiling for Node.js
  • add test utilities for mocking modules in CommonJS style
  • create gulp task to run testing under Node.js

At the moment all above is nearly done, I am currently writing tests for the new functionalities. After that PR will be ready for review.

@Reinmar
Copy link
Member

Reinmar commented May 5, 2017

Status update – we had a deploy for Node working and tested for some time, but since we're not using it it got abandoned. However, the architecture was aligned to this requirement so there's no problem in initializing headless and viewless editors in Node.js and we had confirmation that it works fine.

Of course, to load the code in Node.js you need to first transpile ES6 modules to CSJ modules. I hope that it may soon be resolved by the adoption of ES6 modules by Node.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants