diff --git a/.eslintrc.json b/.eslintrc.json index 84cef4f..7b219e5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,10 +1,11 @@ { "parserOptions": { - "ecmaVersion": 5 + "ecmaVersion": 6, + "sourceType": "module" }, "extends": "eslint:recommended", "env": { - "commonjs": true + "node": true }, "rules": { "strict": [2, "global"], diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 063845e..06ed895 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,12 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main + with: + purescript: "unstable" - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: - node-version: "10" + node-version: "14" - name: Install dependencies run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c0f19f..e01253f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] Breaking changes: +- Update project and deps to PureScript v0.15.0 (#31 by @JordanMartinez, @thomashoneyman, @sigma-andex) New features: diff --git a/bower.json b/bower.json index 557f70e..e17d7f3 100644 --- a/bower.json +++ b/bower.json @@ -16,17 +16,17 @@ "package.json" ], "dependencies": { - "purescript-exceptions": "^5.0.0", - "purescript-foreign": "^6.0.0", - "purescript-foreign-object": "^3.0.0", - "purescript-functions": "^5.0.0", - "purescript-node-fs": "^6.0.0", - "purescript-node-streams": "^5.0.0", - "purescript-nullable": "^5.0.0", - "purescript-posix-types": "^5.0.0", - "purescript-unsafe-coerce": "^5.0.0" + "purescript-exceptions": "master", + "purescript-foreign": "master", + "purescript-foreign-object": "master", + "purescript-functions": "master", + "purescript-node-fs": "master", + "purescript-node-streams": "master", + "purescript-nullable": "main", + "purescript-posix-types": "master", + "purescript-unsafe-coerce": "master" }, "devDependencies": { - "purescript-console": "^5.0.0" + "purescript-console": "master" } } diff --git a/package.json b/package.json index 63f9f51..c08ce8f 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ }, "devDependencies": { "eslint": "^7.15.0", - "pulp": "^15.0.0", - "purescript-psa": "^0.8.0", + "pulp": "16.0.0-0", + "purescript-psa": "^0.8.2", "rimraf": "^3.0.2" } } diff --git a/src/Node/ChildProcess.js b/src/Node/ChildProcess.js index e638721..b3ba75a 100644 --- a/src/Node/ChildProcess.js +++ b/src/Node/ChildProcess.js @@ -1,140 +1,96 @@ -"use strict"; - /* eslint-env node*/ -exports.unsafeFromNullable = function unsafeFromNullable(msg) { - return function (x) { +import { spawn, exec, execFile, execSync, execFileSync, fork as cp_fork } from "child_process"; + +export function unsafeFromNullable(msg) { + return 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); - }; - }; - }; -}; +export function spawnImpl(command) { + return args => opts => () => spawn(command, args, opts); +} -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)(); - } - ); - }; - }; - }; -}; +export function execImpl(command) { + return opts => callback => () => exec( + command, + opts, + (err, stdout, stderr) => { + callback(err)(stdout)(stderr)(); + } + ); +} -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)(); - } - ); - }; - }; - }; - }; +export const execFileImpl = function execImpl(command) { + return args => opts => callback => () => execFile( + command, + args, + opts, + (err, stdout, stderr) => { + callback(err)(stdout)(stderr)(); + } + ); }; -exports.execSyncImpl = function execSyncImpl(command) { - return function (opts) { - return function () { - return require("child_process").execSync(command, opts); - }; - }; -}; +export function execSyncImpl(command) { + return opts => () => execSync(command, opts); +} -exports.execFileSyncImpl = function execFileSyncImpl(command) { - return function (args) { - return function (opts) { - return function () { - return require("child_process").execFileSync(command, args, opts); - }; - }; - }; -}; +export function execFileSyncImpl(command) { + return args => opts => () => execFileSync(command, args, opts); +} -exports.fork = function fork(cmd) { - return function (args) { - return function () { - return require("child_process").fork(cmd, args); - }; - }; -}; +export function fork(cmd) { + return args => () => cp_fork(cmd, args); +} -exports.mkOnExit = function mkOnExit(mkChildExit) { +export function mkOnExit(mkChildExit) { return function onExit(cp) { - return function (cb) { - return function () { - cp.on("exit", function (code, signal) { - cb(mkChildExit(code)(signal))(); - }); - }; + return cb => () => { + cp.on("exit", (code, signal) => { + cb(mkChildExit(code)(signal))(); + }); }; }; -}; +} -exports.mkOnClose = function mkOnClose(mkChildExit) { +export function mkOnClose(mkChildExit) { return function onClose(cp) { - return function (cb) { - return function () { - cp.on("close", function (code, signal) { - cb(mkChildExit(code)(signal))(); - }); - }; - }; - }; -}; - -exports.onDisconnect = function onDisconnect(cp) { - return function (cb) { - return function () { - cp.on("disconnect", cb); + return cb => () => { + cp.on("close", (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)(); - }); - }; - }; - }; +export function onDisconnect(cp) { + return cb => () => { + cp.on("disconnect", cb); }; -}; +} -exports.onError = function onError(cp) { - return function (cb) { - return function () { - cp.on("error", function (err) { - cb(err)(); +export function mkOnMessage(nothing) { + return just => (function onMessage(cp) { + return cb => () => { + cp.on("message", (mess, sendHandle) => { + cb(mess, sendHandle ? just(sendHandle) : nothing)(); }); }; + }); +} + +export function onError(cp) { + return cb => () => { + cp.on("error", err => { + cb(err)(); + }); }; -}; +} -exports.undefined = undefined; -exports.process = process; +const _undefined = undefined; +export { _undefined as undefined }; +import process from "process"; +export { process };