Skip to content

Commit 65ac500

Browse files
Migrate to GitHub Actions (#24)
1 parent 887b252 commit 65ac500

File tree

8 files changed

+166
-156
lines changed

8 files changed

+166
-156
lines changed

.eslintrc

-39
This file was deleted.

.eslintrc.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 5
4+
},
5+
"extends": "eslint:recommended",
6+
"env": {
7+
"commonjs": true
8+
},
9+
"rules": {
10+
"strict": [2, "global"],
11+
"block-scoped-var": 2,
12+
"consistent-return": 2,
13+
"eqeqeq": [2, "smart"],
14+
"guard-for-in": 2,
15+
"no-caller": 2,
16+
"no-extend-native": 2,
17+
"no-loop-func": 2,
18+
"no-new": 2,
19+
"no-param-reassign": 2,
20+
"no-return-assign": 2,
21+
"no-unused-expressions": 2,
22+
"no-use-before-define": 2,
23+
"radix": [2, "always"],
24+
"indent": [2, 2],
25+
"quotes": [2, "double"],
26+
"semi": [2, "always"]
27+
}
28+
}

.github/workflows/ci.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- uses: purescript-contrib/setup-purescript@main
16+
17+
- uses: actions/setup-node@v1
18+
with:
19+
node-version: "10"
20+
21+
- name: Install dependencies
22+
run: |
23+
npm install -g bower
24+
npm install
25+
bower install --production
26+
27+
- name: Build source
28+
run: npm run-script build
29+
30+
- name: Run tests
31+
run: |
32+
bower install
33+
npm run-script test --if-present

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/.*
22
!/.gitignore
3-
!/.eslintrc
4-
!/.travis.yml
3+
!/.eslintrc.json
4+
!/.github/
55
/bower_components/
66
/node_modules/
77
/output/

.travis.yml

-21
This file was deleted.

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# purescript-node-child-process
22

