[nodejs] Seed.js: Universal Package Manager for CommonJS

100 views
Skip to first unread message

Charles Jolley

unread,
Apr 19, 2010, 2:57:39 PM4/19/10
to nod...@googlegroups.com
Hi everyone,

I'm the developer of the SproutCore HTML5 framework (http://www.sproutcore.com). For the last few months we've been working to convert all of SproutCore to use CommonJS - including converting our build tools from Ruby to JavaScript. Unfortunately, what we found the more we dug into this is that even though there are some amazing JavaScript runtimes like node.js, the 'tool-chain' scenario for JavaScript is still quite lacking.

In particular, it is still way too hard for developers to simply create a JavaScript library and share it with others. Certainly nothing like our scripting brethren in the Ruby and Python worlds where you can simply 'gem install foo' to get a new package.

CommonJS modules are obviously a key enabling technology but the problem is that each platform that implements said modules does so in a slightly different way (to first their respective project goals). This makes writing cross-platform (even just node.js -> browser) code really difficult today. A lot like writing HTML/CSS for the browser 10 years ago when every browser claimed to implement the same spec but did so in a widely diverging ways.

I think to solve this, I think we need a project dedicated to building a universal package manager for CommonJS.

This project should provide a CommonJS runtime that works in the browser and on servers and command-line tools like node.js and narwhal. It should also include package management tools - to make it easy to install and share code.

To me this is so important and I couldn't find a project that was going in this direction, so I built one myself. I'm calling it seed.js and you can find it here:

http://seedjs.org

Right now seed.js is built on node.js but it is intended to be made cross platform when we want to port it. The CommonJS runtime (called 'tiki') has been used by SproutCore and the Mozilla Bespin project for the last six months in both the browser and server-side, so it is pretty mature.

Most importantly, to get things started, we've pre-'seeded' the seed server with about a dozen packages so you can immediately get seed and try it out.

--

To me, it is most important that JavaScript have a universal package manager at some point. Until we have it, our platform will never be as easy to use as Ruby or Python. Seed.js as it exists today doesn't have to be that project, but it is at least a starting point and the code is available with MIT license so we can take it in any direction developers want.

Anyway, I thought folks on this list might like to know about this project. If you give it a try, I'd love to get your feedback. Let's make something that works everywhere so the many lines of JS out there will be available with a single command.

Thanks,
-Charles


--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.

Michael Jackson

unread,
Apr 19, 2010, 4:10:38 PM4/19/10
to nod...@googlegroups.com
Perhaps you should also copy the CommonJS list with this as well...

comm...@googlegroups.com

--
Michael Jackson
http://mjijackson.com/
@mjijackson

Dean Landolt

unread,
Apr 19, 2010, 4:15:15 PM4/19/10
to nod...@googlegroups.com, comm...@googlegroups.com
On Mon, Apr 19, 2010 at 4:10 PM, Michael Jackson <mjija...@gmail.com> wrote:
Perhaps you should also copy the CommonJS list with this as well...

comm...@googlegroups.com

There ya go.

Aaron Heckmann

unread,
Apr 19, 2010, 4:34:25 PM4/19/10
to nod...@googlegroups.com, comm...@googlegroups.com
Thanks Charles. I'm definitely going to check this out.
--
Aaron

cloudhead

unread,
Apr 20, 2010, 10:15:38 AM4/20/10
to nodejs
Interesting... so what's it going to be, seed.js or npm?
They seem to use similar formats.

On Apr 19, 4:34 pm, Aaron Heckmann <aaron.heckm...@gmail.com> wrote:
> Thanks Charles. I'm definitely going to check this out.
>
>
>
>
>
> On Mon, Apr 19, 2010 at 4:15 PM, Dean Landolt <d...@deanlandolt.com> wrote:
>
> > On Mon, Apr 19, 2010 at 4:10 PM, Michael Jackson <mjijack...@gmail.com>wrote:
>
> >> Perhaps you should also copy the CommonJS list with this as well...
>
> >> comm...@googlegroups.com
>
> > There ya go.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nodejs" group.
> > To post to this group, send email to nod...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nodejs+un...@googlegroups.com<nodejs%2Bunsu...@googlegroups.com>
> > .

Jorge

unread,
Apr 20, 2010, 11:46:42 AM4/20/10
to nodejs
Sounds good.
Looks awesome.

Thanks Charles.
--
Jorge.

tjholowaychuk

