diff --git a/.gitignore b/.gitignore index 87be35f..e306283 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ +/.* +!/.gitignore +!/.jscsrc +!/.jshintrc +!/.travis.yml /bower_components/ /node_modules/ /output/ -/.psci* -/src/.webpack.js -.pulp-cache/ diff --git a/.jscsrc b/.jscsrc new file mode 100644 index 0000000..2561ce9 --- /dev/null +++ b/.jscsrc @@ -0,0 +1,17 @@ +{ + "preset": "grunt", + "disallowSpacesInFunctionExpression": null, + "requireSpacesInFunctionExpression": { + "beforeOpeningRoundBrace": true, + "beforeOpeningCurlyBrace": true + }, + "disallowSpacesInAnonymousFunctionExpression": null, + "requireSpacesInAnonymousFunctionExpression": { + "beforeOpeningRoundBrace": true, + "beforeOpeningCurlyBrace": true + }, + "disallowSpacesInsideObjectBrackets": null, + "requireSpacesInsideObjectBrackets": "all", + "validateQuoteMarks": "\"", + "requireCurlyBraces": null +} diff --git a/.jshintrc b/.jshintrc index 7374779..3c9a93e 100644 --- a/.jshintrc +++ b/.jshintrc @@ -5,9 +5,8 @@ "freeze": true, "funcscope": true, "futurehostile": true, - "globalstrict": true, + "strict": "global", "latedef": true, - "maxparams": 1, "noarg": true, "nocomma": true, "nonew": true, @@ -15,6 +14,6 @@ "singleGroups": true, "undef": true, "unused": true, - "eqnull": true + "eqnull": true, + "predef": ["exports", "Buffer"] } - diff --git a/.travis.yml b/.travis.yml index 15f5237..5fb6c2f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,7 @@ language: node_js -sudo: false -node_js: - - 4.2 - - 5.2 +dist: trusty +sudo: required +node_js: 6 env: - PATH=$HOME/purescript:$PATH install: @@ -10,6 +9,15 @@ install: - wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz - tar -xvf $HOME/purescript.tar.gz -C $HOME/ - chmod a+x $HOME/purescript + - npm install -g bower - npm install script: - - npm run build + - bower install --production + - npm run -s build + - bower install + - npm run -s test +after_success: +- >- + test $TRAVIS_TAG && + echo $GITHUB_TOKEN | pulp login && + echo y | pulp publish --no-push diff --git a/package.json b/package.json index c919c0f..6f75a70 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,16 @@ { "private": true, "scripts": { - "postinstall": "bower install", - "build": "jshint src && pulp build && rimraf docs && pulp docs" + "clean": "rimraf output && rimraf .pulp-cache", + "build": "jshint src && jscs src && pulp build --censor-lib --strict", + "test": "pulp test" }, "devDependencies": { - "jshint": "^2.8.0", - "pulp": "^9.0.0", - "rimraf": "^2.4.1", - "stream-buffers": "^3.0.0" + "jscs": "^3.0.7", + "jshint": "^2.9.3", + "pulp": "^9.0.1", + "purescript-psa": "^0.3.9", + "rimraf": "^2.5.4", + "stream-buffers": "^3.0.1" } } diff --git a/src/Node/Stream.js b/src/Node/Stream.js index a32edf1..ab00003 100644 --- a/src/Node/Stream.js +++ b/src/Node/Stream.js @@ -1,173 +1,171 @@ -/* global exports */ -/* global Buffer */ "use strict"; exports.undefined = undefined; -exports.setEncodingImpl = function(s) { - return function(enc) { - return function() { - s.setEncoding(enc); - }; +exports.setEncodingImpl = function (s) { + return function (enc) { + return function () { + s.setEncoding(enc); }; + }; }; -exports.readChunkImpl = function(Left) { - return function(Right) { - return function(chunk) { - if (chunk instanceof Buffer) { - return Right(chunk); - } else if (typeof chunk === 'string') { - return Left(chunk); - } else { - throw new Error( - "Node.Stream.readChunkImpl: Unrecognised " + - "chunk type; expected String or Buffer, got: " + - chunk); - } - }; +exports.readChunkImpl = function (Left) { + return function (Right) { + return function (chunk) { + if (chunk instanceof Buffer) { + return Right(chunk); + } else if (typeof chunk === "string") { + return Left(chunk); + } else { + throw new Error( + "Node.Stream.readChunkImpl: Unrecognised " + + "chunk type; expected String or Buffer, got: " + + chunk); + } }; + }; }; -exports.onDataEitherImpl = function(readChunk) { - return function(r) { - return function(f) { - return function() { - r.on('data', function(data) { - f(readChunk(data))(); - }); - }; - }; +exports.onDataEitherImpl = function (readChunk) { + return function (r) { + return function (f) { + return function () { + r.on("data", function (data) { + f(readChunk(data))(); + }); + }; }; + }; }; -exports.onEnd = function(s) { - return function(f) { - return function() { - s.on('end', f); - }; +exports.onEnd = function (s) { + return function (f) { + return function () { + s.on("end", f); }; + }; }; -exports.onReadable = function(s) { - return function(f) { - return function() { - s.on('readable', f); - }; +exports.onReadable = function (s) { + return function (f) { + return function () { + s.on("readable", f); }; + }; }; -exports.onError = function(s) { - return function(f) { - return function() { - s.on('error', function(e) { - f(e)(); - }); - }; +exports.onError = function (s) { + return function (f) { + return function () { + s.on("error", function (e) { + f(e)(); + }); }; + }; }; -exports.onClose = function(s) { - return function(f) { - return function() { - s.on('close', f); - }; +exports.onClose = function (s) { + return function (f) { + return function () { + s.on("close", f); }; + }; }; -exports.resume = function(s) { - return function() { - s.resume(); - }; +exports.resume = function (s) { + return function () { + s.resume(); + }; }; -exports.pause = function(s) { - return function() { - s.pause(); - }; +exports.pause = function (s) { + return function () { + s.pause(); + }; }; -exports.isPaused = function(s) { - return function() { - return s.isPaused(); - }; +exports.isPaused = function (s) { + return function () { + return s.isPaused(); + }; }; -exports.pipe = function(r) { - return function(w) { - return function() { - return r.pipe(w); - }; +exports.pipe = function (r) { + return function (w) { + return function () { + return r.pipe(w); }; + }; }; -exports.readImpl = function(readChunk) { - return function(Nothing) { - return function(Just) { - return function(r) { - return function(s) { - return function() { - var v = r.read(s); - if (v === null) { - return Nothing; - } else { - return Just(readChunk(v)); - } - }; - }; - }; +exports.readImpl = function (readChunk) { + return function (Nothing) { + return function (Just) { + return function (r) { + return function (s) { + return function () { + var v = r.read(s); + if (v === null) { + return Nothing; + } else { + return Just(readChunk(v)); + } + }; }; + }; }; + }; }; -exports.write = function(w) { - return function(chunk) { - return function(done) { - return function() { - return w.write(chunk, null, done); - }; - }; +exports.write = function (w) { + return function (chunk) { + return function (done) { + return function () { + return w.write(chunk, null, done); + }; }; + }; }; -exports.writeStringImpl = function(w) { - return function(enc) { - return function(s) { - return function(done) { - return function() { - return w.write(s, enc, done); - }; - }; +exports.writeStringImpl = function (w) { + return function (enc) { + return function (s) { + return function (done) { + return function () { + return w.write(s, enc, done); }; + }; }; + }; }; -exports.cork = function(w) { - return function() { - return w.cork(); - }; +exports.cork = function (w) { + return function () { + return w.cork(); + }; }; -exports.uncork = function(w) { - return function() { - return w.uncork(); - }; +exports.uncork = function (w) { + return function () { + return w.uncork(); + }; }; -exports.setDefaultEncodingImpl = function(w) { - return function(enc) { - return function() { - w.setDefaultEncoding(enc); - }; +exports.setDefaultEncodingImpl = function (w) { + return function (enc) { + return function () { + w.setDefaultEncoding(enc); }; + }; }; -exports.end = function(w) { - return function(done) { - return function() { - w.end(null, null, function() { - done(); - }); - }; +exports.end = function (w) { + return function (done) { + return function () { + w.end(null, null, function () { + done(); + }); }; + }; };