Skip to content

Commit

Permalink
Update to PureScript v0.15.0 (#28)
Browse files Browse the repository at this point in the history
* ESM conversion

* ES6 transformations

* Removed '"use strict";' in FFI files

* Update to CI to use 'unstable' purescript

* Update Bower dependencies to master or main

* Update pulp to 16.0.0-0

* Update psa to 0.8.2

* Update Bower dependencies to master or main

* Add eslint config

* Fix eslint errors

* Update changelog

* Update ci.yml to v2

Co-authored-by: Nicholas Wolverson <nicholas.wolverson@gmail.com>
  • Loading branch information
sigma-andex and nwolverson authored Mar 22, 2022
1 parent c59deb3 commit dff666d
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 63 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"parserOptions": {
"ecmaVersion": 5
"ecmaVersion": 6,
"sourceType": "module"
},
"extends": "eslint:recommended",
"env": {
"commonjs": true
"node": true
},
"rules": {
"strict": [2, "global"],
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
14 changes: 7 additions & 7 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
87 changes: 37 additions & 50 deletions src/Node/ReadLine.js
Original file line number Diff line number Diff line change
@@ -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)();
});
};
};
}

0 comments on commit dff666d

Please sign in to comment.