gulp-custom-filter
Advanced tools
Comparing version 0.2.5 to 0.3.0
@@ -1,2 +0,2 @@ | ||
var coveralls = require('gulp-coveralls'); | ||
var coveralls = require('@kollavarsham/gulp-coveralls'); | ||
var eslint = require('gulp-eslint'); | ||
@@ -7,25 +7,27 @@ var gulp = require('gulp'); | ||
gulp.task('test', ['test:pre', 'eslint'], function() { | ||
return gulp.src('./test/**/*_spec.js') | ||
.pipe(jasmine()) | ||
.pipe(istanbul.writeReports()) | ||
.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })); | ||
}); | ||
gulp.task('test:pre', () => | ||
gulp.src(['./index.js', './lib/**/*.js']) | ||
.pipe(istanbul()) | ||
.pipe(istanbul.hookRequire()) | ||
); | ||
gulp.task('test:pre', function() { | ||
return gulp.src(['./index.js', './lib/**/*.js']) | ||
.pipe(istanbul()) | ||
.pipe(istanbul.hookRequire()); | ||
}); | ||
gulp.task('test', gulp.series('test:pre', () => | ||
gulp.src('./test/**/*_spec.js') | ||
.pipe(jasmine()) | ||
.pipe(istanbul.writeReports()) | ||
.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) | ||
)); | ||
gulp.task('coveralls', function() { | ||
return gulp.src('./coverage/**/lcov.info') | ||
.pipe(coveralls()); | ||
}); | ||
gulp.task('coveralls', () => | ||
gulp.src('./coverage/**/lcov.info') | ||
.pipe(coveralls()) | ||
); | ||
gulp.task('eslint', function() { | ||
return gulp.src(['index.js', './lib']) | ||
.pipe(eslint()) | ||
.pipe(eslint.format()) | ||
.pipe(eslint.failOnError()); | ||
}); | ||
gulp.task('lint', () => | ||
gulp.src(['index.js', './lib']) | ||
.pipe(eslint()) | ||
.pipe(eslint.format()) | ||
.pipe(eslint.failOnError()) | ||
); | ||
exports.default = gulp.parallel('lint', 'test'); |
'use strict'; | ||
var gutil = require('gulp-util'); | ||
var PluginError = require('plugin-error'); | ||
function isFunction(fn, moduleName, targetName) { | ||
if (!fn || typeof fn !== 'function') { | ||
throw new gutil.PluginError('gulp-custom-filter' + (moduleName ? '.' + moduleName : ''), | ||
throw new PluginError('gulp-custom-filter' + (moduleName ? '.' + moduleName : ''), | ||
(targetName || fn) + ' must be a function'); | ||
@@ -14,3 +14,3 @@ } | ||
if (!str || typeof str !== 'string') { | ||
throw new gutil.PluginError('gulp-custom-filter' + (moduleName ? '.' + moduleName : ''), | ||
throw new PluginError('gulp-custom-filter' + (moduleName ? '.' + moduleName : ''), | ||
(targetName || str) + ' must be a string'); | ||
@@ -22,3 +22,3 @@ } | ||
if (!strOrArr || (typeof strOrArr !== 'string' && !Array.isArray(strOrArr))) { | ||
throw new gutil.PluginError('gulp-custom-filter' + (moduleName ? '.' + moduleName : ''), | ||
throw new PluginError('gulp-custom-filter' + (moduleName ? '.' + moduleName : ''), | ||
(targetName || strOrArr) + ' must be a string or an array'); | ||
@@ -25,0 +25,0 @@ } |
@@ -5,5 +5,6 @@ 'use strict'; | ||
var assertIsStringOrArray = require('./assertions').isStringOrArray; | ||
var colors = require('ansi-colors'); | ||
var fs = require('fs'); | ||
var gutil = require('gulp-util'); | ||
var ig = require('ignore'); | ||
var log = require('fancy-log'); | ||
var minimatch = require('minimatch'); | ||
@@ -27,3 +28,3 @@ var path = require('path'); | ||
if (err) { | ||
gutil.log(gutil.colors.red('gulp-custom-filter.ignore: ' + err)); | ||
log(colors.red('gulp-custom-filter.ignore: ' + err)); | ||
error = err; | ||
@@ -30,0 +31,0 @@ } else { |
{ | ||
"name": "gulp-custom-filter", | ||
"version": "0.2.5", | ||
"version": "0.3.0", | ||
"description": "A gulp plugin to filter files by customized filters", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "gulp test", | ||
"test": "gulp", | ||
"coveralls": "gulp coveralls" | ||
@@ -28,16 +28,20 @@ }, | ||
"devDependencies": { | ||
"gulp": "^3.9", | ||
"gulp-coveralls": "^0.1", | ||
"gulp-eslint": "^2.0", | ||
"gulp-istanbul": "^0.10", | ||
"gulp-jasmine": "^2.3", | ||
"mock-fs": "^3.8" | ||
"@kollavarsham/gulp-coveralls": "^0.2.2", | ||
"gulp": "^4.0", | ||
"gulp-eslint": "^5.0", | ||
"gulp-istanbul": "^1.1", | ||
"gulp-jasmine": "^4.0", | ||
"mock-fs": "^4.8", | ||
"tempfile": "^2.0.0", | ||
"vinyl": "^2.2.0" | ||
}, | ||
"dependencies": { | ||
"gulp-util": "^3.0", | ||
"ignore": "^3.0", | ||
"minimatch": "^3.0.2", | ||
"promise": "^7.1", | ||
"through2": "^2.0" | ||
"ansi-colors": "^3.2", | ||
"fancy-log": "^1.3", | ||
"ignore": "^5.0", | ||
"minimatch": "^3.0", | ||
"plugin-error": "^1.0", | ||
"promise": "^8.0", | ||
"through2": "^3.0" | ||
} | ||
} |
@@ -214,2 +214,8 @@ # gulp-custom-filter | ||
* v0.3.0 | ||
* Update library dependency | ||
* Update supporting version of Node.js | ||
* Now we support Node 6 or higher | ||
* v0.2.5 | ||
@@ -216,0 +222,0 @@ |
'use strict'; | ||
var Buffer = require('buffer').Buffer; | ||
var Vinyl = require('vinyl'); | ||
var filter = require('../'); | ||
var gutil = require('gulp-util'); | ||
var path = require('path'); | ||
@@ -10,3 +10,3 @@ | ||
files: [ | ||
new gutil.File({ | ||
new Vinyl({ | ||
base: __dirname, | ||
@@ -16,7 +16,7 @@ path: path.join(__dirname, 'a.js'), | ||
}), | ||
new gutil.File({ | ||
new Vinyl({ | ||
base: __dirname, | ||
path: path.join(__dirname, 'b.js') | ||
}), | ||
new gutil.File({ | ||
new Vinyl({ | ||
base: __dirname, | ||
@@ -26,3 +26,3 @@ path: path.join(__dirname, 'x.less'), | ||
}), | ||
new gutil.File({ | ||
new Vinyl({ | ||
base: __dirname, | ||
@@ -29,0 +29,0 @@ path: path.join(__dirname, 'y.less') |
@@ -6,3 +6,4 @@ 'use strict'; | ||
var fixture = require('./fixture.js'); | ||
var mock = require('mock-fs'); | ||
var fs = require('fs'); | ||
var tempfile = require('tempfile'); | ||
@@ -26,10 +27,15 @@ describe('pattern filters', function() { | ||
describe('ignore()', function() { | ||
beforeEach(function () { | ||
mock({ | ||
'.myignore': '*.js\n!b.js' | ||
}); | ||
var ignoreFile; | ||
beforeEach(function(done) { | ||
ignoreFile = tempfile('.myignore'); | ||
fs.writeFile(ignoreFile, '*.js\n!b.js', done); | ||
}); | ||
afterEach(function(done) { | ||
fs.unlink(ignoreFile, done); | ||
}); | ||
it('should pass files which equals to ignore file, if file is succesfully loaded', function (done) { | ||
check(fixture.files, filters.ignore('.myignore'), function (filenames) { | ||
check(fixture.files, filters.ignore(ignoreFile), function (filenames) { | ||
expect(filenames).toEqual(['b.js', 'x.less', 'y.less']); | ||
@@ -52,7 +58,3 @@ done(); | ||
}); | ||
afterEach(function() { | ||
mock.restore(); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
25601
489
229
7
8
2
+ Addedansi-colors@^3.2
+ Addedfancy-log@^1.3
+ Addedplugin-error@^1.0
+ Addedansi-colors@1.1.03.2.4(transitive)
+ Addedarr-diff@4.0.0(transitive)
+ Addedarr-union@3.1.0(transitive)
+ Addedassign-symbols@1.0.0(transitive)
+ Addedextend-shallow@3.0.2(transitive)
+ Addedignore@5.3.1(transitive)
+ Addedis-extendable@1.0.1(transitive)
+ Addedis-plain-object@2.0.4(transitive)
+ Addedisobject@3.0.1(transitive)
+ Addedplugin-error@1.0.1(transitive)
+ Addedpromise@8.3.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedthrough2@3.0.2(transitive)
- Removedgulp-util@^3.0
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedarray-differ@1.0.0(transitive)
- Removedarray-uniq@1.0.3(transitive)
- Removedbeeper@1.1.1(transitive)
- Removedchalk@1.1.3(transitive)
- Removedclone@1.0.4(transitive)
- Removedclone-stats@0.0.1(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddateformat@2.2.0(transitive)
- Removedduplexer2@0.0.2(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedglogg@1.0.2(transitive)
- Removedgulp-util@3.0.8(transitive)
- Removedgulplog@1.0.0(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhas-gulplog@0.1.0(transitive)
- Removedignore@3.3.10(transitive)
- Removedisarray@0.0.11.0.0(transitive)
- Removedlodash._basecopy@3.0.1(transitive)
- Removedlodash._basetostring@3.0.1(transitive)
- Removedlodash._basevalues@3.0.0(transitive)
- Removedlodash._getnative@3.9.1(transitive)
- Removedlodash._isiterateecall@3.0.9(transitive)
- Removedlodash._reescape@3.0.0(transitive)
- Removedlodash._reevaluate@3.0.0(transitive)
- Removedlodash._reinterpolate@3.0.0(transitive)
- Removedlodash._root@3.0.1(transitive)
- Removedlodash.escape@3.2.0(transitive)
- Removedlodash.isarguments@3.1.0(transitive)
- Removedlodash.isarray@3.0.4(transitive)
- Removedlodash.keys@3.1.2(transitive)
- Removedlodash.restparam@3.6.1(transitive)
- Removedlodash.template@3.6.2(transitive)
- Removedlodash.templatesettings@3.1.1(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmultipipe@0.1.2(transitive)
- Removedobject-assign@3.0.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedpromise@7.3.1(transitive)
- Removedreadable-stream@1.1.142.3.8(transitive)
- Removedreplace-ext@0.0.1(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsparkles@1.0.1(transitive)
- Removedstring_decoder@0.10.311.1.1(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedthrough2@2.0.5(transitive)
- Removedvinyl@0.5.3(transitive)
- Removedxtend@4.0.2(transitive)
Updatedignore@^5.0
Updatedminimatch@^3.0
Updatedpromise@^8.0
Updatedthrough2@^3.0