Files
bower/lib/commands/install.js
Adam Stankiewicz 3e3b64218d Remove analytics from Bower, fixes #1102
They caused more issues than useful they were.

Instead, we'll focus on fetching statistics from
NPM registry to watch Bower's popularity, and
GitHub stars over time to watch packages' popularity.
2016-01-20 12:30:54 +01:00

46 lines
1.2 KiB
JavaScript

var endpointParser = require('bower-endpoint-parser');
var Project = require('../core/Project');
var defaultConfig = require('../config');
function install(logger, endpoints, options, config) {
var project;
var decEndpoints;
options = options || {};
config = defaultConfig(config);
if (options.save === undefined) {
options.save = config.defaultSave;
}
project = new Project(config, logger);
// Convert endpoints to decomposed endpoints
endpoints = endpoints || [];
decEndpoints = endpoints.map(function (endpoint) {
return endpointParser.decompose(endpoint);
});
return project.install(decEndpoints, options, config);
}
// -------------------
install.readOptions = function (argv) {
var cli = require('../util/cli');
var options = cli.readOptions({
'force-latest': { type: Boolean, shorthand: 'F'},
'production': { type: Boolean, shorthand: 'p' },
'save': { type: Boolean, shorthand: 'S' },
'save-dev': { type: Boolean, shorthand: 'D' },
'save-exact': { type: Boolean, shorthand: 'E' }
}, argv);
var packages = options.argv.remain.slice(1);
delete options.argv;
return [packages, options];
};
module.exports = install;