Skip to content

Commit

Permalink
Update to PureScript v0.15.0 (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanMartinez authored Mar 22, 2022
1 parent 261ecbc commit 7ad2034
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 38 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -49,8 +50,17 @@ 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
if [ -d "test" ]; then
npx pulp test
fi
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:
- Migrate FFI to ES modules (#36 by @JordanMartinez)

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"
],
"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"
}
}
2 changes: 1 addition & 1 deletion packages.dhall
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion spago.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
, "numbers"
, "partial"
, "prelude"
, "psci-support"
, "transformers"
]
, packages = ./packages.dhall
Expand Down
42 changes: 20 additions & 22 deletions src/Data/JSDate.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -17,28 +15,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,
Expand All @@ -48,9 +46,9 @@ exports.jsdate = function(parts) {
parts.second,
parts.millisecond
);
};
}

exports.jsdateLocal = function(parts) {
export function jsdateLocal(parts) {
return function() {
return createLocalDate(
parts.year,
Expand All @@ -62,24 +60,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);
};
}
4 changes: 1 addition & 3 deletions test/Test/Main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
"use strict";

exports.myDate = new Date();
export const myDate = new Date();

0 comments on commit 7ad2034

Please sign in to comment.