npm,bower,gulp,Yeoman和grunt有什么用处? [英] What are npm, bower, gulp, Yeoman, and grunt good for?

查看:128
本文介绍了npm,bower,gulp,Yeoman和grunt有什么用处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是后端开发人员,并且被npm,bower,gulp,grunt和Yeoman轻微混淆。每当我问问某人他们的目的是什么时,答案往往归结为依赖经理 - 对他们来说。当然,我们不需要四种不同的工具,都可以做同样的事情吗?



有人可以用几句话解释这些对可能的 - 如果可能的话,每个工具只有一个,使用5岁(具有开发技能)的语言可以理解的语言? 例如:

b
$ b

  • SVN 存储,管理和跟踪源代码的更改



过去我使用过maven,Jenkins,nexus和ant;也许你可以将上述工具与这些工具进行比较?



也可以随意将其他前端工具添加到列表中。



这是我迄今发现的 - 不确定是否正确,但:


  • bower 用于前端开发/ JS库的依赖管理器,使用平面依赖列表

  • npm 用于node.js服务器的依赖管理器,可以解析传递依赖/依赖树

  • grunt 运行任务,与Jenkins非常相似,但是在命令行上是局部的 strong>提供脚手架,即框架项目

  • gulp 与grunt相同,但仅以js写成 node.js 服务器用于js应用程序?

  • git 分布式SCM / VCS,与svn / cvs相对应


我关门了吗? :)

解决方案

你很近!
欢迎使用JavaScript:)



让我给你简短的介绍和大多数开发者花费一些时间的功能。



bower
专注于浏览器中使用的软件包。每个 bower install > 指向一个包含的文件(更多可以下载)。由于webpack的成功,browserify和babel作为一流的依赖管理器已经过时了。


npm
历史上着重于NodeJS代码,但已经推出了浏览器模块的浏览器。不要让任何人欺骗你:NPM是巨大的。 NPM还会将许多文件加载到您的项目中,而全新的npm安装程序始终是酿造新一杯咖啡的好理由。 NPM易于使用,但由于参考版本的松散方式以及模块发布的随意性,在更改环境时可能会破坏应用程序。研究收缩包装 npm install --save -exact



grunt
促进任务自动化。 Gulps年龄更大,有点更加迟钝的兄弟。 2014年,JavaScript社区曾与他一起闲逛。 Grunt在某些地方已经被认为是遗留问题,但仍然有大量的真正强大的自动化功能被发现。对于较大的用例,配置可能是一场噩梦。 尽管如此,还是有一个可怕的模块。



gulp
与grunt相同但速度更快。



npm run-script
您可能根本不需要任务跑步者。 NodeJS脚本非常易于编写,因此大多数使用情况都支持自定义任务自动化工作流程。使用 npm run-script 从package.json文件的上下文运行脚本



webpack
不要错过webpack。特别是如果您对将JavaScript写入一致的模块化代码的多种方式感到迷茫。 Webpack将.js文件打包成模块并做得非常出色。 Webpack具有高度的可扩展性,并提供了一个良好的开发环境: webpack-dev-server < a>
babel 一起使用,以实现最佳的JavaScript体验。



Yeoman
脚手架。对于具有不同背景的团队极具价值,因为它为您的项目架构提供了可控的共同点。甚至还有脚手架脚手架


I'm a backend developer, and slightly confused by npm, bower, gulp, grunt, and Yeoman. Whenever I ask someone what their purpose is, the answer tends to boil down to dependency manager - for all of them. Surely, we don't need four different tools that all do the same?

Can someone please explain what each of these is good for in as few sentences as possible - if possible just one per tool, using language a five year old (with development skills) could understand?

For example:

  • SVN stores, manages, and keeps track of changes to our source code

I have used maven, Jenkins, nexus and ant in the past; maybe you could compare the tools above to these?

Also feel free to add other front-end tools to the list.

Here is what I have found out so far - not sure it's correct, though:

  • bower dependency manager for front-end development/JS libraries, uses a flat dependency list
  • npm dependency manager for node.js server, can resolve transitive dependencies/dependency trees
  • grunt runs tasks, much like Jenkins, but locality on the command line
  • Yeoman provided scaffolding, i.e skeleton projects
  • gulp same as grunt, but written in js only
  • node.js server for js apps?
  • git decentralized SCM/VCS, counterpart to svn/cvs

Am I close? :)

解决方案

You are close! Welcome to JavaScript :)

Let me give you a short description and one feature that most developers spend some time with.

bower Focuses on packages that are used in the browser. Each bower install <packagename> points to exactly one file to be included for (more can be downloaded). Due to the success of webpack, browserify and babel it's mostly obsolete as a first class dependency manager.

npm Historically focuses on NodeJS code but has overthrown bower for browser modules. Don't let anyone fool you: NPM is huge. NPM also loads MANY files into your project and a fresh npm install is always a good reason to brew a new cup of coffee. NPM is easy to use but can break your app when changing environments due to the loose way of referencing versions and the arbitrariness of module publishing. Research Shrink Wrap and npm install --save-exact

grunt Facilitates task automation. Gulps older and somewhat more sluggish brother. The JavaScript community used to hang out with him in 2014 a lot. Grunt is already considered legacy in some places but there is still a great amount of really powerful automation to be found. Configuration can be a nightmare for larger use-cases. There is a grunt module for that though.

gulp Does the same thing as grunt but is faster.

npm run-script You might not need task runners at all. NodeJS scripts are really easy to write so most use-cases allow for customizedtask-automation workflow. Run scripts from the context of your package.json file using npm run-script

webpack Don't miss out on webpack. Especially if you feel lost on the many ways of writing JavaScript into coherent modular code. Webpack packages .js files into modules and does so splendidly. Webpack is highly extensible and offers a good development environment too: webpack-dev-server Use in conjunction with babel for the best possible JavaScript experience to date.

Yeoman Scaffolding. Extremly valuable for teams with different backgrounds as it provides a controllable common ground for your projects architecture. There even is a scaffolding for scaffolds.

这篇关于npm,bower,gulp,Yeoman和grunt有什么用处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