Skip to content

Commit d5a1168

Browse files
committed
fix: update deps, closes #108
1 parent 976d8e4 commit d5a1168

File tree

7 files changed

+124
-161
lines changed

7 files changed

+124
-161
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v2.1.0
2+
3+
- Updated deps to gulp 5 + vinyl 3
4+
15
# v2.0.0
26

37
#### Breaking

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ function gulpRename(obj, options) {
1515
return {
1616
dirname: Path.dirname(path),
1717
basename: Path.basename(path, extname),
18-
extname: extname
18+
extname: extname,
1919
};
2020
}
2121

22-
stream._transform = function(originalFile, unused, callback) {
22+
stream._transform = function (originalFile, unused, callback) {
2323
var file = originalFile.clone({ contents: false });
2424
var parsedPath = parsePath(file.relative);
2525
var path;
@@ -36,7 +36,7 @@ function gulpRename(obj, options) {
3636

3737
path = Path.join(
3838
parsedPath.dirname,
39-
parsedPath.basename + parsedPath.extname
39+
parsedPath.basename + parsedPath.extname,
4040
);
4141
} else if (type === 'object' && obj !== undefined && obj !== null) {
4242
var dirname = 'dirname' in obj ? obj.dirname : parsedPath.dirname,
@@ -49,7 +49,7 @@ function gulpRename(obj, options) {
4949
} else {
5050
callback(
5151
new Error('Unsupported renaming parameter type supplied'),
52-
undefined
52+
undefined,
5353
);
5454
return;
5555
}

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gulp-rename",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"description": "Rename files",
55
"keywords": [
66
"gulpplugin"
@@ -25,13 +25,13 @@
2525
"test": "mocha"
2626
},
2727
"devDependencies": {
28-
"gulp": "^4.0.2",
28+
"gulp": "^5.0.1",
2929
"gulp-sourcemaps": "^2.6.5",
3030
"map-stream": "^0.0.7",
31-
"mocha": "^6.0.0",
32-
"prettier": "^1.19.1",
31+
"mocha": "^11.0.0",
32+
"prettier": "^3.0.0",
3333
"should": "^13.2.3",
34-
"vinyl": "^2.0.0"
34+
"vinyl": "^3.0.0"
3535
},
3636
"engines": {
3737
"node": ">=4"

test/path-parsing.spec.js

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,134 +4,137 @@
44
require('./spec-helper');
55
var Path = require('path');
66

7-
describe('gulp-rename path parsing', function() {
8-
describe('dirname', function() {
9-
context('when src pattern contains no globs', function() {
10-
it("dirname is '.'", function(done) {
7+
describe('gulp-rename path parsing', function () {
8+
describe('dirname', function () {
9+
context('when src pattern contains no globs', function () {
10+
it("dirname is '.'", function (done) {
1111
var srcPattern = 'test/fixtures/hello.txt';
12-
var obj = function(path) {
12+
var obj = function (path) {
1313
path.dirname.should.equal('.');
1414
};
1515
helper(srcPattern, obj, null, done);
1616
});
1717
});
1818

19-
context('when src pattern contains filename glob', function() {
20-
it("dirname is '.'", function(done) {
19+
context('when src pattern contains filename glob', function () {
20+
it("dirname is '.'", function (done) {
2121
var srcPattern = 'test/fixtures/*.min.txt';
22-
var obj = function(path) {
22+
var obj = function (path) {
2323
path.dirname.should.equal('.');
2424
};
2525
helper(srcPattern, obj, null, done);
2626
});
2727
});
2828

29-
var dirnameHelper = function(srcPattern) {
30-
it('dirname is path from directory glob to file', function(done) {
31-
var obj = function(path) {
29+
var dirnameHelper = function (srcPattern) {
30+
it('dirname is path from directory glob to file', function (done) {
31+
var obj = function (path) {
3232
path.dirname.should.match(/^fixtures[0-9]?$/);
3333
};
3434
helper(srcPattern, obj, null, done);
3535
});
3636
};
3737

38-
context('when src pattern matches a directory with *', function() {
38+
context('when src pattern matches a directory with *', function () {
3939
dirnameHelper('test/*/*.min.txt');
4040
});
4141

42-
context('when src pattern matches a directory with **', function() {
42+
context('when src pattern matches a directory with **', function () {
4343
dirnameHelper('test/**/*.min.txt');
4444
});
4545

46-
context('when src pattern matches a directory with [...]', function() {
46+
context('when src pattern matches a directory with [...]', function () {
4747
dirnameHelper('test/fixt[a-z]res/*.min.txt');
4848
});
4949

50-
context('when src pattern matches a directory with {...,...}', function() {
50+
context('when src pattern matches a directory with {...,...}', function () {
5151
dirnameHelper('test/f{ri,ixtur}es/*.min.txt');
5252
});
5353

5454
/* SKIP: glob2base does not handle brace expansion as expected. See wearefractal/glob2base#1 */
5555
context.skip(
5656
'when src pattern matches a directory with {#..#}',
57-
function() {
57+
function () {
5858
dirnameHelper('test/fixtures{0..9}/*.min.txt');
59-
}
59+
},
6060
);
6161

62-
context('when src pattern matches a directory with an extglob', function() {
63-
dirnameHelper('test/f+(ri|ixtur)es/*.min.txt');
64-
});
62+
context(
63+
'when src pattern matches a directory with an extglob',
64+
function () {
65+
dirnameHelper('test/f+(ri|ixtur)es/*.min.txt');
66+
},
67+
);
6568

66-
context('when src pattern includes `base` option', function() {
67-
it('dirname is path from given directory to file', function(done) {
69+
context('when src pattern includes `base` option', function () {
70+
it('dirname is path from given directory to file', function (done) {
6871
var srcPattern = 'test/**/*.min.txt';
6972
var srcOptions = { base: process.cwd() };
70-
var obj = function(path) {
73+
var obj = function (path) {
7174
path.dirname.should.equal(Path.join('test', 'fixtures'));
7275
};
7376
helper({ pattern: srcPattern, options: srcOptions }, obj, null, done);
7477
});
7578
});
7679
});
7780

78-
describe('basename', function() {
79-
it('strips extension like Path.basename(path, ext)', function(done) {
81+
describe('basename', function () {
82+
it('strips extension like Path.basename(path, ext)', function (done) {
8083
var srcPattern = 'test/fixtures/hello.min.txt';
81-
var obj = function(path) {
84+
var obj = function (path) {
8285
path.basename.should.equal('hello.min');
8386
path.basename.should.equal(
84-
Path.basename(srcPattern, Path.extname(srcPattern))
87+
Path.basename(srcPattern, Path.extname(srcPattern)),
8588
);
8689
};
8790
helper(srcPattern, obj, null, done);
8891
});
8992
});
9093

91-
describe('extname', function() {
92-
it("includes '.' like Path.extname", function(done) {
94+
describe('extname', function () {
95+
it("includes '.' like Path.extname", function (done) {
9396
var srcPattern = 'test/fixtures/hello.txt';
94-
var obj = function(path) {
97+
var obj = function (path) {
9598
path.extname.should.equal('.txt');
9699
path.extname.should.equal(Path.extname(srcPattern));
97100
};
98101
helper(srcPattern, obj, null, done);
99102
});
100103

101-
it('excludes multiple extensions like Path.extname', function(done) {
104+
it('excludes multiple extensions like Path.extname', function (done) {
102105
var srcPattern = 'test/fixtures/hello.min.txt';
103-
var obj = function(path) {
106+
var obj = function (path) {
104107
path.extname.should.equal('.txt');
105108
path.extname.should.equal(Path.extname(srcPattern));
106109
};
107110
helper(srcPattern, obj, null, done);
108111
});
109112
});
110113

111-
describe('multiExt option', function() {
112-
it('includes multiple extensions in extname', function(done) {
114+
describe('multiExt option', function () {
115+
it('includes multiple extensions in extname', function (done) {
113116
var srcPattern = 'test/fixtures/hello.min.txt';
114-
var obj = function(path) {
117+
var obj = function (path) {
115118
path.extname.should.equal('.min.txt');
116119
path.basename.should.equal('hello');
117120
};
118121
helper(srcPattern, obj, null, done, { multiExt: true });
119122
});
120123
});
121124

122-
describe('original file context', function() {
123-
it('passed to plugin as second argument', function(done) {
125+
describe('original file context', function () {
126+
it('passed to plugin as second argument', function (done) {
124127
var srcPattern = 'test/fixtures/hello.min.txt';
125-
var obj = function(path, file) {
128+
var obj = function (path, file) {
126129
file.should.be.instanceof(Object);
127130
file.should.be.ok();
128131
};
129132
helper(srcPattern, obj, null, done, { multiExt: true });
130133
});
131134

132-
it('has expected properties', function(done) {
135+
it('has expected properties', function (done) {
133136
var srcPattern = 'test/fixtures/hello.min.txt';
134-
var obj = function(path, file) {
137+
var obj = function (path, file) {
135138
file.path.should.equal(Path.resolve(srcPattern));
136139
file.base.should.equal(Path.dirname(Path.resolve(srcPattern)));
137140
file.basename.should.equal(Path.basename(srcPattern));

test/rename-sourcemap.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ var Vinyl = require('vinyl');
55
var sourceMaps = require('gulp-sourcemaps');
66
require('should');
77

8-
describe('gulp-rename', function() {
9-
context('when file has source map', function() {
10-
it('updates source map file to match relative path of renamed file', function(done) {
8+
describe('gulp-rename', function () {
9+
context('when file has source map', function () {
10+
it('updates source map file to match relative path of renamed file', function (done) {
1111
var init = sourceMaps.init();
1212
var stream = init
1313
.pipe(rename({ prefix: 'test-' }))
1414
.pipe(rename({ prefix: 'test-' }));
1515

16-
stream.on('data', function(file) {
16+
stream.on('data', function (file) {
1717
file.sourceMap.file.should.equal('test-test-fixture.css');
1818
file.sourceMap.file.should.equal(file.relative);
1919
done();
@@ -23,8 +23,8 @@ describe('gulp-rename', function() {
2323
new Vinyl({
2424
base: 'fixtures',
2525
path: 'fixtures/fixture.css',
26-
contents: new Buffer('')
27-
})
26+
contents: new Buffer(''),
27+
}),
2828
);
2929

3030
init.end();

0 commit comments

Comments
 (0)