Re: Bringing CommonJS and npm to GJS



On Thu, 2017-11-02 at 22:50 -0300, Andrea Giammarchi wrote:
FYI the whole project has been moved under a CGJS organization:
https://github.com/cgjs/cgjs

If you'd like to contribute please rise your hand and I'll add you.

So far working:
require, console, __filename, __dirname, and all timers in place
next up: process module
Each core module can be developed a part, using the old jsgtk source
code to take some example makes it relatively straight forward to
implement what was there already (hopefully cleaned thanks to modern
JS syntax).

Modules are many but not all of them would be essential to make GJS a
NodeJS developer friendly environment or to share npm modules.

Here the modules TODO list that is worth prioritizing somehow.
https://github.com/cgjs/cgjs#commonjs-modules

I still would like to hear some feedback, thank you!


Not sure what feedback you're looking for here, but I'd say the project
seems really useful, and I hope it succeeds.
Right now writing a desktop app in JS has to either choose node (losing
all the good stuff in the Gtk+ platform) or gjs (loosing all the npm
libraries), which is sad.
With this, most JS only (or browserify-ready) node modules will work.

This said, it looks like you have a long way to go to fill the fill of
core node APIs as cgjs modules.
For some module, it might be worth just copying the node source, once
you have a few base APIs. At least "assert", "events", "stream",
"querystring", "url", "util", maybe even "module", given you have a
working require().
That should give you a lot more support for npm modules out there.

(browserify also has some support for those I believe, and might be a
better source than node, not sure).

The biggest obstacles will be "net", "http" and "fs", which any
nontrivial node module will want to use.

Good luck!

Giovanni

On Thu, Nov 2, 2017 at 1:17 PM, Andrea Giammarchi
<andrea giammarchi gmail com> wrote:
I've been thinking about for a while and finally made up my mind:
JSGtk+ was solving the wrong issue and in a wrong way. The project
is officially death/deprecated now, but not without an alternative
... bear with me ...

npm is the biggest Open Source repository of them all. It's not
about NodeJS code, it actually has more Browser modules than Node,
but it also has Espruino, Nashorn, MS ChackraCore ... you name it.

Having GJS out of npm is the number one issue I have, while having
also a 100% NodeJS compatible API is less relevant.

This is why I've created an alternative to JSGtk+ called CGJS
(CommonJS based GJS), which can be installed via npm install -g
cgjs and can be used already to require, in a CommonJS fashio,
scripts and modules from your project folder.

More details here, and I'd love your contribution / feedback.

Thank You!



_______________________________________________
javascript-list mailing list
javascript-list gnome org
https://mail.gnome.org/mailman/listinfo/javascript-list

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]