main-bower-files
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -38,4 +38,5 @@ var fs = require('fs'), | ||
bowerDirectory = opts.paths.bowerDirectory ? path.resolve(process.cwd(), opts.paths.bowerDirectory) | ||
: path.resolve(cwd, bowerDirectory || 'bower_components'); | ||
bowerDirectory = opts.paths.bowerDirectory ? | ||
path.resolve(process.cwd(), opts.paths.bowerDirectory) : | ||
path.resolve(cwd, bowerDirectory || 'bower_components'); | ||
@@ -42,0 +43,0 @@ if (!bowerJson || !fs.existsSync(bowerJson)) { |
@@ -65,15 +65,21 @@ var path = require('path'), | ||
var name, | ||
includeDev = this.opts.includeDev || false, | ||
bowerJson = JSON.parse(fs.readFileSync(this.opts.paths.bowerJson, 'utf8')), | ||
devDependencies = bowerJson.devDependencies || {}, | ||
dependencies = bowerJson.dependencies || {}; | ||
includeDev = includeDev === true ? 'inclusive' : includeDev; | ||
this.overrides = bowerJson.overrides || {}; | ||
if (this.opts.includeDev === true && bowerJson.devDependencies) { | ||
for (name in bowerJson.devDependencies) { | ||
dependencies[name] = bowerJson.devDependencies[name]; | ||
if (includeDev !== 'exclusive') { | ||
for (name in dependencies) { | ||
this.add(name, path.join(this.opts.paths.bowerDirectory, '/', name)); | ||
} | ||
} | ||
for (name in dependencies) { | ||
this.add(name, path.join(this.opts.paths.bowerDirectory, '/', name)); | ||
if (includeDev !== false) { | ||
for (name in devDependencies) { | ||
this.add(name, path.join(this.opts.paths.bowerDirectory, '/', name)); | ||
} | ||
} | ||
@@ -80,0 +86,0 @@ }, |
{ | ||
"name": "main-bower-files", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Get main files from your installed bower packages.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -185,4 +185,6 @@ main-bower-files | ||
Type: `boolean` Default: `false` | ||
Set this to true if you want to include your dev dependencies. | ||
Type: `mixed` Default: `false` | ||
You can include your devDependencies in two ways: | ||
* Set this option to `inclusive` or true to add the devDependencies to your dependencies | ||
* or use `exclusive` to exclude your dependencies | ||
@@ -189,0 +191,0 @@ ### filter |
@@ -29,3 +29,3 @@ var mainBowerFiles = require('../'), | ||
expectedFiles.should.be.eql(srcFiles); | ||
srcFiles.should.be.eql(expectedFiles); | ||
@@ -132,2 +132,8 @@ if (done) { | ||
it('should get only devDependencies', function(done) { | ||
expect([ | ||
'/fixtures/includeDev/includeDev.js' | ||
]).fromConfig('/_includedev_bower.json', { includeDev: 'exclusive' }).when(done); | ||
}); | ||
it('should get devDependencies and ignore missing dependencies', function(done) { | ||
@@ -134,0 +140,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
31031
631
218