Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on gulp-util #4

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
var gutil = require( 'gulp-util' );
var log = require('fancy-log');
var PluginError = require('plugin-error');
var colors = require('ansi-colors');
var path = require('path');
var os = require('os');
var through = require('through2');
Expand All @@ -24,14 +26,14 @@ module.exports = function (desiredLineEnding) {
regexp = new RegExp("\n");
break;
default:
this.emit('error', new gutil.PluginError('gulp-eol-enforce', 'Invalid line ending type'));
this.emit('error', new PluginError('gulp-eol-enforce', 'Invalid line ending type'));
}

var transform = through.obj(function(file, encoding, callback) {
var filename;

if (file.isStream()) {
this.emit('error', new gutil.PluginError('gulp-eol-enforce', 'gulp-eol-enforce does not support streams'));
this.emit('error', new PluginError('gulp-eol-enforce', 'gulp-eol-enforce does not support streams'));
return callback(null, file);
}

Expand All @@ -58,15 +60,12 @@ module.exports = function (desiredLineEnding) {

transform.on('finish', function() {
if (this.badFiles.length > 0) {
gutil.log(gutil.colors.cyan('Invalid line endings detected in:'));
log(colors.cyan('Invalid line endings detected in:'));
for (var i = 0; i < this.badFiles.length; i++) {
gutil.log(' - ' + gutil.colors.magenta(this.badFiles[i]));
log(' - ' + colors.magenta(this.badFiles[i]));
}

this.emit('error', new gutil.PluginError('gulp-eol-enforce', {
message: 'Invalid line endings detected',
showStack: false
}));
this.emit('error', new PluginError('gulp-eol-enforce', 'Invalid line endings detected', { showStack: false }));
}
});

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
"should": "~7.1.1"
},
"dependencies": {
"through2": "~2.0",
"gulp-util": "~3.0"
"ansi-colors": "^3.0.6",
"fancy-log": "^1.3.2",
"plugin-error": "^1.0.1",
"through2": "~2.0"
}
}