Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

main-bower-files

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

main-bower-files - npm Package Compare versions

Comparing version 1.0.3 to 2.0.0

75

lib/index.js

@@ -8,59 +8,50 @@ var fs = require('fs'),

files,
bowerrcJson,
defaults = {
paths: {
bowerJson: './bower.json',
bowerrc: './.bowerrc',
bowerDirectory: './bower_components'
}
};
config,
bowerrc,
bowerJson,
bowerDirectory,
cwd = process.cwd();
opts = opts || {};
opts.paths = opts.paths || {};
if (!opts.paths) {
opts.paths = {};
if (typeof opts.paths === 'string') {
cwd = path.resolve(cwd, opts.paths);
} else {
bowerrc = opts.paths.bowerrc;
}
if (typeof opts.paths === 'string'){
opts.paths = {
bowerJson : path.join(opts.paths, defaults.paths.bowerJson),
bowerrc : path.join(opts.paths, defaults.paths.bowerrc),
bowerDirectory : path.join(opts.paths, defaults.paths.bowerDirectory)
};
}
bowerrc = path.resolve(cwd, bowerrc || '.bowerrc');
opts.paths.bowerJson = opts.paths.bowerJson || defaults.paths.bowerJson;
opts.paths.bowerrc = opts.paths.bowerrc || defaults.paths.bowerrc;
opts.paths.bowerDirectory = opts.paths.bowerDirectory || defaults.paths.bowerDirectory;
if (fs.existsSync(opts.paths.bowerrc)){
bowerrcJson = JSON.parse(fs.readFileSync(opts.paths.bowerrc));
if (bowerrcJson && bowerrcJson.directory) {
opts.paths.bowerDirectory = path.dirname(opts.paths.bowerrc);
opts.paths.bowerDirectory = path.join(
opts.paths.bowerDirectory,
'/',
bowerrcJson.directory
);
if (fs.existsSync(bowerrc) && (config = JSON.parse(fs.readFileSync(bowerrc)))) {
cwd = path.dirname(bowerrc);
if (config.cwd) {
cwd = path.resolve(cwd, config.cwd);
}
if (config.directory) {
bowerDirectory = config.directory;
}
}
if (!opts.paths.bowerJson || !fs.existsSync(opts.paths.bowerJson)){
throw new Error('bower.json file does not exist at ' + opts.paths.bowerJson);
}
bowerJson = opts.paths.bowerJson ? path.resolve(process.cwd(), opts.paths.bowerJson)
: path.resolve(cwd, bowerJson || 'bower.json');
if (!opts.paths.bowerDirectory || !fs.existsSync(opts.paths.bowerDirectory)){
throw new Error('Bower components directory does not exist at ' +
opts.paths.bowerDirectory);
}
bowerDirectory = opts.paths.bowerDirectory ? path.resolve(process.cwd(), opts.paths.bowerDirectory)
: path.resolve(cwd, bowerDirectory || 'bower_components');
if (!opts.base) {
opts.base = opts.paths.bowerDirectory;
if (!bowerJson || !fs.existsSync(bowerJson)) {
throw new Error('bower.json file does not exist at ' + bowerJson);
}
if (!opts.includeDev) {
opts.includeDev = false;
if (!bowerDirectory || !fs.existsSync(bowerDirectory)) {
throw new Error('Bower components directory does not exist at ' + bowerDirectory);
}
opts.base = opts.base || bowerDirectory;
opts.includeDev = opts.includeDev || false;
opts.paths = {
bowerJson: bowerJson,
bowerDirectory: bowerDirectory
};
try {

@@ -67,0 +58,0 @@ collection = new PackageCollection(opts);

{
"name": "main-bower-files",
"version": "1.0.3",
"version": "2.0.0",
"description": "Get main files from your installed bower packages.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc