Question

I am interested in getting started with CommonJS.

With JavaScript frameworks getting faster all the time, and parsing engines and compilers making JavaScript incredibly quick, it is surprising that a project such as CommonJS has not been initiated sooner.

What steps are involved in getting a test project up and running with what has been created so far?

Was it helpful?

Solution

It really depends on what you're actually looking to do. Persevere, for example, is a JSON database that is built on top of Rhino but is capable of working with CommonJS modules and is being built up around JSGI (the web server interface) going forward.

Narwhal is a fairly robust library of JavaScript and is specifically looking to track the CommonJS standard as it evolves. Narwhal runs on top of Rhino by default, but you can also install JavaScriptCore (and possibly v8) as additional "engines". JSC is very fast.

There are various web frameworks available (including Helma NG).

Node.js has been getting a lot of attention as a fast, v8-based, event-driven network services stack for JS. Node recently changed to use CommonJS modules.

SproutCore has a branch ("tiki") that is built on CommonJS modules. I, personally, am using that now for Bespin of which the client side is entirely CommonJS modules. (Ironically, the server side is currently in Python, but we do have plans to migrate to CommonJS on the server as well.)

The thing to remember about CommonJS is that it's an API spec. It's possible for there to be many implementations. Thus far, the only part of the spec that is widely supported are the modules... the rest is still baking, but coming along nicely.

CommonJS is not yet to the level of interop of, say, CPython/Jython/IronPython, but it certainly has that potential going forward.

OTHER TIPS

What steps are involved in getting a test project up and running with what has been created so far?

I found the Narhwal quick start to be the fastest way to get up and running.

Have you tried starting here?

What are you stuck on?

It's gelling. You're early, unless you like living on the edge.

By the way, your wikipedia link has links to the projects that use CommonJS. You had the answer before you got here.

I just started using Node.js at home. It works and seems great. The only issue I've encountered so far is that Windows support seems somewhat distant.

I believe Rhino works with Windows since it's a Javascript interpreter written in Java, but that also means it's slower than the Javascript-C implementations like V8. I don't think Rhino itself implements the CommonJS specification, but you can run something like Narwahl on top of it - as was mentioned by Kevin and Jeff.

I just did a quick job of installing Rhino, Ant (to build Rhino) and trying to get Narwhal running with Windows, but wasn't successful.

I suggest trying Node.js on a Linux box since that was my environment and it worked flawlessly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top