Javascript 社区是否有依赖项检索(如 maven 或 gem)?
Java 有 maven 或 ivy 从各种公共存储库检索依赖的 jar。
Ruby 有更好的依赖检索工具:gem 和bundle。
Javascript 社区有类似的工具吗?我发现了许多工具来管理将依赖项动态加载到浏览器中。我不是在寻找那些工具。
具体来说,我正在寻找一个新开发人员用来检索他们需要的 javascript 文件的工具。开发人员运行此工具并:
- 它查看项目依赖描述文件
- 发现项目需要 jquery-ui-1.8.7、tiny_mce-3.4.3.2 和 PrettyLoader-1.0.1
- 检索 jquery-ui-1.8.7.min。从网络上
- 安装 .js、prettyLoader-1.0.1.js、tiny_mce-3.4.3.2 将 .js 和 .css 安装到本地存储库中
- 实现jquery-ui依赖jquery-1.6.1并下载/安装jquery
- 确定tiny_mce需要jquery插件,并下载并安装它。
毕竟,开发人员拥有所有所需 js/css 文件的本地副本。
如果出现新的tiny_mce或jquery,项目文件就会更新,开发人员只需返回工具即可获得所有新文件。
如果未指定 js 库的版本,则将检索最新的发行版本。
我刚才描述的是 maven/ivy/gem 在 java/ruby 空间中所做的事情。
显然,我可以使用 Maven 来满足我自己的需求,但是 javascript 社区是否已经准备好了一些东西?
更新:
Raynos 提到了npm。 Npm 以node.js 为中心(这没问题)。然而,公共存储库中的已发布库和元数据有限(容易发现缺少版本、作者、项目 url)。
然而,看起来 npm 是今天的解决方案。不幸的是,这对我们来说还不够,但这就是生活。
事实上,我很惊讶 jquery 或 google-closure 没有项目管理工具。 (如果我错了请告诉我!)
更新:现在 meteor 已经与陨石一起访问和更新大气库。太棒了。
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:
- It looks at the project dependency description file
- Discovers that the project needs jquery-ui-1.8.7, tiny_mce-3.4.3.2 and prettyLoader-1.0.1
- Retrieves jquery-ui-1.8.7.min.js, prettyLoader-1.0.1.js, tiny_mce-3.4.3.2 from the web
- Installs the .js and the .css into a local repository
- Realizes that jquery-ui relies on jquery-1.6.1 and downloads/installs jquery
- 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
看起来 Twitter 提供了一个答案:
cf. https://github.com/twitter/bower#readme
Bower(使用 Node 和 npm)是一个包管理器,用于网络。 Bower 可让您轻松安装图像、CSS 和 JavaScript 等资产,并为您管理依赖项。
Bower 是一个通用工具,可以解决依赖关系并将包锁定到某个版本。它在 Git 上运行,并且与包无关。包可能包含 JavaScript、CSS、图像等,并且不依赖于任何特定的传输(AMD、CommonJS 等)。
然后 Bower 提供了一个简单的编程 API,它公开了包依赖模型,以便现有的构建工具(如 Sprockets、LoadBuilder、curls.js、Ender 等)可以使用它并相应地构建文件。
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.
这取决于您的服务器端堆栈。服务器端堆栈的大多数依赖项/包管理器也处理基于 javascript 的依赖项。
npm
是 Node.js 依赖管理器。它很受欢迎。它基于 CommonJS package.json 格式。
有一些动作可以将其移植到客户端,例如:
您实际上无法单独使用 JavaScript 来做到这一点,因为它里面没有IO。甚至 ender 的命令行工具也依赖于安装的 npm。您应该只使用服务器端堆栈附带的任何工具
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
Maven Javascript Tools 项目自动折叠在 Maven Javascript Import 插件中。后一个插件将 Maven 依赖管理的世界带入了 JavaScript。
http://mojo.codehaus.org/javascript-maven-tools/
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.org/javascript-maven-tools/
结合了 npm 和 maven 的新项目是: https ://blogs.mulesoft.com/dev/mule-dev/introducing-the-npm-maven-plugin/
一个非常干净的集成:
A new project that combine npm and maven is : https://blogs.mulesoft.com/dev/mule-dev/introducing-the-npm-maven-plugin/
a very clean integration :