You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

gulp-main-bower-files

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-main-bower-files - npm Package Compare versions

Comparing version

to
1.7.0

11

gulpfile.js

@@ -8,11 +8,10 @@ /**

gulp.task('mocha', function () {
return gulp.src('test/index-tests.js', {read: false})
.pipe(mocha());
gulp.task('mocha', function() {
return gulp.src('test/index-tests.js', { read: false }).pipe(mocha());
});
gulp.task('watch', function () {
gulp.watch('**/*.js', ['mocha']);
gulp.task('watch', function() {
gulp.watch('**/*.js', ['mocha']);
});
gulp.task('default', ['mocha', 'watch']);
gulp.task('default', ['mocha', 'watch']);

@@ -8,4 +8,3 @@ /**

var through = require('through2');
var gutil = require('gulp-util');
var PluginError = gutil.PluginError;
var PluginError = require('plugin-error');
var mainBowerFiles = require('main-bower-files');

@@ -12,0 +11,0 @@ var fs = require('fs');

{
"name": "gulp-main-bower-files",
"version": "1.6.3",
"version": "1.7.0",
"description": "Use main-bower-files in a more gulp like way.",

@@ -9,3 +9,4 @@ "main": "index.js",

"test:watch": "mocha --watch",
"report-coverage": "cat ./coverage/lcov.info | ./node_modules/.bin/codecov"
"report-coverage": "cat ./coverage/lcov.info | ./node_modules/.bin/codecov",
"prettier": "prettier --single-quote --write ./**/*.js"
},

@@ -30,9 +31,9 @@ "repository": {

"dependencies": {
"gulp-util": "3.0.8",
"main-bower-files": "2.13.1",
"through2": "2.0.3"
"plugin-error": "1.0.1",
"through2": "3.0.0"
},
"devDependencies": {
"codecov.io": "0.1.6",
"gulp": "3.9.1",
"gulp": "4.0.0",
"gulp-debug": "4.0.0",

@@ -42,4 +43,5 @@ "gulp-mocha": "6.0.0",

"mocha": "5.2.0",
"prettier": "1.15.3",
"stream-assert": "2.0.3"
}
}

@@ -6,161 +6,188 @@ 'use strict';

