Purescript 0.14/0.15 compatibility

Hi all. I’ve been out of development for some time. I have a site written in Purescript 0.13.3 and I want to update in the coming weeks. Is it recommended to update to 0.14.x for now? I see 0.15 was released in May. Looking over the packages I see most of them are 0.15 compatible. But I was wondering if it’s better to wait until next year to update to 0.15. Any feedback on this would be greatly appreciated.

For reference the site uses the following packages:

      "affjax"
    , "argonaut"
    , "b64"
    , "browser-cookies"
    , "console"
    , "css"
    , "datetime"
    , "dotenv"
    , "effect"
    , "elasticsearch"
    , "express"
    , "formatters"
    , "halogen"
    , "halogen-css"
    , "halogen-formless"
    , "halogen-media"
    , "halogen-rawhtml"
    , "halogen-select"
    , "js-date"
    , "now"
    , "partial"
    , "precise-datetime"
    , "psci-support"
    , "aff-bus"
    , "routing"
    , "routing-duplex"
    , "simple-json"
    , "strings"
    , "stringutils"
    , "slug"
    , "timestamp"
    , "quill"
    , "web-xhr"

I’d go directly 0.15 - it’s mostly a simple rewrite of some .js FFI files at most - same with missing packages. We can help out if you want.

3 Likes

Thanks @CarstenKoenig, that’s very good to know! I’m going to try it out in the coming weeks and might reach out if I hit something :smiling_face:

1 Like

Feel free to contact me :wink:

1 Like

Please see the 0.14.0 and 0.15.0 migration guides: documentation/migration-guides at master · purescript/documentation · GitHub

Jumping 2 major releases is certainly faster to do, but may come with some gotchas you weren’t expecting. In particular, Map’s Semigroup instance was modified.

3 Likes

Updating to 0.15.4 was easier than I thought but it definitely helped that I had already updated most things for 0.14.7 :partying_face:

I get one error now when trying to run the server

Error: Dynamic require of "path" is not supported

from this command

spago bundle-app --main Server --to server.js --platform node && node server.js

I’m seeing issues that address this and apparently you can pass a banner to esbuild

--banner:js="import { createRequire } from 'module';const require = createRequire(import.meta.url);"

Is it possible to pass other esbuild arguments to spago bundle-app? I have a esbuild.js config in the root of the directory as well and I thought esbuild would read it by default but it doesn’t seem to be the case.

3 Likes

In stiatuations like these I would simply run spago build and esbuild ... instead of spago bundle

4 Likes

that is actually a great idea! thanks @Adrielus

1 Like