Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 669
Pat Avatar asked Jul 27 '11 18:07

Pat


People also ask

Can Maven be used with Javascript?

JavaScript Maven Plugin is a multi-purpose build manager for Javascript projects. It brings two new packaging types javascript and titanium to build standalone JavaScript libraries and Titanium Appcelerator™ applications. It also integrate in war projects for integration in web applications.

What is a Javascript dependency?

A dependency is some third-party code that your application depends on. Just like a child depends on its parent, your application depends on other people's code. A piece of code becomes a true dependency when your own application cannot function without it.

Is Pip same as Maven?

Pip installs system and project-level Python packages. Maven manages dependencies and the build process for Java projects.

What is Maven equivalent in node JS?

Maven is the most popular build and dependency resolution tool for Java, just like NPM is for JS. But it's not just the same tool for a different language.


2 Answers

it looks like twitter is offering one answer :

cf. https://github.com/twitter/bower#readme

Bower (using Node and npm) is a package manager for the web. Bower lets you easily install assets such as images, CSS and JavaScript, and manages dependencies for you.

Bower is a generic tool which will resolve dependencies and lock packages down to a version. It runs over Git, and is package-agnostic. A package may contain JavaScript, CSS, images, etc., and doesn't rely on any particular transport (AMD, CommonJS, etc.).

Bower then makes available a simple programmatic API which exposes the package dependency model, so that existing build tools (like Sprockets, LoadBuilder, curls.js, Ender, etc.) can consume it and build files accordingly.

like image 198
Francois Avatar answered Sep 28 '22 05:09

Francois


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:

  • EnderJS

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

like image 35
Raynos Avatar answered Sep 28 '22 06:09

Raynos