Skip to content

Commit de577a9

Browse files
authored
🔀 Merge pull request #4 from gluons/remove-gulp-util
Drop dependency on deprecated `gulp-util`
2 parents 4177fd9 + 08952bd commit de577a9

File tree

4 files changed

+95
-229
lines changed

4 files changed

+95
-229
lines changed

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@
3434
"homepage": "https://github.com/gluons/gulp-json2cson",
3535
"dependencies": {
3636
"cson": "^4.1.0",
37-
"gulp-util": "^3.0.8",
38-
"through2": "^2.0.3"
37+
"plugin-error": "^0.1.2",
38+
"replace-ext": "^1.0.0",
39+
"through2": "^2.0.3",
40+
"vinyl": "^2.1.0"
3941
},
4042
"devDependencies": {
4143
"babel-core": "^6.26.0",
@@ -46,7 +48,6 @@
4648
"del": "^3.0.0",
4749
"globby": "^7.1.1",
4850
"make-dir": "^1.1.0",
49-
"mocha": "*",
50-
"replace-ext": "^1.0.0"
51+
"mocha": "*"
5152
}
5253
}

src/main.coffee

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
gutil = require 'gulp-util'
2-
through = require 'through2'
31
CSON = require 'cson'
4-
5-
PluginError = gutil.PluginError
2+
PluginError = require 'plugin-error'
3+
replaceExt = require 'replace-ext'
4+
through = require 'through2'
65

76
PLUGIN_NAME = 'gulp-json2cson'
87

@@ -16,7 +15,7 @@ module.exports = (indent = ' ') ->
1615
try
1716
json = JSON.parse file.contents.toString()
1817
file.contents = Buffer.from CSON.stringify json, null, indent
19-
file.path = gutil.replaceExtension file.path, '.cson'
18+
file.path = replaceExt file.path, '.cson'
2019

2120
callback null, file
2221
catch error

test/test.coffee

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
assert = require 'assert'
22
fs = require 'fs'
3-
gutil = require 'gulp-util'
3+
Vinyl = require 'vinyl'
44

5-
{ File } = gutil
65
{ readFileSync } = fs
76

87
json2cson = require '../dist/main.js'
@@ -13,7 +12,7 @@ describe 'JSON to CSON', () ->
1312
it 'should parse JSON to CSON', (done) ->
1413
myParser = json2cson()
1514

16-
fakeFile = new File {
15+
fakeFile = new Vinyl {
1716
cwd: '.'
1817
base: 'test/source'
1918
path: 'test/source/success.json'
@@ -35,7 +34,7 @@ describe 'JSON to CSON', () ->
3534
it 'should parse JSON to CSON with tab indentation', (done) ->
3635
myParser = json2cson('\t')
3736

38-
fakeFile = new File {
37+
fakeFile = new Vinyl {
3938
cwd: '.'
4039
base: 'test/source'
4140
path: 'test/source/success.json'
@@ -57,7 +56,7 @@ describe 'JSON to CSON', () ->
5756
it 'should return error when cannot parse file', (done) ->
5857
myParser = json2cson()
5958

60-
fakeFile = new File {
59+
fakeFile = new Vinyl {
6160
cwd: '.'
6261
base: 'test/source'
6362
path: 'test/source/error.json'

0 commit comments

Comments
 (0)