Skip to content

Commit 32d178b

Browse files
authored
Merge pull request #8 from purescript-contrib/updates
Update build, hide FFI implementations
2 parents dc6c13b + 9ccd71d commit 32d178b

File tree

7 files changed

+76
-55
lines changed

7 files changed

+76
-55
lines changed

.eslintrc.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 5
4+
},
5+
"extends": "eslint:recommended",
6+
"env": {
7+
"commonjs": true
8+
},
9+
"rules": {
10+
"strict": [2, "global"],
11+
"block-scoped-var": 2,
12+
"consistent-return": 2,
13+
"eqeqeq": [2, "smart"],
14+
"guard-for-in": 2,
15+
"no-caller": 2,
16+
"no-extend-native": 2,
17+
"no-loop-func": 2,
18+
"no-new": 2,
19+
"no-param-reassign": 2,
20+
"no-return-assign": 2,
21+
"no-unused-expressions": 2,
22+
"no-use-before-define": 2,
23+
"radix": [2, "always"],
24+
"indent": [2, 2, { "SwitchCase": 1 }],
25+
"quotes": [2, "double"],
26+
"semi": [2, "always"]
27+
}
28+
}

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/.*
22
!/.gitignore
3-
!/.jscsrc
4-
!/.jshintrc
3+
!/.eslintrc.json
54
!/.travis.yml
65
/bower_components/
76
/node_modules/

.jscsrc

-17
This file was deleted.

.jshintrc

-19
This file was deleted.

.travis.yml

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
language: node_js
22
dist: trusty
33
sudo: required
4-
node_js: 6
5-
env:
6-
- PATH=$HOME/purescript:$PATH
4+
node_js: stable
75
install:
8-
- TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p')
9-
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
10-
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
11-
- chmod a+x $HOME/purescript
126
- npm install -g bower
137
- npm install
14-
script:
158
- bower install --production
9+
script:
1610
- npm run -s build
1711
- bower install
18-
- npm test
12+
- npm -s test
1913
after_success:
2014
- >-
2115
test $TRAVIS_TAG &&

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"private": true,
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
5-
"build": "jshint src && jscs src && pulp build -- --censor-lib --strict",
5+
"build": "eslint src && pulp build -- --censor-lib --strict",
66
"test": "pulp test"
77
},
88
"devDependencies": {
9-
"jscs": "^2.11.0",
10-
"jshint": "^2.9.4",
9+
"eslint": "^3.19.0",
1110
"pulp": "^11.0.0",
1211
"purescript-psa": "^0.5.0",
12+
"purescript": "^0.11.1",
1313
"rimraf": "^2.6.1"
1414
}
1515
}

src/Data/JSDate.purs

+41-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,42 @@
66
-- | recommended that `DateTime` representation is used instead - `DateTime`
77
-- | offers greater type safety, a more PureScript-friendly interface, and has
88
-- | a `Generic` instance.
9-
module Data.JSDate where
9+
module Data.JSDate
10+
( JSDate
11+
, LOCALE
12+
, readDate
13+
, isValid
14+
, fromDateTime
15+
, toDateTime
16+
, toDate
17+
, toInstant
18+
, jsdate
19+
, jsdateLocal
20+
, parse
21+
, getTime
22+
, getUTCDate
23+
, getUTCDay
24+
, getUTCFullYear
25+
, getUTCHours
26+
, getUTCMilliseconds
27+
, getUTCMinutes
28+
, getUTCMonth
29+
, getUTCSeconds
30+
, getDate
31+
, getDay
32+
, getFullYear
33+
, getHours
34+
, getMilliseconds
35+
, getMinutes
36+
, getMonth
37+
, getSeconds
38+
, getTimezoneOffset
39+
, toDateString
40+
, toISOString
41+
, toString
42+
, toTimeString
43+
, toUTCString
44+
) where
1045

1146
import Prelude
1247

@@ -29,6 +64,11 @@ import Data.Time.Duration (Milliseconds(..))
2964
-- | The type of JavaScript `Date` objects.
3065
foreign import data JSDate :: Type
3166

67+
-- | The effect type used when indicating the current machine's date/time locale
68+
-- | is used in computing a value.
69+
foreign import data LOCALE :: Effect
70+
71+
-- | Attempts to read a `Foreign` value as a `JSDate`.
3272
readDate :: Foreign -> F JSDate
3373
readDate = unsafeReadTagged "Date"
3474

@@ -111,10 +151,6 @@ foreign import dateMethod :: forall a. Fn2 String JSDate a
111151
foreign import parse
112152
:: forall eff. String -> Eff (locale :: LOCALE | eff) JSDate
113153

114-
-- | The effect type used when indicating the current machine's date/time locale
115-
-- | is used in computing a value.
116-
foreign import data LOCALE :: Effect
117-
118154
-- | Returns the date as a number of milliseconds since 1970-01-01 00:00:00 UTC.
119155
getTime :: JSDate -> Number
120156
getTime dt = runFn2 dateMethod "getTime" dt

0 commit comments

Comments
 (0)