我是凉亭的忠实粉丝。我不需要在我的存储库中放一堆包,我每次都提交bower.json,就完成了。
所以我的问题确实是,我可以像Bower一样使npm从json文件读取吗?
npm具有package.json。该文件包含依赖项和devDependencies部分。您可以使用类似于bower.json的文件。
npm install
将必要的依赖项安装到项目的node_modules目录。请参阅下面的示例package.json。
{
"name": "SampleMobileApp",
"version": "0.0.1",
"description": "Sample App",
"dependencies": {
"grunt": "~0.4.2",
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-jshint": "~0.8.0",
"grunt-open": "~0.2.3",
"grunt-contrib-copy": "~0.5.0",
"grunt-bowercopy": "~0.7.1",
"grunt-contrib-watch": "~0.5.3",
"grunt-phonegap": "~0.12.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"grunt",
"javascript"
],
"author": "Atilla Ozgur",
"license": "MIT",
}
依赖关系是用户需要下载的运行时依赖关系,而devDependencies是开发人员依赖关系,例如测试运行时,grunt帮助程序包等。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句