Skip to content

Commit

Permalink
remove gulp-util from deps (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
gucong3000 authored Dec 29, 2017
1 parent 5f0789b commit 3fb4d13
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions lib/get-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const hasCheckstyle = require('./has-checkstyle');
const gitAuthor = require('./git-author');
const termSize = require('term-size');
const gutil = require('gulp-util');
const log = require('fancy-log');
const toTime = require('to-time');
const ci = require('ci-info');
function unixTimestamp (now) {
Expand Down Expand Up @@ -81,7 +81,7 @@ module.exports = function (options) {
if (typeof writable.write === 'function') {
writable = writable.write.bind(writable);
} else if (typeof writable !== 'function') {
writable = gutil.log;
writable = log.warn;
}
options.output = writable;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/gulp-plugin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const through = require('through2');
const gutil = require('gulp-util');
const PluginError = require('plugin-error');
const getErrors = require('./get-errors');
const reporter = require('./reporter');
const ciReporter = require('./ci-reporter');
Expand All @@ -22,7 +22,7 @@ module.exports = function (options) {
done(null, file);
});
}).catch(error => {
done(new gutil.PluginError('gulp-reporter', error), file);
done(new PluginError('gulp-reporter', error), file);
});
}

Expand All @@ -33,7 +33,7 @@ module.exports = function (options) {

ciReporter(files).then(() => {
if (fails.length) {
throw new gutil.PluginError('gulp-reporter', {
throw new PluginError('gulp-reporter', {
message: 'Lint failed for: ' + fails.map(file => (
file.relative.replace(/\\/g, '/')
)).join(', '),
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
"ci-info": "^1.1.2",
"cli-truncate": "^1.1.0",
"emphasize": "^1.5.0",
"fancy-log": "^1.3.2",
"fs-extra": "^5.0.0",
"goo.gl": "^0.1.4",
"got": "^8.0.1",
"gulp-util": "^3.0.8",
"is-windows": "^1.0.1",
"js-yaml": "^3.10.0",
"junit-report-builder": "^1.2.0",
"lodash.get": "^4.4.2",
"os-locale": "^2.1.0",
"plugin-error": "^0.1.2",
"string-width": "^2.1.1",
"term-size": "^1.2.0",
"through2": "^2.0.3",
Expand Down Expand Up @@ -52,7 +53,7 @@
"jsdom": "^11.5.1",
"jshint": "^2.9.5",
"json-stable-stringify": "^1.0.1",
"mocha": "^4.0.1",
"mocha": "^4.1.0",
"nyc": "^11.4.1",
"proxyquire": "^1.8.0",
"sinon": "^4.1.3",
Expand Down
10 changes: 5 additions & 5 deletions test/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const proxyquire = require('proxyquire');
const stripAnsi = require('strip-ansi');
const eslint = require('gulp-eslint');
const through = require('through2');
const gutil = require('gulp-util');
const Vinyl = require('vinyl');
const vfs = require('vinyl-fs');
const path = require('path');

Expand Down Expand Up @@ -404,15 +404,15 @@ describe('API', () => {

describe('browser-reporter', () => {
it('file is null', () => {
const file = new gutil.File({
const file = new Vinyl({
cwd: '/',
path: '/testcase.js',
});
browserReporter(file, []);
});
it('file without error (Buffer)', () => {
const contents = Buffer.from('testcase_contents');
const file = new gutil.File({
const file = new Vinyl({
cwd: '/',
path: '/testcase.js',
contents: contents,
Expand All @@ -422,7 +422,7 @@ describe('API', () => {
});
it('file without error (streams)', done => {
const contents = through();
const file = new gutil.File({
const file = new Vinyl({
cwd: '/',
path: '/testcase.js',
contents: contents,
Expand Down Expand Up @@ -491,7 +491,7 @@ describe('API', () => {

stream.on('error', done);

stream.write(new gutil.File({
stream.write(new Vinyl({
cwd: '/',
path: '/testcase.js',
contents: Buffer.from('heheh'),
Expand Down
1 change: 1 addition & 0 deletions test/eslint.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ describe('ESLint', () => {
configFile: path.resolve('test/fixtures/eslint/standard.json'),
}))
.pipe(reporter({
fail: false,
output: false,
blame: false,
}))
Expand Down
8 changes: 4 additions & 4 deletions test/sandbox.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
'use strict';
const stripAnsi = require('strip-ansi');
const gutil = require('gulp-util');
const log = require('fancy-log');
const sinon = require('sinon');
const sandbox = sinon.sandbox.create();

before(() => {
sandbox.stub(gutil, 'log');
sandbox.stub(log, 'warn');
});

after(() => {
sandbox.restore();
});

function errorHandle (error) {
gutil.log(error);
log(error);
if (!process.exitCode) {
process.exitCode = 1;
}
Expand All @@ -24,7 +24,7 @@ process.on('uncaughtException', errorHandle);

exports.getLog = () => (
stripAnsi(
gutil.log.lastCall.args[0]
log.warn.lastCall.args[0]
.replace(/\u001b]50;\w+=.+?\u0007/, '')
.replace(/([\u2000-\u3000])\ufe0f?\s+/g, '$1\u{fe0f} ')
)
Expand Down

0 comments on commit 3fb4d13

Please sign in to comment.