Skip to content

Update build & style tweaks #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/.*
!/.gitignore
!/.jscsrc
!/.jshintrc
!/.travis.yml
/bower_components/
/node_modules/
Expand Down
17 changes: 17 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -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
}
7 changes: 3 additions & 4 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
"freeze": true,
"funcscope": true,
"futurehostile": true,
"globalstrict": true,
"strict": "global",
"latedef": true,
"maxparams": 1,
"noarg": true,
"nocomma": true,
"nonew": true,
"notypeof": true,
"singleGroups": true,
"undef": true,
"unused": true,
"eqnull": true
"eqnull": true,
"node": true
}

8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
10 changes: 2 additions & 8 deletions src/Node/Globals.js
Original file line number Diff line number Diff line change
@@ -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);
};
};
2 changes: 1 addition & 1 deletion src/Node/Globals.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
-- |
Expand Down
8 changes: 2 additions & 6 deletions src/Node/Platform.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module Node.Platform where

import Prelude
import Data.Function (on)
import Data.Maybe (Maybe(..))

data Platform
Expand Down Expand Up @@ -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
60 changes: 28 additions & 32 deletions src/Node/Process.js
Original file line number Diff line number Diff line change
@@ -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);
};
};
28 changes: 16 additions & 12 deletions src/Node/Process.purs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 :: !
Expand Down