diff --git a/.eslintrc.json b/.eslintrc.json index 17f167d..240b092 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,7 @@ { - "env": { "browser": true, "commonjs": true }, + "env": { "browser": true }, "extends": "eslint:recommended", - "parserOptions": { "ecmaVersion": 5 }, + "parserOptions": { "ecmaVersion": 6, "sourceType": "module" }, "rules": { "block-scoped-var": "error", "consistent-return": "error", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43f9f20..a37ef4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: - name: Set up PureScript toolchain uses: purescript-contrib/setup-purescript@main with: + purescript: "unstable" purs-tidy: "latest" - name: Cache PureScript dependencies @@ -49,8 +50,15 @@ jobs: - name: Build the project run: npm run build - - name: Run tests - run: npm run test +# - name: Run tests +# run: npm run test - name: Check formatting run: purs-tidy check src test + + - name: Verify Bower & Pulp + run: | + npm install bower pulp@16.0.0-0 + npx bower install + npx pulp build -- --censor-lib --strict + npx pulp test diff --git a/CHANGELOG.md b/CHANGELOG.md index 1498bbd..5f32068 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: +- Migrate FFI to ES modules (#57 by @JordanMartinez) New features: diff --git a/bower.json b/bower.json index 2d52481..ffdcda0 100644 --- a/bower.json +++ b/bower.json @@ -27,23 +27,19 @@ "package.json" ], "dependencies": { - "purescript-arrays": "^6.0.0", - "purescript-control": "^5.0.0", - "purescript-either": "^5.0.0", - "purescript-foreign-object": "^3.0.0", - "purescript-functions": "^5.0.0", - "purescript-gen": "^3.0.0", - "purescript-maybe": "^5.0.0", - "purescript-nonempty": "^6.0.0", - "purescript-prelude": "^5.0.0", - "purescript-strings": "^5.0.0", - "purescript-tailrec": "^5.0.0" + "purescript-arrays": "master", + "purescript-control": "master", + "purescript-either": "master", + "purescript-foreign-object": "master", + "purescript-functions": "master", + "purescript-gen": "master", + "purescript-maybe": "master", + "purescript-nonempty": "master", + "purescript-prelude": "master", + "purescript-strings": "master", + "purescript-tailrec": "master" }, "devDependencies": { - "purescript-console": "^5.0.0", - "purescript-effect": "^3.0.0", - "purescript-partial": "^3.0.0", - "purescript-quickcheck": "^7.0.0", - "purescript-tuples": "^6.0.0" + "purescript-quickcheck": "master" } } diff --git a/packages.dhall b/packages.dhall index 7a6905b..582d6d3 100644 --- a/packages.dhall +++ b/packages.dhall @@ -1,4 +1,4 @@ let upstream = - https://github.com/purescript/package-sets/releases/download/psc-0.14.3-20210722/packages.dhall sha256:1ceb43aa59436bf5601bac45f6f3781c4e1f0e4c2b8458105b018e5ed8c30f8c + https://raw.githubusercontent.com/purescript/package-sets/prepare-0.15/src/packages.dhall in upstream diff --git a/spago.dhall b/spago.dhall index 5c494b2..a487d36 100644 --- a/spago.dhall +++ b/spago.dhall @@ -12,7 +12,6 @@ , "nonempty" , "partial" , "prelude" - , "psci-support" , "quickcheck" , "strings" , "tailrec" diff --git a/src/Data/Argonaut/Core.js b/src/Data/Argonaut/Core.js index b0579d6..3101e99 100644 --- a/src/Data/Argonaut/Core.js +++ b/src/Data/Argonaut/Core.js @@ -1,33 +1,30 @@ /* eslint-disable no-eq-null, eqeqeq */ -"use strict"; - function id(x) { return x; } -exports.fromBoolean = id; -exports.fromNumber = id; -exports.fromString = id; -exports.fromArray = id; -exports.fromObject = id; - -exports.jsonNull = null; +export {id as fromBoolean}; +export {id as fromNumber}; +export {id as fromString}; +export {id as fromArray}; +export {id as fromObject}; +export const jsonNull = null; -exports.stringify = function (j) { +export function stringify(j) { return JSON.stringify(j); -}; +} -exports.stringifyWithIndent = function (i) { +export function stringifyWithIndent(i) { return function (j) { return JSON.stringify(j, null, i); }; -}; +} function isArray(a) { return Object.prototype.toString.call(a) === "[object Array]"; } -exports._caseJson = function (isNull, isBool, isNum, isStr, isArr, isObj, j) { +export function _caseJson(isNull, isBool, isNum, isStr, isArr, isObj, j) { if (j == null) return isNull(); else if (typeof j === "boolean") return isBool(j); else if (typeof j === "number") return isNum(j); @@ -35,9 +32,9 @@ exports._caseJson = function (isNull, isBool, isNum, isStr, isArr, isObj, j) { else if (Object.prototype.toString.call(j) === "[object Array]") return isArr(j); else return isObj(j); -}; +} -exports._compare = function _compare(EQ, GT, LT, a, b) { +export function _compare(EQ, GT, LT, a, b) { if (a == null) { if (b == null) return EQ; else return LT; @@ -102,4 +99,4 @@ exports._compare = function _compare(EQ, GT, LT, a, b) { return EQ; } } -}; +} diff --git a/src/Data/Argonaut/Parser.js b/src/Data/Argonaut/Parser.js index ab6cf5b..4d66cac 100644 --- a/src/Data/Argonaut/Parser.js +++ b/src/Data/Argonaut/Parser.js @@ -1,10 +1,8 @@ -"use strict"; - -exports._jsonParser = function (fail, succ, s) { +export function _jsonParser(fail, succ, s) { try { return succ(JSON.parse(s)); } catch (e) { return fail(e.message); } -}; +} diff --git a/test/Test/Main.js b/test/Test/Main.js index 5e2af72..4e2359a 100644 --- a/test/Test/Main.js +++ b/test/Test/Main.js @@ -1,9 +1,7 @@ -"use strict"; - -exports.thisIsNull = null; -exports.thisIsBoolean = true; -exports.thisIsNumber = 12; -exports.thisIsString = "foobar"; -exports.thisIsArray = ["foo", "bar"]; -exports.thisIsObject = { foo: "bar" }; -exports.thisIsInvalidString = "\\\ffff"; +export const thisIsNull = null; +export const thisIsBoolean = true; +export const thisIsNumber = 12; +export const thisIsString = "foobar"; +export const thisIsArray = ["foo", "bar"]; +export const thisIsObject = { foo: "bar" }; +export const thisIsInvalidString = "\\\ffff";