Skip to content

Commit

Permalink
Merge pull request marklagendijk#31 from TheDancingCode/issue-30
Browse files Browse the repository at this point in the history
Drop dependency on deprecated `gulp-util`
  • Loading branch information
marklagendijk authored Jan 4, 2018
2 parents e988833 + 6f8b611 commit 2656c88
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var _ = require("lodash");
var gutil = require("gulp-util");
var replaceExtension = require('replace-ext');
var map = require("map-stream");

var TEMPLATES = {
Expand Down Expand Up @@ -52,7 +52,7 @@ module.exports = function (options) {
if(options && options.extension) {
extension = options.extension;
}
file.path = gutil.replaceExtension(file.path, extension);
file.path = replaceExtension(file.path, extension);
}

return callback(null, file);
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
"test": "mocha"
},
"dependencies": {
"gulp-util": "*",
"lodash": ">=3.3 <5",
"map-stream": "*"
"map-stream": "*",
"replace-ext": "^1.0.0"
},
"devDependencies": {
"event-stream": "~3.0.20",
"mocha": "~1.14.0",
"should": "~2.1.0",
"event-stream": "~3.0.20"
"vinyl": "^2.1.0"
},
"engines": {
"node": ">=0.8.0",
Expand Down
32 changes: 16 additions & 16 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ var fs = require("fs");
var path = require("path");
var es = require("event-stream");
var should = require("should");
var gutil = require("gulp-util");
var Vinyl = require("vinyl");
var ngHtml2Js = require("../");

describe("gulp-ng-html2js", function () {
describe("when file is provided via buffer", function () {
it("should generate the angular module", function (done) {
var expectedFile = new gutil.File({
var expectedFile = new Vinyl({
path: "test/expected/example.js",
cwd: "test/",
base: "test/expected",
Expand All @@ -24,7 +24,7 @@ describe("gulp-ng-html2js", function () {

describe("when options.export is provided", function(){
it("commonjs", function(done){
var expectedFile = new gutil.File({
var expectedFile = new Vinyl({
path: "test/expected/exampleWithExportCommon.js",
cwd: "test/",
base: "test/expected",
Expand All @@ -39,7 +39,7 @@ describe("gulp-ng-html2js", function () {
});

it("should use common, options.moduleName && options.declareModule when provided", function(done){
var expectedFile = new gutil.File({
var expectedFile = new Vinyl({
path: "test/expected/exampleWithExportCommonModuleNameNoGenerate.js",
cwd: "test/",
base: "test/expected",
Expand All @@ -56,7 +56,7 @@ describe("gulp-ng-html2js", function () {
});

it("system", function(done){
var expectedFile = new gutil.File({
var expectedFile = new Vinyl({
path: "test/expected/exampleWithExportSystem.js",
cwd: "test/",
base: "test/expected",
Expand All @@ -71,7 +71,7 @@ describe("gulp-ng-html2js", function () {
});

it("should use system, options.moduleName && options.declareModule when provided", function(done){
var expectedFile = new gutil.File({
var expectedFile = new Vinyl({
path: "test/expected/exampleWithExportSystemModuleNameNoGenerate.js",
cwd: "test/",
base: "test/expected",
Expand All @@ -89,7 +89,7 @@ describe("gulp-ng-html2js", function () {
});

it("should use options.moduleName when provided", function (done) {
var expectedFile = new gutil.File({
var expectedFile = new Vinyl({
path: "test/expected/exampleWithModuleName.js",
cwd: "test/",
base: "test/expected",
Expand All @@ -104,7 +104,7 @@ describe("gulp-ng-html2js", function () {
});

it("should use options.moduleName (function) when provided", function (done) {
var expectedFile = new gutil.File({
var expectedFile = new Vinyl({
path: "test/expected/exampleWithModuleName.js",
cwd: "test/",
base: "test/expected",
Expand All @@ -122,7 +122,7 @@ describe("gulp-ng-html2js", function () {
});

it("should use options.moduleName && options.declareModule when provided", function (done) {
var expectedFile = new gutil.File({
var expectedFile = new Vinyl({
path: "test/expected/exampleWithModuleNameNoGenerate.js",
cwd: "test/",
base: "test/expected",
Expand All @@ -138,7 +138,7 @@ describe("gulp-ng-html2js", function () {
});

it("should add options.prefix to the url in the generated file", function (done) {
var expectedFile = new gutil.File({
var expectedFile = new Vinyl({
path: "test/expected/exampleWithPrefix.js",
cwd: "test/",
base: "test/expected",
Expand All @@ -153,7 +153,7 @@ describe("gulp-ng-html2js", function () {
});

it("should subtract options.stripPrefix from the url in the generated file", function (done) {
var expectedFile = new gutil.File({
var expectedFile = new Vinyl({
path: "test/expected/exampleWithStripPrefix.js",
cwd: "test/",
base: "test/expected",
Expand All @@ -168,7 +168,7 @@ describe("gulp-ng-html2js", function () {
});

it("should allow a custom function to rename the generated file", function (done) {
var expectedFile = new gutil.File({
var expectedFile = new Vinyl({
path: "test/expected/exampleWithRename.js",
cwd: "test/",
base: "test/expected",
Expand All @@ -185,7 +185,7 @@ describe("gulp-ng-html2js", function () {
});

it("should allow using a custom template", function (done) {
var expectedFile = new gutil.File({
var expectedFile = new Vinyl({
path: "test/expected/exampleWithCustomTemplate.js",
cwd: "test/",
base: "test/expected",
Expand All @@ -201,7 +201,7 @@ describe("gulp-ng-html2js", function () {


function testBufferedFile(params, expectedFile, done) {
var srcFile = new gutil.File({
var srcFile = new Vinyl({
path: "test/fixtures/example.html",
cwd: "test/",
base: "test",
Expand All @@ -226,7 +226,7 @@ describe("gulp-ng-html2js", function () {
});

it("should pass on files which are null", function (done) {
var srcFile = new gutil.File({
var srcFile = new Vinyl({
path: "test/fixtures/example.html",
cwd: "test/",
base: "test/fixtures",
Expand All @@ -245,7 +245,7 @@ describe("gulp-ng-html2js", function () {
});

it("should error on stream", function (done) {
var srcFile = new gutil.File({
var srcFile = new Vinyl({
path: "test/fixtures/example.html",
cwd: "test/",
base: "test/fixtures",
Expand Down

0 comments on commit 2656c88

Please sign in to comment.