var streamAssert = require('stream-assert');
var assert = require("assert");
var assert = require('assert');
describe('gulp-main-bower-files', function () {
it('is a function', function () {
assert.equal(typeof mainBowerFiles, 'function');
describe('gulp-main-bower-files', function() {
it('is a function', function() {
assert.equal(typeof mainBowerFiles, 'function');
});
describe('without a bowerrc file', function() {
describe('without a bower file', function() {
it('does not fail', function(done) {
gulp
.src(__dirname + '/no-bowerrc/not-there.json', { allowEmpty: true })
.pipe(mainBowerFiles())
.pipe(streamAssert.length(0))
.pipe(streamAssert.end(done));
});
});
describe('without a bowerrc file', function () {
describe('without a bower file', function () {
it('does not fail', function (done) {
gulp.src(__dirname + '/no-bowerrc/not-there.json')
.pipe(mainBowerFiles())
.pipe(streamAssert.length(0))
.pipe(streamAssert.end(done));
});
});
describe('with a bower file', function() {
it('can process a single dependency', function(done) {
gulp
.src(__dirname + '/no-bowerrc/bower-simple.json')
.pipe(mainBowerFiles())
.pipe(streamAssert.length(1))
.pipe(streamAssert.end(done));
});
describe('with a bower file', function () {
it('can process multiple dependencies', function(done) {
gulp
.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(mainBowerFiles())
.pipe(streamAssert.length(3))
.pipe(streamAssert.end(done));
});
it('can process a single dependency', function (done) {
gulp.src(__dirname + '/no-bowerrc/bower-simple.json')
.pipe(mainBowerFiles())
.pipe(streamAssert.length(1))
.pipe(streamAssert.end(done));
});
it('can process multiple dependencies via a callback function', function(done) {
gulp
.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(
mainBowerFiles(function(err, files) {
assert.equal(err, null);
assert.equal(files.length, 3);
})
)
.pipe(streamAssert.length(3))
.pipe(streamAssert.end(done));
});
it('can process multiple dependencies', function (done) {
gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(mainBowerFiles())
.pipe(streamAssert.length(3))
.pipe(streamAssert.end(done));
});
it('can process multiple dependencies with includeSelf', function(done) {
gulp
.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(mainBowerFiles({ includeSelf: true }))
.pipe(streamAssert.length(4))
.pipe(streamAssert.end(done));
});
it('can process multiple dependencies via a callback function', function (done) {
gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(mainBowerFiles(function (err, files) {
assert.equal(err, null);
assert.equal(files.length, 3);
}))
.pipe(streamAssert.length(3))
.pipe(streamAssert.end(done));
});
it('can override main files with filter with a callback', function(done) {
gulp
.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(
mainBowerFiles('**/*.*', function(err, files) {
assert.equal(err, null);
assert.equal(files.length, 3);
})
)
.pipe(streamAssert.length(3))
.pipe(streamAssert.end(done));
});
it('can process multiple dependencies with includeSelf', function (done) {
gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(mainBowerFiles({includeSelf: true}))
.pipe(streamAssert.length(4))
.pipe(streamAssert.end(done));
});
it('can override main files with filter', function(done) {
gulp
.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(
mainBowerFiles('**/*.*', {
overrides: {
multi: {
main: ['*.js', '*.css']
}
}
})
)
.pipe(streamAssert.length(4))
.pipe(streamAssert.end(done));
});
it('can override main files with filter with a callback', function (done) {
gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(mainBowerFiles('**/*.*', function (err, files) {
assert.equal(err, null);
assert.equal(files.length, 3);
}))
.pipe(streamAssert.length(3))
.pipe(streamAssert.end(done));
});
it('can load main files with callback function', function(done) {
gulp
.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(
mainBowerFiles(
{
overrides: {
multi: {
main: ['*.js', '*.css']
}
}
},
function(err, files) {
assert.equal(err, null);
assert.equal(files.length, 4);
}
)
)
.pipe(streamAssert.length(4))
.pipe(streamAssert.end(done));
});
it('can override main files with filter', function (done) {
gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(mainBowerFiles('**/*.*', {
overrides: {
multi: {
main: ['*.js', '*.css']
}
}
}))
.pipe(streamAssert.length(4))
.pipe(streamAssert.end(done));
});
it('can override main files without filter', function(done) {
gulp
.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(
mainBowerFiles({
overrides: {
multi: {
main: ['*.js', '*.css']
}
}
})
)
.pipe(streamAssert.length(4))
.pipe(streamAssert.end(done));
});
});
});
it('can load main files with callback function', function (done) {
gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(mainBowerFiles({
overrides: {
multi: {
main: ['*.js', '*.css']
}
}
}, function(err, files){
assert.equal(err, null);
assert.equal(files.length, 4);
}))
.pipe(streamAssert.length(4))
.pipe(streamAssert.end(done));
});
it('can override main files without filter', function (done) {
gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
.pipe(mainBowerFiles({
overrides: {
multi: {
main: ['*.js', '*.css']
}
}
}))
.pipe(streamAssert.length(4))
.pipe(streamAssert.end(done));
});
});
describe('with a bowerrc file', function() {
describe('without a bower file', function() {
it('does not fail', function(done) {
gulp
.src(__dirname + '/with-bowerrc/not-there.json', { allowEmpty: true })
.pipe(mainBowerFiles())
.pipe(streamAssert.length(0))
.pipe(streamAssert.end(done));
});
});
describe('with a bower file', function() {
it('can process a single dependency', function(done) {
gulp
.src(__dirname + '/with-bowerrc/bower-simple.json')
.pipe(mainBowerFiles())
.pipe(streamAssert.length(1))
.pipe(streamAssert.end(done));
});
describe('with a bowerrc file', function () {
describe('without a bower file', function () {
it('does not fail', function (done) {
gulp.src(__dirname + '/with-bowerrc/not-there.json')
.pipe(mainBowerFiles())
.pipe(streamAssert.length(0))
.pipe(streamAssert.end(done));
});
});
it('can process multiple dependencies', function(done) {
gulp
.src(__dirname + '/with-bowerrc/bower-simple-multi.json')
.pipe(mainBowerFiles())
.pipe(streamAssert.length(3))
.pipe(streamAssert.end(done));
});
describe('with a bower file', function () {
it('can override main files with filter', function(done) {
gulp
.src(__dirname + '/with-bowerrc/bower-simple-multi.json')
.pipe(
mainBowerFiles('**/*.*', {
overrides: {
multi: {
main: ['*.js', '*.css']
}
}
})
)
.pipe(streamAssert.length(4))
.pipe(streamAssert.end(done));
});
it('can process a single dependency', function (done) {
gulp.src(__dirname + '/with-bowerrc/bower-simple.json')
.pipe(mainBowerFiles())
.pipe(streamAssert.length(1))
.pipe(streamAssert.end(done));
});
it('can process multiple dependencies', function (done) {
gulp.src(__dirname + '/with-bowerrc/bower-simple-multi.json')
.pipe(mainBowerFiles())
.pipe(streamAssert.length(3))
.pipe(streamAssert.end(done));
});
it('can override main files with filter', function (done) {
gulp.src(__dirname + '/with-bowerrc/bower-simple-multi.json')
.pipe(mainBowerFiles('**/*.*', {
overrides: {
multi: {
main: ['*.js', '*.css']
}
}
}))
.pipe(streamAssert.length(4))
.pipe(streamAssert.end(done));
});
it('can override main files without filter', function (done) {
gulp.src(__dirname + '/with-bowerrc/bower-simple-multi.json')
.pipe(mainBowerFiles({
overrides: {
multi: {
main: ['*.js', '*.css']
}
}
}))
.pipe(streamAssert.length(4))
.pipe(streamAssert.end(done));
});
});
it('can override main files without filter', function(done) {
gulp
.src(__dirname + '/with-bowerrc/bower-simple-multi.json')
.pipe(
mainBowerFiles({
overrides: {
multi: {
main: ['*.js', '*.css']
}
}
})
)
.pipe(streamAssert.length(4))
.pipe(streamAssert.end(done));
});
});
});
});