avh4 / elm-upgrade

Upgrade Elm projects
https://www.npmjs.com/package/elm-upgrade
MIT License
122 stars 15 forks source link

"versions" no longer exists in https://package.elm-lang.org/search.json #86

Closed hpate-omicron closed 4 years ago

hpate-omicron commented 4 years ago

This came from slack - https://elmlang.slack.com/archives/C0CJ3SBBM/p1582057782068800

When the code tries to call supportedPackages[packageInfo.name] = packageInfo.versions.slice(-1)[0]; it ends up with an error (node:19118) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'slice' of undefined because the versions property no longer exists in the search.json from the package repo.

Code with slice: https://github.com/avh4/elm-upgrade/blob/665c96251ceb71b9f2e1bd181db459a72120e80c/upgrade.js#L154

Search.json: https://package.elm-lang.org/search.json

It looks like this commit on the package repo changed it - https://github.com/elm/package.elm-lang.org/commit/ad9e8890426e943f396dcc0c1595b77d6239f499

cruessler commented 4 years ago

I just ran into the same issue. After doing an npm install -g elm-format and changing the offending line to supportedPackages[packageInfo.name] = packageInfo.version;, I could successfully run elm-upgrade. It looks like elm-ugrade only wants to know whether a given package exists, not which versions it has.

avh4 commented 4 years ago

Fixed in 0.19.8