diff --git a/.jscs.json b/.jscs.json new file mode 100644 index 0000000..8abb2b8 --- /dev/null +++ b/.jscs.json @@ -0,0 +1,8 @@ +{ + "preset": "google", + "disallowMultipleLineBreaks": false, + "excludeFiles": [ + "coverage", + "node_modules" + ] +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..acc9ed4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,18 @@ +# v1.0.6 + +###### February 11, 2016 + +#### Maintenance + +* Minor code style fixes in [index.js][index]. + +#### Development Features + +* Add [CHANGELOG.md][changelog]. +* Add [JSHint][jshint] as a development dependency. +* Add [JSCS][jscs] code-style support. + +[changelog]: CHANGELOG.md +[index]: index.js +[jscs]: http://jscs.info/ +[jshint]: http://jshint.com/about/ diff --git a/index.js b/index.js index e43a4c2..dd9bce6 100644 --- a/index.js +++ b/index.js @@ -30,11 +30,13 @@ inherits(GulpTransformStream, Transform); GulpTransformStream.prototype._transform = function(file, encoding, next) { if (file.isBuffer()) { - file.contents = transformContents(this.transformFn, file.contents, file, this.options); + file.contents = transformContents( + this.transformFn, file.contents, file, this.options); } if (file.isStream()) { - file.contents = file.contents.pipe(new FileStream(this.transformFn, file, this.options)); + file.contents = file.contents.pipe( + new FileStream(this.transformFn, file, this.options)); } next(null, file); @@ -59,7 +61,8 @@ FileStream.prototype._transform = function(chunk, encoding, next) { FileStream.prototype._flush = function(done) { var contents = Buffer.concat(this.data); - this.push(transformContents(this.transformFn, contents, this.file, this.options)); + this.push(transformContents( + this.transformFn, contents, this.file, this.options)); done(); }; diff --git a/package.json b/package.json index baa50a4..1181d5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-transform", - "version": "1.0.5", + "version": "1.0.6", "description": "Gulp plugin for performing arbitrary transformations on the contents of files.", "main": "index.js", "files": [ @@ -9,10 +9,14 @@ "README.md" ], "scripts": { - "test": "mocha", + "test": "npm run jshint && npm run jscs && npm run mocha", + "jshint": "jshint . --exclude-path .gitignore", + "jscs": "jscs .", + "mocha": "istanbul cover _mocha", + "coverage": "npm test && open ./coverage/lcov-report/index.html", "clean": "rm -rf ./node_modules ./coverage", - "coverage": "istanbul cover _mocha && open ./coverage/lcov-report/index.html", - "coveralls": "istanbul cover _mocha && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" + "coveralls": "cat ./coverage/lcov.info | coveralls", + "preversion": "npm run test" }, "engines": { "node": ">=0.10" @@ -48,6 +52,8 @@ "event-stream": "^3.3.2", "gulp": "^3.9.1", "istanbul": "^0.4.2", + "jscs": "^2.9.0", + "jshint": "^2.9.1", "mocha": "^2.4.5", "rimraf": "^2.5.1", "sinon": "^1.17.3", diff --git a/test/index.test.js b/test/index.test.js index 483c050..bbbddc6 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -26,7 +26,7 @@ describe('plugin:gulpTransform()', function() { describe('param:transformFn', function() { - var fn, file; + var fn; var file; beforeEach(function() { file = fixt.file.buffered(); fn = fixt.fn.transform(); @@ -41,7 +41,7 @@ describe('plugin:gulpTransform()', function() { expect(transform.bind(null, 'paralysis')).to.throw(gutil.PluginError); }); - it('throws PluginError if return value is not a String or Buffer', function() { + it('throws PluginError if return value is not a ctring/Buffer', function() { expect(function() { transform(fixt.fn.bufferReturn()).write(fixt.file.buffered()); }).not.to.throw(gutil.PluginError); @@ -65,7 +65,7 @@ describe('plugin:gulpTransform()', function() { describe('param:options', function() { - var fn, file; + var fn; var file; beforeEach(function() { file = fixt.file.buffered(); fn = fixt.fn.transform();