Bower and devDependencies vs dependencies
我跑'yo angular'然后意识到它安装了1.0.8,我卸载了角度组件,但是当我重新添加所有1.2时,原始的bower.json文件在'devDependencies'下有角度模拟和角度场景。 0-rc.2组件角度模拟和依赖性下的角度场景而不是devDependencies。
我很好奇如何使用devDependencies,如果我应该打扰手动修复它或保持原样。 有没有办法在凉亭CLI上指定如何将某些东西标记为开发依赖?
编辑文件后:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | { 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: { } } |
编辑前:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | { "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" } } |
生产使用需要
如你所知,在
为了解释一下,查看
1 | bower install angular-latest --production |
这是为开发平台以外的任何其他设备执行安装的推荐方法。
相反,没有办法省略
截至[email protected](参见bower最新资料),
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | Usage: bower <command> [] [<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. |
而且,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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. |