Skip to content

Migrate to GitHub Actions #24

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 3 commits into from
Dec 9, 2020
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
39 changes: 0 additions & 39 deletions .eslintrc

This file was deleted.

28 changes: 28 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"parserOptions": {
"ecmaVersion": 5
},
"extends": "eslint:recommended",
"env": {
"commonjs": true
},
"rules": {
"strict": [2, "global"],
"block-scoped-var": 2,
"consistent-return": 2,
"eqeqeq": [2, "smart"],
"guard-for-in": 2,
"no-caller": 2,
"no-extend-native": 2,
"no-loop-func": 2,
"no-new": 2,
"no-param-reassign": 2,
"no-return-assign": 2,
"no-unused-expressions": 2,
"no-use-before-define": 2,
"radix": [2, "always"],
"indent": [2, 2],
"quotes": [2, "double"],
"semi": [2, "always"]
}
}
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: purescript-contrib/setup-purescript@main

- uses: actions/setup-node@v1
with:
node-version: "10"

- name: Install dependencies
run: |
npm install -g bower
npm install
bower install --production

- name: Build source
run: npm run-script build

- name: Run tests
run: |
bower install
npm run-script test --if-present
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/.*
!/.gitignore
!/.eslintrc
!/.travis.yml
!/.eslintrc.json
!/.github/
/bower_components/
/node_modules/
/output/
Expand Down
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# purescript-node-child-process

[![Latest release](http://img.shields.io/github/release/purescript-node/purescript-node-child-process.svg)](https://github.com/purescript/purescript-node-child-process/releases)
[![Build Status](https://travis-ci.org/purescript-node/purescript-node-child-process.svg?branch=master)](https://travis-ci.org/purescript-node/purescript-node-child-process)
[![Build status](https://github.com/purescript-node/purescript-node-child-process/workflows/CI/badge.svg?branch=master)](https://github.com/purescript-node/purescript-node-child-process/actions?query=workflow%3ACI+branch%3Amaster)
[![Pursuit](https://pursuit.purescript.org/packages/purescript-node-child-process/badge)](https://pursuit.purescript.org/packages/purescript-node-child-process)

Bindings to Node's `child_process` API.

## Installation

```
bower install purescript-node-child-process
spago install node-child-process
```

## Documentation
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"build": "eslint src && pulp build -- --censor-lib --strict"
},
"devDependencies": {
"eslint": "^4.19.1",
"pulp": "^12.2.0",
"purescript-psa": "^0.6.0",
"rimraf": "^2.6.2"
"eslint": "^7.15.0",
"pulp": "^15.0.0",
"purescript-psa": "^0.8.0",
"rimraf": "^3.0.2"
}
}
184 changes: 96 additions & 88 deletions src/Node/ChildProcess.js
Original file line number Diff line number Diff line change
@@ -1,131 +1,139 @@
'use strict';
"use strict";

/* eslint-env node*/

exports.unsafeFromNullable = function unsafeFromNullable (msg) {
return function (x) {
if (x === null) throw new Error(msg);
return x;
};
};

exports.spawnImpl = function spawnImpl (command) {
return function (args) {
return function (opts) {
return function () {
return require('child_process').spawn(command, args, opts);
};
};
};
exports.unsafeFromNullable = function unsafeFromNullable(msg) {
return function (x) {
if (x === null) throw new Error(msg);
return x;
};
};

exports.execImpl = function execImpl (command) {
exports.spawnImpl = function spawnImpl(command) {
return function (args) {
return function (opts) {
return function (callback) {
return function () {
return require('child_process').exec(command, opts, function (err, stdout, stderr) {
callback(err)(stdout)(stderr)();
});
};
};
return function () {
return require("child_process").spawn(command, args, opts);
};
};
};
};


exports.execFileImpl = function execImpl (command) {
return function (args) {
return function (opts) {
return function (callback) {
return function () {
return require('child_process').execFile(command, args, opts, function (err, stdout, stderr) {
callback(err)(stdout)(stderr)();
});
};
};
};
exports.execImpl = function execImpl(command) {
return function (opts) {
return function (callback) {
return function () {
return require("child_process").exec(
command,
opts,
function (err, stdout, stderr) {
callback(err)(stdout)(stderr)();
}
);
};
};
};
};

exports.execSyncImpl = function execSyncImpl (command) {
exports.execFileImpl = function execImpl(command) {
return function (args) {
return function (opts) {
return function (callback) {
return function () {
return require('child_process').execSync(command, opts);
return require("child_process").execFile(
command,
args,
opts,
function (err, stdout, stderr) {
callback(err)(stdout)(stderr)();
}
);
};
};
};
};
};

exports.execFileSyncImpl = function execFileSyncImpl (command) {
return function (args) {
return function (opts) {
return function () {
return require('child_process').execFileSync(command, args, opts);
};
};
exports.execSyncImpl = function execSyncImpl(command) {
return function (opts) {
return function () {
return require("child_process").execSync(command, opts);
};
};
};

exports.fork = function fork (cmd) {
return function (args) {
return function () {
return require('child_process').fork(cmd, args);
};
exports.execFileSyncImpl = function execFileSyncImpl(command) {
return function (args) {
return function (opts) {
return function () {
return require("child_process").execFileSync(command, args, opts);
};
};
};
};

exports.mkOnExit = function mkOnExit (mkChildExit) {
return function onExit (cp) {
return function (cb) {
return function () {
cp.on('exit', function (code, signal) {
cb(mkChildExit(code)(signal))();
});
};
};
exports.fork = function fork(cmd) {
return function (args) {
return function () {
return require("child_process").fork(cmd, args);
};
};
};

exports.mkOnClose = function mkOnClose (mkChildExit) {
return function onClose (cp) {
return function (cb) {
return function () {
cp.on('close', function (code, signal) {
cb(mkChildExit(code)(signal))();
});
};
};
exports.mkOnExit = function mkOnExit(mkChildExit) {
return function onExit(cp) {
return function (cb) {
return function () {
cp.on("exit", function (code, signal) {
cb(mkChildExit(code)(signal))();
});
};
};
};
};

exports.onDisconnect = function onDisconnect (cp) {
exports.mkOnClose = function mkOnClose(mkChildExit) {
return function onClose(cp) {
return function (cb) {
return function () {
cp.on('disconnect', cb);
};
return function () {
cp.on("close", function (code, signal) {
cb(mkChildExit(code)(signal))();
});
};
};
};
};

exports.mkOnMessage = function mkOnMessage (nothing) {
return function (just) {
return function onMessage (cp) {
return function (cb) {
return function () {
cp.on('message', function (mess, sendHandle) {
cb(mess, sendHandle ? just(sendHandle) : nothing)();
});
};
};
};
exports.onDisconnect = function onDisconnect(cp) {
return function (cb) {
return function () {
cp.on("disconnect", cb);
};
};
};

exports.onError = function onError (cp) {
return function (cb) {
exports.mkOnMessage = function mkOnMessage(nothing) {
return function (just) {
return function onMessage(cp) {
return function (cb) {
return function () {
cp.on('error', function (err) {
cb(err)();
});
cp.on("message", function (mess, sendHandle) {
cb(mess, sendHandle ? just(sendHandle) : nothing)();
});
};
};
};
};
};

exports.onError = function onError(cp) {
return function (cb) {
return function () {
cp.on("error", function (err) {
cb(err)();
});
};
};
};

exports.undefined = undefined;
Expand Down