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 0507516..2513b9e 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 (#28 by @JordanMartinez, @sigma-andex) New features: diff --git a/bower.json b/bower.json index 193c89e..89470c2 100644 --- a/bower.json +++ b/bower.json @@ -16,14 +16,14 @@ "package.json" ], "devDependencies": { - "purescript-console": "^5.0.0" + "purescript-console": "master" }, "dependencies": { - "purescript-effect": "^3.0.0", - "purescript-foreign": "^6.0.0", - "purescript-node-process": "^8.0.0", - "purescript-node-streams": "^5.0.0", - "purescript-options": "^6.0.0", - "purescript-prelude": "^5.0.0" + "purescript-effect": "master", + "purescript-foreign": "master", + "purescript-node-process": "master", + "purescript-node-streams": "master", + "purescript-options": "main", + "purescript-prelude": "master" } } diff --git a/package.json b/package.json index 1c67b54..4ea39f9 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,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/ReadLine.js b/src/Node/ReadLine.js index 5f3e927..cb70419 100644 --- a/src/Node/ReadLine.js +++ b/src/Node/ReadLine.js @@ -1,64 +1,51 @@ -"use strict"; - // module Node.ReadLine -exports.createInterfaceImpl = function (options) { - return function () { - var readline = require("readline"); - return readline.createInterface({ - input: options.input, - output: options.output, - completer: - options.completer && - function (line) { - var res = options.completer(line)(); - return [res.completions, res.matched]; - }, - terminal: options.terminal, - historySize: options.historySize, - }); - }; -}; +import { createInterface } from "readline"; -exports.close = function (readline) { - return function () { +export function createInterfaceImpl(options) { + return () => createInterface({ + input: options.input, + output: options.output, + completer: options.completer && (line => { + const res = options.completer(line)(); + return [res.completions, res.matched]; + }), + terminal: options.terminal, + historySize: options.historySize, + }); +} + +export function close(readline) { + return () => { readline.close(); }; -}; +} -exports.prompt = function (readline) { - return function () { +export function prompt(readline) { + return () => { readline.prompt(); }; -}; +} -exports.question = function (text) { - return function (callback) { - return function (readline) { - return function () { - readline.question(text, function (result) { - callback(result)(); - }); - }; - }; +export function question(text) { + return callback => readline => () => { + readline.question(text, result => { + callback(result)(); + }); }; -}; +} -exports.setPrompt = function (prompt) { - return function (readline) { - return function () { - readline.setPrompt(prompt); - }; +export function setPrompt(prompt) { + return readline => () => { + readline.setPrompt(prompt); }; -}; +} -exports.setLineHandler = function (callback) { - return function (readline) { - return function () { - readline.removeAllListeners("line"); - readline.on("line", function (line) { - callback(line)(); - }); - }; +export function setLineHandler(callback) { + return readline => () => { + readline.removeAllListeners("line"); + readline.on("line", line => { + callback(line)(); + }); }; -}; +}