Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function readCachedConfig(cwd, overwrites) {
current = bowerConfig.create(cwd).load(overwrites);
var config = current.toObject();
var configstore = new Configstore('bower-github').all;
object.mixIn(config, configstore);
// If interactive is auto (null), guess its value
if (config.interactive == null) {
config.interactive =
process.bin === 'bower' && tty.isatty(1) && !process.env.CI;
}
// Merge common CLI options into the config
if (process.bin === 'bower') {
var cli = require('./util/cli');
options.packageDir = options.packageDir || findup(packageJsonName);
if (!options.packageDir) {
return missingPackageJson();
}
options.packageDir = path.resolve(
options.packageDir.replace(packageJsonRegex, ''),
);
packageJson = `${options.packageDir}/${packageJsonName}`;
if (!fs.existsSync(packageJson)) {
return missingPackageJson();
}
packageJson = require(packageJson);
if (options.packageManager === 'bower') {
const bowerConfig = require('bower-config')
.create(options.packageDir)
.load();
depsDirName = bowerConfig._config.directory;
}
// Bower uses a different name (with a dot) for package data of dependencies.
const depsJsonName =
options.packageManager === 'npm' ? 'package.json' : '.bower.json';
if (options.packageManager === 'bower') {
// Allow a local bower.
pkgManagerPath = findup('node_modules/bower/bin/bower');
}
const depsDir = `${options.packageDir}/${depsDirName}`;
module.exports = function(startPath, exclude, aut, jxo) {
startPath = path.resolve(startPath);
auto = aut;
jxon = jxo;
var bowerDir = BowerConfig.create(startPath).load().toObject().directory;
var mainPath = path.resolve(startPath, bowerDir);
return getDir(mainPath, exclude)
.then(readModelXmls)
.then(reorder);
};