javascriptjquerymavenrubygemsgoogle-closure

Does the Javascript community have a dependency retrieval (like maven or gem)?


Java has maven or ivy to retrieve dependent jars from various public repositories.

Ruby has even better dependency retrieval tools: gem and bundle.

Does the Javascript community have any equivalent tool? I have found a number of tools to manage dynamically loading dependencies into the browser. I am NOT looking for those tools.

Specifically, I am looking for a tool that a new developer uses to retrieve the javascript files they need. The developer runs this tool and:

  1. It looks at the project dependency description file
  2. Discovers that the project needs jquery-ui-1.8.7, tiny_mce-3.4.3.2 and prettyLoader-1.0.1
  3. Retrieves jquery-ui-1.8.7.min.js, prettyLoader-1.0.1.js, tiny_mce-3.4.3.2 from the web
  4. Installs the .js and the .css into a local repository
  5. Realizes that jquery-ui relies on jquery-1.6.1 and downloads/installs jquery
  6. Determines that the tiny_mce needs the jquery plugin, and downloads and installs it.

After all this, the developer has a local copy of all the js/css files needed.

If a new tiny_mce or jquery comes out, the project file is updated and the developers just return the tool and they get all the new files.

If no version of a js library is specified then the latest release version is retrieved.


What I have just described is what maven/ivy/gem does in the java/ruby space.

Obviously, I could rig something up for my own needs with maven but does the javascript community have anything already in place?

Update:

npm was mentioned by Raynos. Npm is centered around node.js ( which is o.k. ). However, there are limited published libraries in the public repository and limited metadata ( version, author, project url is missing from easy discovery ).

However, it looks like npm is the solution today. Unfortunately, it will not quite be enough for us, but such is life.

I am actually pretty surprised that jquery or google-closure does not have a project management tool. (Tell me if I am wrong!)

Update: Now meteor has come along with meteorite to access and update the atmosphere libraries. Much awesomeness.


Solution

  • This depends on your server-side stack. Most dependency / package managers for server-side stacks also deal with javascript based dependencies.

    npm is the node.js dependency manager. It's very popular.

    It's based on the CommonJS package.json format.

    There are movements to port this to the client like:

    You can't really do this with JavaScript alone as it has no IO in it. Even ender's command line tool relies on npm being installed. You should just use whatever tool comes with your server-side stack