diff --git a/.circleci/config.yml b/.circleci/config.yml index 6438ac0..8b8a9d4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,11 +9,11 @@ jobs: - restore_cache: keys: - - deps-{{ checksum "bower.json" }}-{{ checksum "package.json" }} + - deps-{{ checksum "packages.dhall" }}-{{ checksum "package.json" }} - run: command: | - yarn add --dev bower purescript pulp + yarn add --dev purescript spago yarn yarn build git checkout -- package.json @@ -23,7 +23,7 @@ jobs: - node_modules - bower_components - output - key: deps-{{ checksum "bower.json" }}-{{ checksum "package.json" }} + key: deps-{{ checksum "packages.dhall" }}-{{ checksum "package.json" }} - run: command: yarn jest diff --git a/.gitignore b/.gitignore index f42738e..8903044 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ yarn.lock .psc-ide-port .psci_modules +.purs-repl +.spago output \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..31e33c0 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# purescript-nonbili + +Prelude and helper modules shared by nonbili packages. + +## Development + +``` +yarn +spago build -w +yarn jest +``` diff --git a/bower.json b/bower.json deleted file mode 100644 index cd9d69d..0000000 --- a/bower.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "purescript-nonbili", - "description": "Some shared purescript modules used at Nonbili", - "authors": [ - "Ping Chen " - ], - "repository": { - "type": "git", - "url": "git://github.com/nonbili/purescript-nonbili.git" - }, - "license": "BSD-3-Clause", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "output" - ], - "dependencies": { - "purescript-prelude": "^4.1.0", - "purescript-effect": "^2.0.1", - "purescript-debug": "^4.0.0", - "purescript-tuples": "^5.1.0", - "purescript-either": "^4.1.1", - "purescript-arrays": "^5.2.0", - "purescript-call-by-name": "^2.0.0", - "purescript-const": "^4.1.0", - "purescript-transformers": "^4.1.0", - "purescript-strings": "^4.0.1", - "purescript-js-date": "^6.0.0", - "purescript-argonaut-codecs": "^6.0.2", - "purescript-aff": "^5.1.2" - }, - "devDependencies": { - "purescript-quickcheck": "^6.1.0", - "purescript-jest": "^0.2.0", - "purescript-psci-support": "^4.0.0" - } -} diff --git a/package.json b/package.json index 6d5e298..c488e9b 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,8 @@ "private": true, "license": "BSD-3-Clause", "scripts": { - "build": "pulp build -I test -- +RTS -N2 -RTS", - "postinstall": "bower install", - "test": "pulp build -I test && jest" + "build": "spago build -u '+RTS -N2 -RTS'", + "test": "spago build && jest" }, "devDependencies": { "jest": "^24.0.0" diff --git a/packages.dhall b/packages.dhall new file mode 100644 index 0000000..680dede --- /dev/null +++ b/packages.dhall @@ -0,0 +1,7 @@ +let upstream = + https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20200831/packages.dhall sha256:cdb3529cac2cd8dd780f07c80fd907d5faceae7decfcaa11a12037df68812c83 + +let nonbili = + https://github.com/nonbili/package-sets/releases/download/v0.7/packages.dhall sha256:b09c8d62a7a1e04fd150d32d80f575c0f1e6d82f2dc2a763eb4271cdb61a154d + +in upstream // nonbili diff --git a/spago.dhall b/spago.dhall new file mode 100644 index 0000000..c114534 --- /dev/null +++ b/spago.dhall @@ -0,0 +1,27 @@ +{- +Welcome to a Spago project! +You can edit this file as you like. +-} +{ name = "nonbili" +, dependencies = + [ "aff" + , "argonaut-codecs" + , "arrays" + , "call-by-name" + , "console" + , "const" + , "debug" + , "effect" + , "either" + , "jest" + , "js-date" + , "prelude" + , "psci-support" + , "quickcheck" + , "strings" + , "transformers" + , "tuples" + ] +, packages = ./packages.dhall +, sources = [ "src/**/*.purs", "test/**/*.purs" ] +} diff --git a/src/Nonbili/DateTime.purs b/src/Nonbili/DateTime.purs index ef1c26c..fba715b 100644 --- a/src/Nonbili/DateTime.purs +++ b/src/Nonbili/DateTime.purs @@ -11,7 +11,7 @@ module Nonbili.DateTime import Nonbili.Prelude import Data.Argonaut.Core as A -import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode (class DecodeJson, JsonDecodeError(..)) import Data.Argonaut.Encode (class EncodeJson) import Data.JSDate (JSDate) import Data.JSDate as JSDate @@ -23,7 +23,7 @@ derive instance ordDateTime :: Ord DateTime instance decodeJsonDateTime :: DecodeJson DateTime where decodeJson json = - note "Invalid date" $ (A.toString json >>= read) + note (UnexpectedValue json) $ (A.toString json >>= read) instance encodeJsonDateTime :: EncodeJson DateTime where encodeJson (DateTime date) = diff --git a/test/Nonbili/String.purs b/test/Nonbili/String.purs index 2c4c0b7..9b8b99a 100644 --- a/test/Nonbili/String.purs +++ b/test/Nonbili/String.purs @@ -15,7 +15,7 @@ spec :: Effect Unit spec = do test "padStart" $ do let re = unsafeRegex "^0+$" RegexFlags.noFlags - quickCheck \n s -> do + liftEffect $ quickCheck \n s -> do let lengthDiff = n - String.length s { before, after } = String.splitAt lengthDiff $ padStart n s