unread,
Apr 20, 2010, 12:11:57 PM4/20/10
to nodejs
npm breaks all the time for me :(

Camilo Aguilar

unread,
Apr 20, 2010, 1:26:04 PM4/20/10
to nod...@googlegroups.com
I liked it seedjs !

Marco Rogers

unread,
Apr 20, 2010, 5:16:08 PM4/20/10
to nodejs
It did for me too. Most of the time it was because the authors
weren't structuring their package/module properly. The problem with
that is that "properly" hasn't really been defined in an unambiguous
way.

On Apr 20, 12:11 pm, tjholowaychuk <tjholoway...@gmail.com> wrote:
> npm breaks all the time for me :(
>

Marco Rogers

unread,
Apr 20, 2010, 5:16:35 PM4/20/10
to nodejs
Just for information purposes, here's the lengthy discussion that
happened recently about nodejs package managers.

http://groups.google.com/group/nodejs/browse_thread/thread/c6236c1fba42b9fb/d84650db61bf1cc3?#d84650db61bf1cc3

One of the bigger issues was that the package spec hasn't really been
fully fleshed out and ratified as a CommonJS spec. I like the look of
seed.js and I hope it spurs on that work. I don't really care if
there are multiple package managers or just one. I think the larger
issue is everyone agreeing on a good format for packages and creating
a repository that serves packages in a consistent and robust way. And
makes the simple case really dead simple.

<pkg_mngr> install <pkg>

And then in your script

var pkg = require('pkg'); // or module or whatever

Having that work for 85% of cases will go a long way to spurring
adoption. The other arguments that are going around about package
management are certainly important, but shouldn't get in the way of
locking down this basic requirement.

With all that being said, I like the look of seed.js. Nice work.

:Marco

On Apr 20, 1:26 pm, Camilo Aguilar <cam...@cloudescape.com> wrote:
> I liked it seedjs !
>
> On Tue, Apr 20, 2010 at 12:11 PM, tjholowaychuk <tjholoway...@gmail.com>wrote:
>
>
>
>
>
> > npm breaks all the time for me :(
>
> > On Apr 20, 7:15 am, cloudhead <s...@cloudhead.net> wrote:
> > > Interesting... so what's it going to be, seed.js or npm?
> > > They seem to use similar formats.
>
> > > On Apr 19, 4:34 pm, Aaron Heckmann <aaron.heckm...@gmail.com> wrote:
>
> > > > Thanks Charles. I'm definitely going to check this out.
>
> > > > On Mon, Apr 19, 2010 at 4:15 PM, Dean Landolt <d...@deanlandolt.com>
> > wrote:
>
> > > > > On Mon, Apr 19, 2010 at 4:10 PM, Michael Jackson <
> > mjijack...@gmail.com>wrote:
>
> > > > >> Perhaps you should also copy the CommonJS list with this as well...
>
> > > > >> comm...@googlegroups.com
>
> > > > > There ya go.
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > Groups
> > > > > "nodejs" group.
> > > > > To post to this group, send email to nod...@googlegroups.com.
> > > > > To unsubscribe from this group, send email to
> > > > > nodejs+un...@googlegroups.com<nodejs%2Bunsu...@googlegroups.com>
> > <nodejs%2Bunsu...@googlegroups.com<nodejs%252Bunsubscribe@googlegroups. com>
>
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/nodejs?hl=en.
>
> > > > --
> > > > Aaron
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups "nodejs" group.
> > > > To post to this group, send email to nod...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > nodejs+un...@googlegroups.com<nodejs%2Bunsu...@googlegroups.com>
> > .
> > > > For more options, visit this group athttp://
> > groups.google.com/group/nodejs?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "nodejs" group.
> > > To post to this group, send email to nod...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > nodejs+un...@googlegroups.com<nodejs%2Bunsu...@googlegroups.com>
> > .
> > > For more options, visit this group athttp://
> > groups.google.com/group/nodejs?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nodejs" group.
> > To post to this group, send email to nod...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nodejs+un...@googlegroups.com<nodejs%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nodejs?hl=en.
>
> --

Marak Squires

unread,
Apr 20, 2010, 5:25:41 PM4/20/10
to nod...@googlegroups.com
I for one welcome our new package manager overlords.

Now we just need to start kicking module owners asses to keep up new versions of node.

-Marak

Kris Zyp

unread,
Apr 21, 2010, 12:31:52 AM4/21/10
to nodejs


On Apr 19, 12:57 pm, Charles Jolley <char...@sproutit.com> wrote:
[snip]
> To me, it is most important that JavaScript have a universal package manager at some point.  Until we have it, our platform will never be as easy to use as Ruby or Python.  Seed.js as it exists today doesn't have to be that project, but it is at least a starting point and the code is available with MIT license so we can take it in any direction developers want.
>
> Anyway, I thought folks on this list might like to know about this project.  If you give it a try, I'd love to get your feedback.

This looks great. But, if feedback is of interest... one thing I don't
particularly like is the use of colon based delimiter for indicating
packages in module ids. Colons are used for indicating protocols in
URIs, and when URIs are used in require() statements (like
require("http://somesite.com/foo"), it seems difficult to guess
whether a package is intended or a protocol. Of course most loaders
will only ever support a pretty limited set of protocols, so it is
certainly possible to disambiguate (most of the time), but it just
seems like unnecessary complexity, and there are plenty of other good
delimiters that could be used (require("package;module") or
require("package>module")).

Thanks,
Kris

Saikat Chakrabarti

unread,
Apr 24, 2010, 5:06:02 PM4/24/10
to nodejs
By the way - I didn't see it get mentioned here, but a JS package
manager I've been using is Tusk. I know the Cappuccino guys didn't
advertise it much, but it's what is used to manage all the packages
used in Objective-J/Cappuccino (and has been for about a year). It
works great. If anyone is interested, you can get it by installing
Narwhal - http://github.com/tlrobinson/narwhal

Camilo Aguilar

unread,
Aug 19, 2010, 4:44:53 PM8/19/10
to nod...@googlegroups.com
hey seedjs.org doesn't works 

Kenny Shen

unread,
Aug 19, 2010, 10:10:32 PM8/19/10
to nod...@googlegroups.com
is it working for anyone now? I'm getting error id: "bad_httpd_conf" when I hit the page.
--

Kenny Shen
Web Developer
M: +65 91521542
W: www.northpole.sg
.....................................................................
"The union of the mathematician with the poet, fervor with measure, passion with correctness, this surely is the ideal."
- William James

Marak Squires

unread,
Aug 19, 2010, 10:14:08 PM8/19/10
to nod...@googlegroups.com
I'd assume everyone is using npm now.

Rasmus Andersson

unread,
Aug 19, 2010, 10:31:01 PM8/19/10
to nod...@googlegroups.com
On Fri, Aug 20, 2010 at 04:10, Kenny Shen <litt...@gmail.com> wrote:
> is it working for anyone now? I'm getting error id: "bad_httpd_conf" when I
> hit the page.

Same here.

--
Rasmus Andersson

Rasmus Andersson

unread,
Aug 19, 2010, 10:51:40 PM8/19/10
to nod...@googlegroups.com
Don't get me wrong here, but this might be just me (Caution: ranting):

When I write javascript for web browsers I design it quite differently
then when I write it for a modern JS environment like Node. For
instance when writing code for the browser you have to deal with a
multitude of JavaScript versions — some can do [1,2,3].map....filter,
some can't. Some breaks here, others break there. I always end up with
"dirty" code. But, when my target is Node or some other modern host
(like recent WebKit) I can have FUN writing pretty code which will
"run in all modern js envs". And as the minimalistic programmer I am,
dependencies equal sadness, so I want my code to be (mostly)
independent.

Writing stuff for the web will always be a game of compatibility
rather than "pretty" code (given there's a freedom of web browsers).

This can almost be compared to writing C (with libc) — which was
intended to be "cross platform programming" — e.g. you write some code
for BSD which _should_ run on Linux, but of course doesn't, so you end
up with 15 files and hundreds of ifdefs.

Point being let's be pragmatic about this. I'm a fan of CommonJS and
personally like idealistic design (although I've learned the hard way
that idealistic systems seldom work. John Gall is probably laughing at
me).

:)

--
Rasmus Andersson

Dean Landolt

unread,
Aug 19, 2010, 10:58:34 PM8/19/10
to nod...@googlegroups.com
On Thu, Aug 19, 2010 at 10:51 PM, Rasmus Andersson <ras...@notion.se> wrote:
Don't get me wrong here, but this might be just me (Caution: ranting):

When I write javascript for web browsers I design it quite differently
then when I write it for a modern JS environment like Node. For
instance when writing code for the browser you have to deal with a
multitude of JavaScript versions — some can do [1,2,3].map....filter,
some can't. Some breaks here, others break there. I always end up with
"dirty" code. But, when my target is Node or some other modern host
(like recent WebKit) I can have FUN writing pretty code which will
"run in all modern js envs". And as the minimalistic programmer I am,
dependencies equal sadness, so I want my code to be (mostly)
independent.

Sure, but you can patch most of the goodness you're referring to into less "modern" platforms -- in fact a good chunk of es5 can be shimmed in. Yes, dependencies can be a PITA but I'd take one es5-compatiblity-shim dependency (and of course a dom-manip lib) and all the nicities that come with it over the whack-a-bug browser experience any day.
Reply all
Reply to author
Forward
0 new messages