From a4fdd39bf133f43cebe2ec53a6e0aa05c3eeab61 Mon Sep 17 00:00:00 2001 From: Nicholas Wolverson Date: Sat, 12 Feb 2022 18:12:10 +0000 Subject: [PATCH 01/12] ESM conversion --- src/Node/ReadLine.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Node/ReadLine.js b/src/Node/ReadLine.js index 5f3e927..92a2540 100644 --- a/src/Node/ReadLine.js +++ b/src/Node/ReadLine.js @@ -2,10 +2,11 @@ // module Node.ReadLine -exports.createInterfaceImpl = function (options) { +import { createInterface } from 'readline'; + +export function createInterfaceImpl(options) { return function () { - var readline = require("readline"); - return readline.createInterface({ + return createInterface({ input: options.input, output: options.output, completer: @@ -18,21 +19,21 @@ exports.createInterfaceImpl = function (options) { historySize: options.historySize, }); }; -}; +} -exports.close = function (readline) { +export function close(readline) { return function () { readline.close(); }; -}; +} -exports.prompt = function (readline) { +export function prompt(readline) { return function () { readline.prompt(); }; -}; +} -exports.question = function (text) { +export function question(text) { return function (callback) { return function (readline) { return function () { @@ -42,17 +43,17 @@ exports.question = function (text) { }; }; }; -}; +} -exports.setPrompt = function (prompt) { +export function setPrompt(prompt) { return function (readline) { return function () { readline.setPrompt(prompt); }; }; -}; +} -exports.setLineHandler = function (callback) { +export function setLineHandler(callback) { return function (readline) { return function () { readline.removeAllListeners("line"); @@ -61,4 +62,4 @@ exports.setLineHandler = function (callback) { }); }; }; -}; +} From a16942f33c9159fabcf542ad8ec81b74940c5047 Mon Sep 17 00:00:00 2001 From: Nicholas Wolverson Date: Sat, 12 Feb 2022 18:14:44 +0000 Subject: [PATCH 02/12] ES6 transformations --- src/Node/ReadLine.js | 58 ++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/src/Node/ReadLine.js b/src/Node/ReadLine.js index 92a2540..a2b238b 100644 --- a/src/Node/ReadLine.js +++ b/src/Node/ReadLine.js @@ -5,61 +5,49 @@ import { createInterface } from 'readline'; export function createInterfaceImpl(options) { - return function () { - return 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, - }); - }; + 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 function () { + return () => { readline.close(); }; } export function prompt(readline) { - return function () { + return () => { readline.prompt(); }; } export function question(text) { - return function (callback) { - return function (readline) { - return function () { - readline.question(text, function (result) { - callback(result)(); - }); - }; - }; + return callback => readline => () => { + readline.question(text, result => { + callback(result)(); + }); }; } export function setPrompt(prompt) { - return function (readline) { - return function () { - readline.setPrompt(prompt); - }; + return readline => () => { + readline.setPrompt(prompt); }; } export function setLineHandler(callback) { - return function (readline) { - return function () { - readline.removeAllListeners("line"); - readline.on("line", function (line) { - callback(line)(); - }); - }; + return readline => () => { + readline.removeAllListeners("line"); + readline.on("line", line => { + callback(line)(); + }); }; } From fac1e7821d89598aaa2814a1af74fc292bd6359a Mon Sep 17 00:00:00 2001 From: sigma-andex Date: Tue, 22 Mar 2022 18:04:21 +0000 Subject: [PATCH 03/12] Removed '"use strict";' in FFI files --- src/Node/ReadLine.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Node/ReadLine.js b/src/Node/ReadLine.js index a2b238b..9a16591 100644 --- a/src/Node/ReadLine.js +++ b/src/Node/ReadLine.js @@ -1,5 +1,3 @@ -"use strict"; - // module Node.ReadLine import { createInterface } from 'readline'; From e08636a8e1b32a333acdf69d86660a128c8affa3 Mon Sep 17 00:00:00 2001 From: sigma-andex Date: Tue, 22 Mar 2022 18:04:21 +0000 Subject: [PATCH 04/12] Update to CI to use 'unstable' purescript --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 063845e..f5a96fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main + with: + purescript: "unstable" - uses: actions/setup-node@v1 with: From e0334e8fe21148032e37f80b924c46ba96747349 Mon Sep 17 00:00:00 2001 From: sigma-andex Date: Tue, 22 Mar 2022 18:04:21 +0000 Subject: [PATCH 05/12] Update Bower dependencies to master or main --- bower.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 193c89e..2432714 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-effect": "master", + "purescript-foreign": "master", "purescript-node-process": "^8.0.0", "purescript-node-streams": "^5.0.0", - "purescript-options": "^6.0.0", - "purescript-prelude": "^5.0.0" + "purescript-options": "main", + "purescript-prelude": "master" } } From 687d26c4b868b57d9eb98057bbc27cf7abddb0ba Mon Sep 17 00:00:00 2001 From: sigma-andex Date: Tue, 22 Mar 2022 18:04:21 +0000 Subject: [PATCH 06/12] Update pulp to 16.0.0-0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1c67b54..18136bd 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ }, "devDependencies": { "eslint": "^7.15.0", - "pulp": "^15.0.0", + "pulp": "16.0.0-0", "purescript-psa": "^0.8.0", "rimraf": "^3.0.2" } From 558e78e54fd725ac9c701469ffb7f2800fad0138 Mon Sep 17 00:00:00 2001 From: sigma-andex Date: Tue, 22 Mar 2022 18:04:21 +0000 Subject: [PATCH 07/12] Update psa to 0.8.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 18136bd..4ea39f9 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "devDependencies": { "eslint": "^7.15.0", "pulp": "16.0.0-0", - "purescript-psa": "^0.8.0", + "purescript-psa": "^0.8.2", "rimraf": "^3.0.2" } } From 8ff71ea399bd6b0a3d05fd83758bf3170bc94477 Mon Sep 17 00:00:00 2001 From: sigma-andex Date: Tue, 22 Mar 2022 19:41:59 +0000 Subject: [PATCH 08/12] Update Bower dependencies to master or main --- bower.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index 2432714..89470c2 100644 --- a/bower.json +++ b/bower.json @@ -21,8 +21,8 @@ "dependencies": { "purescript-effect": "master", "purescript-foreign": "master", - "purescript-node-process": "^8.0.0", - "purescript-node-streams": "^5.0.0", + "purescript-node-process": "master", + "purescript-node-streams": "master", "purescript-options": "main", "purescript-prelude": "master" } From 99d65d0902b4770b58eb950a5764a1887196db7f Mon Sep 17 00:00:00 2001 From: sigma-andex Date: Tue, 22 Mar 2022 21:36:24 +0000 Subject: [PATCH 09/12] Add eslint config --- .eslintrc.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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"], From f1fa2623a4a7772784c585c8cb42f28059a8aae1 Mon Sep 17 00:00:00 2001 From: sigma-andex Date: Tue, 22 Mar 2022 21:36:33 +0000 Subject: [PATCH 10/12] Fix eslint errors --- src/Node/ReadLine.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Node/ReadLine.js b/src/Node/ReadLine.js index 9a16591..cb70419 100644 --- a/src/Node/ReadLine.js +++ b/src/Node/ReadLine.js @@ -1,14 +1,14 @@ // module Node.ReadLine -import { createInterface } from 'readline'; +import { createInterface } from "readline"; 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]; + const res = options.completer(line)(); + return [res.completions, res.matched]; }), terminal: options.terminal, historySize: options.historySize, From 43c429ba813ec5d733d2fa47f817486d3ef9fae9 Mon Sep 17 00:00:00 2001 From: sigma-andex Date: Tue, 22 Mar 2022 21:38:02 +0000 Subject: [PATCH 11/12] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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: From 3a69e34cf7130baa4fb308508e07cd1411dd2621 Mon Sep 17 00:00:00 2001 From: sigma-andex Date: Tue, 22 Mar 2022 21:45:46 +0000 Subject: [PATCH 12/12] Update ci.yml to v2 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5a96fe..06ed895 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,9 @@ jobs: with: purescript: "unstable" - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: - node-version: "10" + node-version: "14" - name: Install dependencies run: |