diff --git a/.gitignore b/.gitignore index 307f9c0..e306283 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ /.* !/.gitignore +!/.jscsrc +!/.jshintrc !/.travis.yml /bower_components/ /node_modules/ 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..94a944d 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, + "node": true } - diff --git a/.travis.yml b/.travis.yml index f9843c2..78cde3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,16 +2,10 @@ language: node_js dist: trusty sudo: required node_js: 6 -env: - - PATH=$HOME/purescript:$PATH install: - - TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p') - - 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 - - bower install + - bower install --production script: - npm run -s build after_success: diff --git a/README.md b/README.md index 149c9cf..5cfa14a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # purescript-node-process -[![Latest release](http://img.shields.io/bower/v/purescript-node-process.svg)](https://github.com/purescript/purescript-node-process/releases) -[![Build Status](https://travis-ci.org/purescript/purescript-node-process.svg?branch=master)](https://travis-ci.org/purescript/purescript-node-process) -[![Dependency Status](https://www.versioneye.com/user/projects/579e4539aa78d500469f9e72/badge.svg?style=flat)](https://www.versioneye.com/user/projects/579e4539aa78d500469f9e72) +[![Latest release](http://img.shields.io/github/release/purescript-node/purescript-node-process.svg)](https://github.com/purescript-node/purescript-node-process/releases) +[![Build Status](https://travis-ci.org/purescript-node/purescript-node-process.svg?branch=master)](https://travis-ci.org/purescript-node/purescript-node-process) The Node.js global `process` object in PureScript. diff --git a/package.json b/package.json index 62272ec..8e20023 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,15 @@ "private": true, "scripts": { "clean": "rimraf output && rimraf .pulp-cache", - "build": "pulp build --censor-lib --strict" + "build": "jshint src && jscs src && pulp build --censor-lib --strict", + "test": "pulp test" }, "devDependencies": { + "jscs": "^3.0.7", + "jshint": "^2.9.4", "pulp": "^9.0.1", "purescript-psa": "^0.3.9", - "rimraf": "^2.5.0" + "purescript": "^0.10.1", + "rimraf": "^2.5.4" } } diff --git a/src/Node/Globals.js b/src/Node/Globals.js index 09c3afa..ecf278c 100644 --- a/src/Node/Globals.js +++ b/src/Node/Globals.js @@ -1,17 +1,11 @@ "use strict"; -/* global exports */ -/* global require */ -/* global __dirname */ -/* global __filename */ - -// module Node.Globals exports.__dirname = __dirname; exports.__filename = __filename; exports.unsafeRequire = require; -exports.requireResolve = function(mod) { - return function() { +exports.requireResolve = function (mod) { + return function () { return require.resolve(mod); }; }; diff --git a/src/Node/Globals.purs b/src/Node/Globals.purs index 8034276..815d33e 100644 --- a/src/Node/Globals.purs +++ b/src/Node/Globals.purs @@ -3,7 +3,7 @@ module Node.Globals where import Control.Monad.Eff -import Node.FS (FS()) +import Node.FS (FS) -- | The name of the directory that the currently executing script resides in. -- | diff --git a/src/Node/Platform.purs b/src/Node/Platform.purs index 96477a2..e06e953 100644 --- a/src/Node/Platform.purs +++ b/src/Node/Platform.purs @@ -3,7 +3,6 @@ module Node.Platform where import Prelude -import Data.Function (on) import Data.Maybe (Maybe(..)) data Platform @@ -36,8 +35,5 @@ instance showPlatform :: Show Platform where show SunOS = "SunOS" show Win32 = "Win32" -instance eqPlatform :: Eq Platform where - eq = eq `on` toString - -instance ordPlatform :: Ord Platform where - compare = compare `on` toString +derive instance eqPlatform :: Eq Platform +derive instance ordPlatform :: Ord Platform diff --git a/src/Node/Process.js b/src/Node/Process.js index d55dfcc..1dc584d 100644 --- a/src/Node/Process.js +++ b/src/Node/Process.js @@ -1,49 +1,45 @@ "use strict"; -// module Node.Process - -/* global exports */ -/* global process */ exports.process = process; -exports.onBeforeExit = function(callback) { - return function() { - process.on('beforeExit', callback); - }; +exports.onBeforeExit = function (callback) { + return function () { + process.on("beforeExit", callback); + }; }; -exports.onExit = function(callback) { - return function() { - process.on('exit', function(code) { - callback(code)(); - }); - }; +exports.onExit = function (callback) { + return function () { + process.on("exit", function (code) { + callback(code)(); + }); + }; }; -exports.onSignalImpl = function(signal) { - return function(callback) { - return function() { - process.on(signal, callback); - }; +exports.onSignalImpl = function (signal) { + return function (callback) { + return function () { + process.on(signal, callback); }; + }; }; -exports.chdir = function(dir) { - return function() { - process.chdir(dir); - }; +exports.chdir = function (dir) { + return function () { + process.chdir(dir); + }; }; -exports.setEnv = function(var_) { - return function(val) { - return function() { - process.env[var_] = val; - }; +exports.setEnv = function (var_) { + return function (val) { + return function () { + process.env[var_] = val; }; + }; }; -exports.exit = function(code) { - return function() { - process.exit(code); - }; +exports.exit = function (code) { + return function () { + process.exit(code); + }; }; diff --git a/src/Node/Process.purs b/src/Node/Process.purs index d41e279..55f4af2 100644 --- a/src/Node/Process.purs +++ b/src/Node/Process.purs @@ -1,6 +1,6 @@ -- | Bindings to the global `process` object in Node.js. See also [the Node API documentation](https://nodejs.org/api/process.html) module Node.Process - ( PROCESS() + ( PROCESS , onBeforeExit , onExit , onSignal @@ -24,21 +24,25 @@ module Node.Process ) where import Prelude -import Partial.Unsafe (unsafePartial) + import Control.Monad.Eff (Eff) -import Control.Monad.Eff.Console (CONSOLE()) -import Control.Monad.Eff.Exception (EXCEPTION()) -import Data.Maybe (Maybe(), fromJust) -import Data.StrMap (StrMap()) -import Data.StrMap as StrMap -import Data.Posix (Pid()) -import Data.Posix.Signal (Signal()) +import Control.Monad.Eff.Console (CONSOLE) +import Control.Monad.Eff.Exception (EXCEPTION) + +import Data.Maybe (Maybe, fromJust) +import Data.Posix (Pid) +import Data.Posix.Signal (Signal) import Data.Posix.Signal as Signal -import Node.Stream (Readable(), Writable()) -import Unsafe.Coerce (unsafeCoerce) +import Data.StrMap (StrMap) +import Data.StrMap as StrMap -import Node.Platform (Platform()) +import Node.Platform (Platform) import Node.Platform as Platform +import Node.Stream (Readable, Writable) + +import Partial.Unsafe (unsafePartial) + +import Unsafe.Coerce (unsafeCoerce) -- | An effect tracking interaction with the global `process` object. foreign import data PROCESS :: !