一、grunt工具分析
apprtc的编译步骤为:
npm install
grunt build
网上查阅资料,发现grunt为一种构建项目的方式,其基本介绍为
http://www.gruntjs.net/getting-started
通过该介绍可以发现,grunt是通过npm安装和管理的,而npm又是node.js的包管理器。
在编译apprtc之前,需要安装的grunt-cli为Grunt命令行。执行的npm install -g grunt-cli为将命令行安装到全局环境中,其中的-g参数代表global全局的意思,这是npm install的参数。
安装完grunt-cli后,grunt命令就被加入到系统路径中了。
二、grunt过程分析
1、npm install
在apprtc目录下面执行npm install时,npm包管理器读取apprtc目录下面的package.json中的内容,并安装必要的包。
如,apprtc目录下的package.json内容如下
{
"name": "apprtc",
"version": "1.0.0",
"description": "Project checking for AppRTC repo",
"license": "BSD-3-Clause",
"main": "Gruntfile.js",
"repository": {
"type": "git",
"url": "https://github.com/webrtc/apprtc.git"
},
"scripts": {
"test": "grunt --verbose"
},
"devDependencies": {
"grunt": "^0.4.0",
"grunt-cli": ">=0.1.9",
"grunt-closurecompiler": ">=0.0.21",
"grunt-contrib-compress": "^0.13.0",
"grunt-contrib-csslint": ">=0.3.1",
"grunt-contrib-jshint": ">=0.10.0",
"grunt-htmlhint": ">=0.9.12",
"grunt-jinja": ">=0.3.0",
"grunt-jscs": ">=0.8.1",
"grunt-jstestdriver-phantomjs": ">=0.0.7",
"grunt-shell": "^1.1.1",
"socket.io-client": "^1.2.0",
"