Skip to content

Commit 1b2503e

Browse files
authoredJan 10, 2018
Merge pull request #30 from kuangyeheng/pl
Remove gulp-util in favor of https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
2 parents b4c1fcf + d83c56a commit 1b2503e

File tree

5 files changed

+28
-20
lines changed

5 files changed

+28
-20
lines changed
 

‎.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
tmp/
3-
.DS_Store
3+
.DS_Store
4+
/.idea

‎index.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
var rimraf = require('rimraf');
33
var through2 = require('through2');
4-
var gutil = require('gulp-util');
4+
var utils = require('./utils');
55
var path = require('path');
66

77
module.exports = function (options) {
@@ -15,21 +15,21 @@ module.exports = function (options) {
1515
if (!(relative.substr(0, 2) === '..') && relative !== '' || (options ? (options.force && typeof options.force === 'boolean') : false)) {
1616
rimraf(filepath, function (error) {
1717
if (error) {
18-
this.emit('error', new gutil.PluginError('gulp-clean', 'Unable to delete "' + filepath + '" file (' + error.message + ').'));
18+
this.emit('error', new utils.PluginError('gulp-clean', 'Unable to delete "' + filepath + '" file (' + error.message + ').'));
1919
}
2020
this.push(file);
2121
cb();
2222
}.bind(this));
2323
} else if (relative === '') {
2424
var msgCurrent = 'Cannot delete current working directory. (' + filepath + '). Use option force.';
25-
gutil.log('gulp-clean: ' + msgCurrent);
26-
this.emit('error', new gutil.PluginError('gulp-clean', msgCurrent));
25+
utils.log('gulp-clean: ' + msgCurrent);
26+
this.emit('error', new utils.PluginError('gulp-clean', msgCurrent));
2727
this.push(file);
2828
cb();
2929
} else {
3030
var msgOutside = 'Cannot delete files outside the current working directory. (' + filepath + '). Use option force.';
31-
gutil.log('gulp-clean: ' + msgOutside);
32-
this.emit('error', new gutil.PluginError('gulp-clean', msgOutside));
31+
utils.log('gulp-clean: ' + msgOutside);
32+
this.emit('error', new utils.PluginError('gulp-clean', msgOutside));
3333
this.push(file);
3434
cb();
3535
}

‎package.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gulp-clean",
3-
"version": "0.3.2",
3+
"version": "0.4.0",
44
"description": "A gulp plugin for removing files and folders.",
55
"keywords": [
66
"gulpplugin",
@@ -23,9 +23,11 @@
2323
"test": "mocha test.js"
2424
},
2525
"dependencies": {
26-
"rimraf": "^2.2.8",
27-
"gulp-util": "^2.2.14",
28-
"through2": "^0.4.2"
26+
"fancy-log": "^1.3.2",
27+
"plugin-error": "^0.1.2",
28+
"rimraf": "^2.6.2",
29+
"through2": "^2.0.3",
30+
"vinyl": "^2.1.0"
2931
},
3032
"devDependencies": {
3133
"mocha": "^1.19.0",

‎test.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
'use strict';
33
var fs = require('fs');
44
var path = require('path');
5-
var gutil = require('gulp-util');
6-
var clean = require('./');
5+
var utils = require('./utils');
6+
var clean = require('./index');
77
var expect = require('chai').expect;
88

99
function noop() {}
@@ -45,7 +45,7 @@ describe('gulp-clean plugin', function () {
4545
});
4646
});
4747

48-
stream.write(new gutil.File({
48+
stream.write(new utils.File({
4949
cwd: cwd,
5050
base: cwd + '/tmp/',
5151
path: cwd + '/tmp/test.js',
@@ -67,7 +67,7 @@ describe('gulp-clean plugin', function () {
6767
});
6868
});
6969

70-
stream.write(new gutil.File({
70+
stream.write(new utils.File({
7171
cwd: cwd,
7272
base: cwd + '/tmp/',
7373
path: cwd + '/tmp/test/'
@@ -91,7 +91,7 @@ describe('gulp-clean plugin', function () {
9191
});
9292
});
9393
stream.on('data', noop);
94-
stream.write(new gutil.File({
94+
stream.write(new utils.File({
9595
cwd: cwd,
9696
base: cwd + '/tmp',
9797
path: cwd + '/tmp/tree/'
@@ -118,7 +118,7 @@ describe('gulp-clean plugin', function () {
118118
});
119119

120120
stream.on('data', noop);
121-
stream.write(new gutil.File({
121+
stream.write(new utils.File({
122122
cwd: cwd,
123123
path: cwd
124124
}));
@@ -146,7 +146,7 @@ describe('gulp-clean plugin', function () {
146146

147147
stream.on('data', noop);
148148

149-
stream.write(new gutil.File({
149+
stream.write(new utils.File({
150150
cwd: path.resolve(cwd),
151151
path: path.resolve(cwd + '/../secrets/')
152152
}));
@@ -176,7 +176,7 @@ describe('gulp-clean plugin', function () {
176176
});
177177
});
178178

179-
stream.write(new gutil.File({
179+
stream.write(new utils.File({
180180
cwd: path.resolve(cwd),
181181
path: path.resolve(cwd + '/../gulp-cleanTemp/')
182182
}));
@@ -196,7 +196,7 @@ describe('gulp-clean plugin', function () {
196196
});
197197
});
198198

199-
stream.write(new gutil.File({
199+
stream.write(new utils.File({
200200
cwd: path.resolve(cwd),
201201
path: path.resolve(cwd + '/../gulp-cleanTemp/')
202202
}));

‎utils.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
PluginError: require('plugin-error'),
3+
log: require('fancy-log'),
4+
File: require('vinyl')
5+
};

0 commit comments

Comments
 (0)
Please sign in to comment.