index.js
function gulpBower(opts, cmdArguments) {
    opts = parseOptions(opts);

    log.info('Using cwd: ' + opts.cwd);
    log.info('Using bower dir: ' + opts.directory);

    cmdArguments = createCmdArguments(cmdArguments, opts);
    var bowerCommand = getBowerCommand(cmd);

    var stream = through.obj(function (file, enc, callback) {
        this.push(file);
        callback();
    });

    bowerCommand.apply(bower.commands, cmdArguments)
        .on('log', function (result) {
            log.info(['bower', colors.cyan(result.id), result.message].join(' '));
        })
        .on('prompt', function (prompts, callback) {
            if (enablePrompt === true) {
                inquirer.prompt(prompts, callback);
            } else {
                var error = 'Can\'t resolve suitable dependency version.';
                log.error(error);
                log.error('Set option { interactive: true } to select.');
                throw new PluginError(PLUGIN_NAME, error);
            }
        })
        .on('error', function (error) {
            stream.emit('error', new PluginError(PLUGIN_NAME, error));
            stream.emit('end');
        })
        .on('end', function () {
            writeStreamToFs(opts, stream);
        });

    return stream;
}
function gulpBower(opts, cmdArguments) {
    opts = parseOptions(opts);

    log.info('Using cwd: ' + opts.cwd);
    log.info('Using bower dir: ' + opts.directory);

    cmdArguments = createCmdArguments(cmdArguments, opts);
    var bowerCommand = getBowerCommand(cmd);

    var stream = through.obj(function (file, enc, callback) {
        this.push(file);
        callback();
    });

    bowerCommand.apply(bower.commands, cmdArguments)
        .on('log', function (result) {
            log.info(['bower', colors.cyan(result.id), result.message].join(' '));
        })
        .on('prompt', function (prompts, callback) {
            if (enablePrompt === true) {
                inquirer.prompt(prompts, callback);
            } else {
                var error = 'Can\'t resolve suitable dependency version.';
                log.error(error);
                log.error('Set option { interactive: true } to select.');
                throw new PluginError(PLUGIN_NAME, error);
            }
        })
        .on('error', function (error) {
            stream.emit('error', new PluginError(PLUGIN_NAME, error));
            stream.emit('end');
        })
        .on('end', function () {
            writeStreamToFs(opts, stream);
        });

    return stream;
}
function gulpBower ( opts , cmdArguments ) { opts = parseOptions ( opts ) ; log . info ( 'Using cwd: ' + opts . cwd ) ; log . info ( 'Using bower dir: ' + opts . directory ) ; cmdArguments = createCmdArguments ( cmdArguments , opts ) ; var bowerCommand = getBowerCommand ( cmd ) ; var stream = through . obj ( function ( file , enc , callback ) { this . push ( file ) ; callback ( ) ; } ) ; bowerCommand . apply ( bower . commands , cmdArguments ) . on ( 'log' , function ( result ) { log . info ( [ 'bower' , colors . cyan ( result . id ) , result . message ] . join ( ' ' ) ) ; } ) . on ( 'prompt' , function ( prompts , callback ) { if ( enablePrompt === true ) { inquirer . prompt ( prompts , callback ) ; } else { var error = 'Can\'t resolve suitable dependency version.' ; log . error ( error ) ; log . error ( 'Set option { interactive: true } to select.' ) ; throw new PluginError ( PLUGIN_NAME , error ) ; } } ) . on ( 'error' , function ( error ) { stream . emit ( 'error' , new PluginError ( PLUGIN_NAME , error ) ) ; stream . emit ( 'end' ) ; } ) . on ( 'end' , function ( ) { writeStreamToFs ( opts , stream ) ; } ) ; return stream ; }
Gulp bower plugin

@param {(object | string)} opts options object or directory string, see opts.directory
@param {string} opts.cmd bower command (default: install)
@param {string} opts.cwd current working directory (default: process.cwd())
@param {string} opts.directory bower components directory (default: .bowerrc config or 'bower_components')
@param {boolean} opts.interactive enable prompting from bower (default: false)
@param {number} opts.verbosity set logging level from 0 (no output) to 2 for info (default: 2)
Gulp bower plugin