33
[![Latest release](http://img.shields.io/github/release/purescript-node/purescript-node-child-process.svg)](https://github.com/purescript/purescript-node-child-process/releases)
4-
[![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)
4+
[![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)
5+
[![Pursuit](https://pursuit.purescript.org/packages/purescript-node-child-process/badge)](https://pursuit.purescript.org/packages/purescript-node-child-process)
56

67
Bindings to Node's `child_process` API.
78

89
## Installation
910

1011
```
11-
bower install purescript-node-child-process
12+
spago install node-child-process
1213
```
1314

1415
## Documentation

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"build": "eslint src && pulp build -- --censor-lib --strict"
66
},
77
"devDependencies": {
8-
"eslint": "^4.19.1",
9-
"pulp": "^12.2.0",
10-
"purescript-psa": "^0.6.0",
11-
"rimraf": "^2.6.2"
8+
"eslint": "^7.15.0",
9+
"pulp": "^15.0.0",
10+
"purescript-psa": "^0.8.0",
11+
"rimraf": "^3.0.2"
1212
}
1313
}

src/Node/ChildProcess.js

+96-88
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,139 @@
1-
'use strict';
1+
"use strict";
22

33
/* eslint-env node*/
44

5-
exports.unsafeFromNullable = function unsafeFromNullable (msg) {
6-
return function (x) {
7-
if (x === null) throw new Error(msg);
8-
return x;
9-
};
10-
};
11-
12-
exports.spawnImpl = function spawnImpl (command) {
13-
return function (args) {
14-
return function (opts) {
15-
return function () {
16-
return require('child_process').spawn(command, args, opts);
17-
};
18-
};
19-
};
5+
exports.unsafeFromNullable = function unsafeFromNullable(msg) {
6+
return function (x) {
7+
if (x === null) throw new Error(msg);
8+
return x;
9+
};
2010
};
2111

22-
exports.execImpl = function execImpl (command) {
12+
exports.spawnImpl = function spawnImpl(command) {
13+
return function (args) {
2314
return function (opts) {
24-
return function (callback) {
25-
return function () {
26-
return require('child_process').exec(command, opts, function (err, stdout, stderr) {
27-
callback(err)(stdout)(stderr)();
28-
});
29-
};
30-
};
15+
return function () {
16+
return require("child_process").spawn(command, args, opts);
17+
};
3118
};
19+
};
3220
};
3321

34-
35-
exports.execFileImpl = function execImpl (command) {
36-
return function (args) {
37-
return function (opts) {
38-
return function (callback) {
39-
return function () {
40-
return require('child_process').execFile(command, args, opts, function (err, stdout, stderr) {
41-
callback(err)(stdout)(stderr)();
42-
});
43-
};
44-
};
45-
};
22+
exports.execImpl = function execImpl(command) {
23+
return function (opts) {
24+
return function (callback) {
25+
return function () {
26+
return require("child_process").exec(
27+
command,
28+
opts,
29+
function (err, stdout, stderr) {
30+
callback(err)(stdout)(stderr)();
31+
}
32+
);
33+
};
4634
};
35+
};
4736
};
4837

49-
exports.execSyncImpl = function execSyncImpl (command) {
38+
exports.execFileImpl = function execImpl(command) {
39+
return function (args) {
5040
return function (opts) {
41+
return function (callback) {
5142
return function () {
52-
return require('child_process').execSync(command, opts);
43+
return require("child_process").execFile(
44+
command,
45+
args,
46+
opts,
47+
function (err, stdout, stderr) {
48+
callback(err)(stdout)(stderr)();
49+
}
50+
);
5351
};
52+
};
5453
};
54+
};
5555
};
5656

57-
exports.execFileSyncImpl = function execFileSyncImpl (command) {
58-
return function (args) {
59-
return function (opts) {
60-
return function () {
61-
return require('child_process').execFileSync(command, args, opts);
62-
};
63-
};
57+
exports.execSyncImpl = function execSyncImpl(command) {
58+
return function (opts) {
59+
return function () {
60+
return require("child_process").execSync(command, opts);
6461
};
62+
};
6563
};
6664

67-
exports.fork = function fork (cmd) {
68-
return function (args) {
69-
return function () {
70-
return require('child_process').fork(cmd, args);
71-
};
65+
exports.execFileSyncImpl = function execFileSyncImpl(command) {
66+
return function (args) {
67+
return function (opts) {
68+
return function () {
69+
return require("child_process").execFileSync(command, args, opts);
70+
};
7271
};
72+
};
7373
};
7474

75-
exports.mkOnExit = function mkOnExit (mkChildExit) {
76-
return function onExit (cp) {
77-
return function (cb) {
78-
return function () {
79-
cp.on('exit', function (code, signal) {
80-
cb(mkChildExit(code)(signal))();
81-
});
82-
};
83-
};
75+
exports.fork = function fork(cmd) {
76+
return function (args) {
77+
return function () {
78+
return require("child_process").fork(cmd, args);
8479
};
80+
};
8581
};
8682

87-
exports.mkOnClose = function mkOnClose (mkChildExit) {
88-
return function onClose (cp) {
89-
return function (cb) {
90-
return function () {
91-
cp.on('close', function (code, signal) {
92-
cb(mkChildExit(code)(signal))();
93-
});
94-
};
95-
};
83+
exports.mkOnExit = function mkOnExit(mkChildExit) {
84+
return function onExit(cp) {
85+
return function (cb) {
86+
return function () {
87+
cp.on("exit", function (code, signal) {
88+
cb(mkChildExit(code)(signal))();
89+
});
90+
};
9691
};
92+
};
9793
};
9894

99-
exports.onDisconnect = function onDisconnect (cp) {
95+
exports.mkOnClose = function mkOnClose(mkChildExit) {
96+
return function onClose(cp) {
10097
return function (cb) {
101-
return function () {
102-
cp.on('disconnect', cb);
103-
};
98+
return function () {
99+
cp.on("close", function (code, signal) {
100+
cb(mkChildExit(code)(signal))();
101+
});
102+
};
104103
};
104+
};
105105
};
106106

107-
exports.mkOnMessage = function mkOnMessage (nothing) {
108-
return function (just) {
109-
return function onMessage (cp) {
110-
return function (cb) {
111-
return function () {
112-
cp.on('message', function (mess, sendHandle) {
113-
cb(mess, sendHandle ? just(sendHandle) : nothing)();
114-
});
115-
};
116-
};
117-
};
107+
exports.onDisconnect = function onDisconnect(cp) {
108+
return function (cb) {
109+
return function () {
110+
cp.on("disconnect", cb);
118111
};
112+
};
119113
};
120114

121-
exports.onError = function onError (cp) {
122-
return function (cb) {
115+
exports.mkOnMessage = function mkOnMessage(nothing) {
116+
return function (just) {
117+
return function onMessage(cp) {
118+
return function (cb) {
123119
return function () {
124-
cp.on('error', function (err) {
125-
cb(err)();
126-
});
120+
cp.on("message", function (mess, sendHandle) {
121+
cb(mess, sendHandle ? just(sendHandle) : nothing)();
122+
});
127123
};
124+
};
125+
};
126+
};
127+
};
128+
129+
exports.onError = function onError(cp) {
130+
return function (cb) {
131+
return function () {
132+
cp.on("error", function (err) {
133+
cb(err)();
134+
});
128135
};
136+
};
129137
};
130138

131139
exports.undefined = undefined;

0 commit comments

Comments
 (0)