Re: Bringing CommonJS and npm to GJS



yeah, that's why I need help/contributors there.

The fs is relatively trivial, streams are more painful but in JSGtk the fs was already working.

I am just starting porting over and improving JSGtk, today you have already console globally available, util in core (and timers) and I'm working on os, needed by process, and streams soon, also needed by process, together with EventEmitter ... I will use as much code from Node as I can though, right now the focus is on the architecture to make core modules easy to develop, test and deploy, which I think it's the case already.

The last thing I've done a part is the utilities repo which has a GJS based query object for the whole env
This file might be useful regardless:
https://github.com/cgjs/utilities/blob/master/about

If you'd like to help moving forward just let me know and I'll add you as contributor.

There's also some basic guidelines on how to:
https://github.com/cgjs/cgjs/blob/master/CONTRIBUTING.md

Regards


On Fri, Nov 3, 2017 at 6:44 PM, Giovanni Campagna <scampa giovanni gmail com> wrote:
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



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