main-bower-files
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -52,2 +52,3 @@ var fs = require('fs'), | ||
opts.includeDev = opts.includeDev || false; | ||
opts.includeSelf = opts.includeSelf || false; | ||
opts.paths = { | ||
@@ -54,0 +55,0 @@ bowerJson: bowerJson, |
@@ -52,2 +52,6 @@ var path = require('path'), | ||
opts.path = path; | ||
if (path.indexOf(this.opts.paths.bowerDirectory) === -1) { | ||
opts.main = name; | ||
} | ||
opts.path = path; | ||
@@ -67,5 +71,7 @@ this._packages[name] = new Package(opts, this); | ||
includeDev = this.opts.includeDev || false, | ||
includeSelf = this.opts.includeSelf || false, | ||
bowerJson = JSON.parse(fs.readFileSync(this.opts.paths.bowerJson, 'utf8')), | ||
devDependencies = bowerJson.devDependencies || {}, | ||
dependencies = bowerJson.dependencies || {}; | ||
dependencies = bowerJson.dependencies || {}, | ||
main = bowerJson.main || {}; | ||
@@ -87,2 +93,6 @@ includeDev = includeDev === true ? 'inclusive' : includeDev; | ||
} | ||
if (includeSelf !== false) { | ||
this.add(main, path.join(path.dirname(this.opts.paths.bowerJson))); | ||
} | ||
}, | ||
@@ -89,0 +99,0 @@ |
@@ -47,3 +47,3 @@ var path = require('path'), | ||
data = paths.reduce(function(prev, curr) { | ||
if (prev !== null) { | ||
if (prev !== null && typeof prev.main !== 'undefined') { | ||
return prev; | ||
@@ -85,3 +85,3 @@ } | ||
'Package\t\t', | ||
'overriding depedependencies\t', | ||
'overriding dependencies\t', | ||
this.name, | ||
@@ -88,0 +88,0 @@ data.dependencies); |
{ | ||
"name": "main-bower-files", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Get main files from your installed bower packages.", | ||
@@ -26,3 +26,3 @@ "main": "index.js", | ||
"should": "^4.0.4", | ||
"mocha": "^1.20.1" | ||
"mocha": "^2.0.1" | ||
}, | ||
@@ -29,0 +29,0 @@ "dependencies": { |
@@ -20,2 +20,3 @@ main-bower-files | ||
- [includeDev](#includedev) | ||
- [includeDev](#includeself) | ||
- [filter](#filter) | ||
@@ -191,2 +192,7 @@ | ||
#### includeSelf | ||
Type: `boolean` Default: `false` | ||
Set this to true to add the main files to your dependencies | ||
### filter | ||
@@ -193,0 +199,0 @@ Type: `RegExp` or `function` Default: `null` |
@@ -143,2 +143,8 @@ var mainBowerFiles = require('../'), | ||
it('should get main file', function(done) { | ||
expect([ | ||
'main.js' | ||
]).fromConfig('/_includeSelf_bower.json', { includeSelf: true }).when(done); | ||
}); | ||
it('should not load any deeper dependencies', function(done) { | ||
@@ -145,0 +151,0 @@ expect([ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31828
61
649
224