我运行了'yo angular‘,后来意识到它安装了1.0.8,我卸载了angular组件,但是当我重新添加依赖项下的所有1.2.0-rc.2组件angular-mock和angular-scenario而不是devDependencies下时,原始的bower.json文件在'devDependencies’下有angular-mock和angular-scenario。
我很好奇devDependencies是如何使用的,以及我是应该费心手动修复它,还是应该让它保持原样。有没有办法在bower CLI上指定如何将某些东西标记为开发依赖项?
编辑文件后:
{
name: "Angular",
version: "0.0.0",
dependencies: {
json3: "~3.2.4",
jquery: "~1.9.1",
bootstrap-sass: "~2.3.1",
es5-shim: "~2.0.8",
angular-mocks: "1.2.0-rc.2",
angular-sanitize: "1.2.0-rc.2",
angular-resource: "1.2.0-rc.2",
angular-cookies: "1.2.0-rc.2",
angular: "1.2.0-rc.2",
angular-scenario: "1.2.0-rc.2"
},
devDependencies: { }
}编辑前:
{
"name": "Angular",
"version": "0.0.0",
"dependencies": {
"angular": "~1.0.7",
"json3": "~3.2.4",
"jquery": "~1.9.1",
"bootstrap-sass": "~2.3.1",
"es5-shim": "~2.0.8",
"angular-resource": "~1.0.7",
"angular-cookies": "~1.0.7",
"angular-sanitize": "~1.0.7"
},
"devDependencies": {
"angular-mocks": "~1.0.7",
"angular-scenario": "~1.0.7"
}
}发布于 2013-10-13 09:52:39
devDependencies用于与开发相关的脚本,例如单元测试、打包脚本、文档生成等。
dependencies是生产使用所必需的,并且假定开发时也需要。
将devDependencies包含在dependencies中不会有什么坏处;模块只会在安装过程中捆绑更多的文件(字节)-消耗更多(不必要的)资源。从纯粹的观点来看,这些额外的字节可能是有害的,这取决于你的观点。
为了阐明一些问题,看看bower help install,在通过-p或--production安装模块的过程中,可以省略devDependencies下面列出的模块,例如:
bower install angular-latest --production这是为除开发平台以外的任何平台执行安装的推荐方式。
相反,没有办法省略dependencies下面列出的模块。
截至bower@1.2.7 (请参阅bower latest source),bower help收益率:
Usage:
bower <command> [<args>] [<options>]
Commands:
cache Manage bower cache
help Display help information about Bower
home Opens a package homepage into your favorite browser
info Info of a particular package
init Interactively create a bower.json file
install Install a package locally
link Symlink a package folder
list List local packages
lookup Look up a package URL by name
prune Removes local extraneous packages
register Register a package
search Search for a package by name
update Update a local package
uninstall Remove a local package
Options:
-f, --force Makes various commands more forceful
-j, --json Output consumable JSON
-l, --log-level What level of logs to report
-o, --offline Do not hit the network
-q, --quiet Only output important information
-s, --silent Do not output anything, besides errors
-V, --verbose Makes output more verbose
--allow-root Allows running commands as root
See 'bower help <command>' for more information on a specific command.此外,bower help install的收益率(参见latest source):
Usage:
bower install [<options>]
bower install <endpoint> [<endpoint> ..] [<options>]
Options:
-F, --force-latest Force latest version on conflict
-h, --help Show this help message
-p, --production Do not install project devDependencies
-S, --save Save installed packages into the project's bower.json dependencies
-D, --save-dev Save installed packages into the project's bower.json devDependencies
Additionally all global options listed in 'bower help' are available
Description:
Installs the project dependencies or a specific set of endpoints.
Endpoints can have multiple forms:
- <source>
- <source>#<target>
- <name>=<source>#<target>
Where:
- <source> is a package URL, physical location or registry name
- <target> is a valid range, commit, branch, etc.
- <name> is the name it should have locally.https://stackoverflow.com/questions/19339227
复制相似问题