From fec60443ec5f4fc091ae0385cbe214edd4a65180 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:21:20 -0500 Subject: [PATCH 01/11] Update .eslintrc.json to ES6 --- .eslintrc.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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", From dfb18b75845cdbbe206967fe587bb31a919ade8a Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:21:21 -0500 Subject: [PATCH 02/11] Migrated FFI to ES modules via 'lebab' --- src/Data/JSDate.js | 40 ++++++++++++++++++++-------------------- test/Test/Main.js | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Data/JSDate.js b/src/Data/JSDate.js index 4e9bdb3..6003d5f 100644 --- a/src/Data/JSDate.js +++ b/src/Data/JSDate.js @@ -17,28 +17,28 @@ var createLocalDate = function(y, m, d, h, mi, s, ms) { return date; }; -exports.now = function() { +export function now() { return new Date(); -}; +} -exports.isValid = function(date) { +export function isValid(date) { return !isNaN(date.getTime()); -}; +} -exports.toInstantImpl = function(just) { +export function toInstantImpl(just) { return function(nothing) { return function(date) { var t = date.getTime(); return isNaN(t) ? nothing : just(t); }; }; -}; +} -exports.fromInstant = function(instant) { +export function fromInstant(instant) { return new Date(instant); -}; +} -exports.jsdate = function(parts) { +export function jsdate(parts) { return createDate( parts.year, parts.month, @@ -48,9 +48,9 @@ exports.jsdate = function(parts) { parts.second, parts.millisecond ); -}; +} -exports.jsdateLocal = function(parts) { +export function jsdateLocal(parts) { return function() { return createLocalDate( parts.year, @@ -62,24 +62,24 @@ exports.jsdateLocal = function(parts) { parts.millisecond ); }; -}; +} -exports.dateMethod = function(method, date) { +export function dateMethod(method, date) { return date[method](); -}; +} -exports.dateMethodEff = function(method, date) { +export function dateMethodEff(method, date) { return function() { return date[method](); }; -}; +} -exports.parse = function(dateString) { +export function parse(dateString) { return function() { return new Date(dateString); }; -}; +} -exports.fromTime = function(time) { +export function fromTime(time) { return new Date(time); -}; +} diff --git a/test/Test/Main.js b/test/Test/Main.js index fc80ce6..9896f0f 100644 --- a/test/Test/Main.js +++ b/test/Test/Main.js @@ -1,3 +1,3 @@ "use strict"; -exports.myDate = new Date(); +export var myDate = new Date(); From 6e1f6d2de6ca64a7798ae8e4ba6d13580eb29599 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:21:21 -0500 Subject: [PATCH 03/11] Replaced 'export var' with 'export const' --- test/Test/Main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Test/Main.js b/test/Test/Main.js index 9896f0f..17735f9 100644 --- a/test/Test/Main.js +++ b/test/Test/Main.js @@ -1,3 +1,3 @@ "use strict"; -export var myDate = new Date(); +export const myDate = new Date(); From 428412296ab596bbb7024212850702a4b16cdf8f Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:21:21 -0500 Subject: [PATCH 04/11] Removed '"use strict";' in FFI files --- src/Data/JSDate.js | 2 -- test/Test/Main.js | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/Data/JSDate.js b/src/Data/JSDate.js index 6003d5f..8db78c4 100644 --- a/src/Data/JSDate.js +++ b/src/Data/JSDate.js @@ -1,6 +1,4 @@ // global exports -"use strict"; - var createDate = function(y, m, d, h, mi, s, ms) { var date = new Date(Date.UTC(y, m, d, h, mi, s, ms)); if (y >= 0 && y < 100) { diff --git a/test/Test/Main.js b/test/Test/Main.js index 17735f9..0892f2c 100644 --- a/test/Test/Main.js +++ b/test/Test/Main.js @@ -1,3 +1 @@ -"use strict"; - export const myDate = new Date(); From a8ebbb716cff1400e0377a632460fd0ecc84d8b2 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:21:21 -0500 Subject: [PATCH 05/11] Update to CI to use 'unstable' purescript --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43f9f20..4989d99 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 From 9bc3a018ff6cb1cf548752f3a1ca986ff12fec7c Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:21:21 -0500 Subject: [PATCH 06/11] Add CI test: verify 'bower.json' file works via pulp --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4989d99..fc54710 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,3 +55,12 @@ jobs: - 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 + if [ -d "test" ]; then + npx pulp test + fi From efea622109408a2c277d11d8b53edd0afcd86283 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:21:21 -0500 Subject: [PATCH 07/11] Ignore spago-based tests (temporarily) --- .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 fc54710..e16f413 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,8 +50,8 @@ 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 From db6d161b79a5e7c3fe134b4a64d344be376101b2 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:21:21 -0500 Subject: [PATCH 08/11] Update Bower dependencies to master or main --- bower.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bower.json b/bower.json index ab283dc..7a03fb7 100644 --- a/bower.json +++ b/bower.json @@ -16,14 +16,14 @@ "package.json" ], "dependencies": { - "purescript-datetime": "^5.0.0", - "purescript-effect": "^3.0.0", - "purescript-foreign": "^6.0.0", - "purescript-integers": "^5.0.0" + "purescript-datetime": "master", + "purescript-effect": "master", + "purescript-foreign": "master", + "purescript-integers": "master" }, "devDependencies": { - "purescript-assert": "^5.0.0", - "purescript-console": "^5.0.0", - "purescript-numbers": "^8.0.0" + "purescript-assert": "master", + "purescript-console": "master", + "purescript-numbers": "master" } } From f80e9ae48b43182a802166f6c2dcdd450df166d8 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:21:21 -0500 Subject: [PATCH 09/11] Update packages.dhall to 'prepare-0.15' package set --- packages.dhall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 278fa98bf15babaf2a8a57c0b7b7da9f5bb84ba2 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 09:21:21 -0500 Subject: [PATCH 10/11] Removed unneeded 'psci-support' package --- spago.dhall | 1 - 1 file changed, 1 deletion(-) diff --git a/spago.dhall b/spago.dhall index 38704ab..6210f3a 100644 --- a/spago.dhall +++ b/spago.dhall @@ -13,7 +13,6 @@ , "numbers" , "partial" , "prelude" - , "psci-support" , "transformers" ] , packages = ./packages.dhall From 0e7b47b4c08a1459b3e97be1e9bf1525aa89435f Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 14:55:39 -0500 Subject: [PATCH 11/11] Added changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bed7b6f..f5ce863 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 (#36 by @JordanMartinez) New features: