As some of you know, and many of you do not, I've been spending the last
few months working on implementing git in javascript.

I started out with a small, but successful [kickstarter] that enabled me to
quit my day job and work full time on JS-Git.  Since then I've worked with
others like Chris Dickinson on the project.  At this time, there is a node
CLI tool in npm called "js-git-node" (I'll probably rename to just "js-git"
or "js-git-cli") that supports full clone.  I also have a chrome app that
shows one way the code can run in a non-node'js environment with minimal
changes.

The goal of the project is to give git to all JavaScript environments as a
set of modular packages.  I will target chrome apps, websites, node client
and servers, and anything else that makes sense.

While working on this project, I've developed many new interfaces for
things like streams and callbacks.  I didn't want to port the node APIs
directly to other platforms and instead took this opportunity to redesign
from scratch what I would have done for node in hindsight.

I'm now at the point where I'm very happy with the resulting API primitives.

The new stream interface is called [min-stream] because is the minimal API
surface for streams (data or objects) with backpressure and protocol
filters.  It's a lot simpler than node streams and can interop with node
streams using the [min-stream-node] library.

The stream interface is designed in such a way that creating a stream is
nothing more than creating a function with a certain behavior and
signature.  Piping a stream source to a stream sink is just a normal
function call.  There is no need for an 82 line [pipe] function to connect
min-streams.

    // The body of a TCP echo server in min-streams is simple
    socket.sink(socket.source);

Another primitive that replaces callback-last-style in node is called
[continuables].  It's much closer to node callbacks than promises (in fact
all it takes to convert a node style function to a continuable is to use
bind to partially apply the non-callback arguments).

To convert setTimeout to continuable format is simply:

    function sleep(ms) {
      return function (callback) {
        setTimeout(callback, ms);
      };
    }

Also of interest is integrating generators into continuables.  The next
v0.11.3 release of node should finally have full support for ES6 generators
(behind a flag for now) and chrome dev channel already has it (also behind
a flag).  By using a tiny 40 line helper library, it's trivial to write
sync style code that consumes native callback or continuable code with no
build step as I've done in the [gen-run] library.

Then using the sleep function above is as simple as:

    function* () {
      console.log("Waiting 1 second");
      yield sleep(1000);
      console.log("Done waiting")
    }

I'm still working on js-git and am starting to make progress much faster
now that I've decided what APIs I want to build from and implemented most
the primitives.  Any of these sub-projects can be used standalone and
probably deserve their own announcement mail, but I'd rather not spam the
list with every project I release.  Follow me on twitter @creationix if you
want that level of traffic.

I do need your help.  In order to finish [js-git] in a timely manner, I
need to continue working on it full-time.  If you find this project
worthwhile and/or need it in your project, please show support by backing
the fundraiser on [bountysource]. (or better, getting your employer to
sponsor)

There are so many awesome project ideas that have git in javascript as a
dependency.  I'm running out of money from the kickstarter (it's been
months) and will have to stop working on js-git and get a new job if I
don't get more funds soon.

This is an experiment to see if a person can live off making 100% open
source software that doesn't cater to any particular business.

All software I've released in the open and is licensed MIT for anyone to
use.  I have open discussion on IRC (#js-git) and twitter and the jsgit
google group every day looking for community feedback on the APIs.

Let me know what you think.

-Tim Caswell

[bountysource]: https://www.bountysource.com/#fundraisers/325-js-git
[js-git]: https://github.com/creationix/js-git
[kickstarter]: http://www.kickstarter.com/projects/creationix/js-git
[js-git-node]: https://github.com/creationix/js-git-node
[min-stream]:
https://github.com/creationix/js-git/blob/master/specs/min-stream.md
[min-stream-node]: https://github.com/creationix/min-stream-node
[continuable]:
https://github.com/creationix/js-git/blob/master/specs/continuable.md
[gen-run]: https://github.com/creationix/gen-run

[pipe]: https://github.com/joyent/node/blob/master/lib/stream.js#L46-L127

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to