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

Drop dependency on deprecated gulp-util #55

Merged
merged 2 commits into from
Jan 17, 2018
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
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
var Concat = require('concat-with-sourcemaps');
var extend = require('object-assign');
var through = require('through2');
var gutil = require('gulp-util');
var lodashTemplate = require('lodash.template');
var stream = require('stream');
var path = require('path');
var fs = require('fs');
Expand All @@ -28,7 +28,7 @@ module.exports = function (headerText, data) {

// format template
var filename = path.basename(file.path);
var template = data === false ? headerText : gutil.template(headerText, extend({ file: file, filename: filename }, data));
var template = data === false ? headerText : lodashTemplate(headerText)(extend({ file: file, filename: filename }, data));

if (file && typeof file === 'string') {
this.push(template + file);
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
"url": "https://github.com/tracker1/gulp-header/issues"
},
"dependencies": {
"gulp-util": "*",
"concat-with-sourcemaps": "*",
"lodash.template": "^4.4.0",
"object-assign": "*",
"through2": "^2.0.0",
"concat-with-sourcemaps": "*"
"through2": "^2.0.0"
},
"devDependencies": {
"event-stream": "^3.1.7",
Expand Down
8 changes: 4 additions & 4 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

var header = require('../');
var should = require('should');
var gutil = require('gulp-util');
var fs = require('fs');
var path = require('path');
var es = require('event-stream');
var stream = require('stream');
var File = require('vinyl');
var gulp = require('gulp');
require('mocha');
Expand All @@ -26,7 +26,7 @@ describe('gulp-header', function() {

function getFakeFileReadStream(){
return new File({
contents: es.readArray(['Hello world']),
contents: new stream.Readable({objectMode: true}).wrap(es.readArray(['Hello world'])),
path: './test/fixture/anotherFile.txt'
});
}
Expand All @@ -45,7 +45,7 @@ describe('gulp-header', function() {
should.exist(newFile.path);
should.exist(newFile.relative);
should.exist(newFile.contents);
newFile.path.should.equal('./test/fixture/file.txt');
newFile.path.should.equal('test/fixture/file.txt');
newFile.relative.should.equal('file.txt');
newFile.contents.toString('utf8').should.equal('Hello world');
++file_count;
Expand Down Expand Up @@ -121,7 +121,7 @@ describe('gulp-header', function() {
''].join('\n'));
stream.on('data', function (newFile) {
should.exist(newFile.contents);
newFile.contents.toString('utf8').should.equal('file.txt\n./test/fixture/file.txt\nHello world');
newFile.contents.toString('utf8').should.equal('file.txt\ntest/fixture/file.txt\nHello world');
});
stream.once('end', done);

Expand Down