-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (28 loc) · 1006 Bytes
/
index.js
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
'use strict';
var util = require('./lib/util'),
Installer = require('./lib/installer');
exports.name = 'install';
exports.usage = '[name] [options]';
exports.desc = 'install component modules';
exports.register = function (commander){
commander
.option('-S, --no-save', 'not save dependencies into json file', Boolean)
.option('-c, --clean', 'clean install cache', Boolean)
.action(function () {
var installer = new Installer(),
args = Array.prototype.slice.call(arguments),
options = args.pop(),
repo = args.shift();
if (options.clean) Installer.clean();
if (repo) {
args = repo.split('@');
if (options.save) args.push(true);
} else {
args = [];
}
args.push(function (err) {
if (err) util.fatal(err);
});
installer.install.apply(installer, args);
});
};