Does the Javascript community have a dependency (e.g. maven or gem)?

Java has maven or ivy for extracting dependent jars from various public repositories.

Ruby has even better dependency search tools: a gem and a bundle.

Is there any equivalent tool in the Javascript community? I found several tools for managing dynamic dependency loading in a browser. I am NOT looking for these tools.

In particular, I'm looking for a tool that a new developer uses to extract the javascript files they need. The developer runs this tool and:

  • It is viewing a project dependency description file.
  • Detects that the project needs jquery-ui-1.8.7, tiny_mce-3.4.3.2 and prettyLoader-1.0.1
  • Extracts jquery-ui-1.8.7.min.js, prettyLoader-1.0.1.js, tiny_mce-3.4.3.2 from the Internet.
  • Installs .js and .css in a local repository
  • Understands that jquery-ui relies on jquery-1.6.1 and downloads / installs jquery
  • Determines that tiny_mce needs a jquery plugin, and downloads and installs it.

After that, the developer has a local copy of all the necessary js / css files.

If a new tiny_mce or jquery appears, the project file is updated and the developers simply return the tool and get all the new files.

If no version of the js library is specified, the latest version is retrieved.


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

Obviously, I could fine-tune something for my own needs using maven, but does the javascript community have something in place?

Update:

npm was mentioned by Raynos. Npm centers around node.js (which is ok). However, the public repository has limited published libraries and limited metadata (version, author, project URL is missing from simple discovery).

However, it seems that npm is the solution today. Unfortunately, for us it will not be quite enough, but this is life.

I am really very surprised that there is no project management tool in jquery or google-catch. (Tell me if I'm wrong!)

Update: now meteor has appeared along with a meteorite to access and update the atmosphere libraries. A lot of awesomeness.

+6
source share
4 answers

It depends on your server side stack. Most server side dependency / package managers also deal with javascript-based dependencies.

npm is a node.js. dependency manager He is very popular.

It is based on the CommonJS package.json format.

There are movements to pass this to the client, for example:

You cannot do this with JavaScript alone, as it has no I / O. Even the ender command line tool depends on the npm installation. You should just use any tool with your server side stack.

+3
source

it seems like twitter offers one answer:

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

Bower (using Node and npm) is a package manager for the web. Bower makes it easy to set objects such as images, CSS and JavaScript, and manages the dependencies for you.

Bower is a general tool that will resolve dependencies and block packages until versioned. He runs through Git and is a package agnostic. A package may contain JavaScript, CSS, images, etc. And it does not depend on any particular transport (AMD, CommonJS, etc.).

Bower then provides a simple programming API that provides a package dependency model so that existing build tools (such as Sprockets, LoadBuilder, curls.js, Ender, etc.) can consume it and create files accordingly.

+5
source

The Maven Javascript Tools project is automatically compiled into the Maven Javascript Import plugin. The latest plugin returns the maven dependency management world to JavaScript.

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

0
source

New project combining npm and maven: https://blogs.mulesoft.com/dev/mule-dev/introduction-the-npm-maven-plugin/

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
source

Source: https://habr.com/ru/post/893708/


All Articles