Files
bower/lib/config.js
Pascal Hartig e84f71cd37 Basic usage tracking with insight
The user is prompted with a question whether he would like to provide usage data
    on the first start, when run in interactive mode. The current implementation
    tracks calls to `install`, `info`, `search` and `uninstall` when run with at
    least one parameter.

    Fixes #260

Closes gh-796.
2013-12-05 22:37:32 +01:00

33 lines
1013 B
JavaScript

var tty = require('tty');
var mout = require('mout');
var config = require('bower-config').read();
var cli = require('./util/cli');
// Delete the json attribute because it is no longer supported
// and conflicts with --json
delete config.json;
// If interactive is auto (null), guess its value
if (config.interactive == null) {
config.interactive = process.bin === 'bower' && tty.isatty(1);
}
// If `analytics` hasn't been explicitly set, we disable
// it when ran programatically.
if (config.analytics == null) {
config.analytics = config.interactive;
}
// Merge common CLI options into the config
mout.object.mixIn(config, cli.readOptions({
force: { type: Boolean, shorthand: 'f' },
offline: { type: Boolean, shorthand: 'o' },
verbose: { type: Boolean, shorthand: 'V' },
quiet: { type: Boolean, shorthand: 'q' },
loglevel: { type: String, shorthand: 'l' },
json: { type: Boolean, shorthand: 'j' },
silent: { type: Boolean, shorthand: 's' }
}));
module.exports = config;