通常,bower.json
文件指定一些依赖项,但这些依赖项通常被表示为允许使用Bower包的一系列版本(例如,>=1.0
,这意味着任何高于1.0版的版本).
I have an automated process which needs to find what version of a bower package is actually installed on this system right now.
How can I find this out programmatically (just the version itself), ideally using standard Unix command line tools / the bower command?
bower info <thepackagename>
和not确实显示了这一点-它显示了有关Bower存储库当前可用内容的信息(例如,即使我显示bower info apackageIdonthaveinstalled
,它仍然会显示包含版本号的有效JSON struct ).
cat bower_components/thepackagename/bower.json | node_modules/json/lib/json.js version
works for some packages (assuming the npm package json
is installed), but not all (e.g. jquery 2.2.0's bower package does not contain a bower.json).