最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - Does the Javascript community have a dependency retrieval (like maven or gem)? - Stack Overflow

programmeradmin0浏览0评论

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 munity 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 es 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 munity 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 e along with meteorite to access and update the atmosphere libraries. Much awesomeness.

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 munity 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 es 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 munity 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 e along with meteorite to access and update the atmosphere libraries. Much awesomeness.

Share Improve this question edited Nov 29, 2013 at 10:31 Pat asked Jul 27, 2011 at 18:35 PatPat 5,9115 gold badges36 silver badges52 bronze badges 6
  • NuGet seems to be Visual Studio tool, not for javascript. – Pat Commented Jul 27, 2011 at 19:23
  • Yes, but it does Javascript as well. – SLaks Commented Jul 27, 2011 at 19:39
  • 1 Visual Studio means not useful for developers that do not use visual studio. (i.e. people that have Macs and Linux - myself + another dev, or use Windows but have not purchase Visual Studio -everyone else on the team.) – Pat Commented Jul 27, 2011 at 21:56
  • @Pat Nuget is one of the "tools based on your server-side stack" examples. If your web server is .NET based then you would use NuGet. Also you didn't look hard enough npm has many jquery based libraries in their repository – Raynos Commented Jul 27, 2011 at 23:21
  • 1 @Raynos - re: Nuget: being a xplatform developer, I regard anything that is locked to a specific platform as useless. (I should have said that in the original post). – Pat Commented Jul 27, 2011 at 23:27
 |  Show 1 more ment

4 Answers 4

Reset to default 5

it looks like twitter is offering one answer :

cf. https://github./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.

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 mand line tool relies on npm being installed. You should just use whatever tool es with your server-side stack

The Maven Javascript Tools project automatically folds in the Maven Javascript Import plugin. The latter plugin brings the world of maven dependency management to JavaScript.

http://mojo.codehaus/javascript-maven-tools/

A new project that bine npm and maven is : https://blogs.mulesoft./dev/mule-dev/introducing-the-npm-maven-plugin/

a very clean integration :

<plugin>
    <groupId>org.mule.tools.javascript</groupId>
    <artifactId>npm-maven-plugin</artifactId>
    <version>1.0</version>
    <executions>
         <execution>
             <phase>generate-sources</phase>
             <goals>
                 <goal>fetch-modules</goal>
             </goals>
             <configuration>
                 <packages>
                     <package>colors:0.5.1</package>
                     <package>jshint:0.8.1</package>
                 </packages>
             </configuration>
         </execution>
    </executions>
</plugin>
发布评论

评论列表(0)

  1. 暂无评论