avh4 / elm-upgrade

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

Seems to have broken with 0.19.1 #82

Closed ChristophP closed 4 years ago

ChristophP commented 5 years ago

I tried to upgrade my project whihc was running on elm 0.18.0 straight to 0.19.1. But elm-upgrade failed updating my dependencies. So I installed elm 0.19.1 globally and then ran elm-upgrade.

It said this a lot and failed to update the dependencies:

ELM VERSION MISMATCH ----------------------------------------------- elm.json

Your elm.json says this application needs a different version of Elm.

It requires 0.19.0, but you are using 0.19.1 right now.

Here's the full output:

deedo@JOHANNES[±|master ↑1 ?:2 ✗]:~/projects/xr-room/xr-room-widget $ elm-upgrade --help
INFO: Found elm at /home/deedo/.nvm/versions/node/v10.13.0/bin/elm
INFO: Found elm 0.19.1
INFO: Found elm-format at /home/deedo/.nvm/versions/node/v10.13.0/bin/elm-format
INFO: Found elm-format 0.8.2
INFO: Cleaning ./elm-stuff before upgrading
INFO: Converting elm-package.json -> elm.json
INFO: Detected an application project (this project has no exposed modules)
WARNING: Zinggi/elm-obj-loader has not been upgraded to 0.19 yet!
INFO: Switching from elm-community/linear-algebra (deprecated) to elm-explorations/linear-algebra
INFO: Installing latest version of elm-explorations/linear-algebra
Here is my plan:

  Add:
    elm-explorations/linear-algebra    1.0.3

Would you like me to update your elm.json accordingly? [Y/n]: Y
-- ELM VERSION MISMATCH ----------------------------------------------- elm.json

Your elm.json says this application needs a different version of Elm.

It requires 0.19.0, but you are using 0.19.1 right now.

WARNING: Failed to upgrade elm-explorations/linear-algebra!
INFO: Switching from elm-community/webgl (deprecated) to elm-explorations/webgl
INFO: Installing latest version of elm-explorations/webgl
Here is my plan:

  Add:
    elm/html                  1.0.0
    elm/virtual-dom           1.0.2
    elm-explorations/webgl    1.1.1

Would you like me to update your elm.json accordingly? [Y/n]: Y
-- ELM VERSION MISMATCH ----------------------------------------------- elm.json

Your elm.json says this application needs a different version of Elm.

It requires 0.19.0, but you are using 0.19.1 right now.

WARNING: Failed to upgrade elm-explorations/webgl!
INFO: Switching from elm-lang/animation-frame (deprecated) to elm/browser
INFO: Installing latest version of elm/browser
Here is my plan:

  Add:
    elm/browser        1.0.2
    elm/html           1.0.0
    elm/time           1.0.0
    elm/url            1.0.0
    elm/virtual-dom    1.0.2

Would you like me to update your elm.json accordingly? [Y/n]: Y
-- ELM VERSION MISMATCH ----------------------------------------------- elm.json

Your elm.json says this application needs a different version of Elm.

It requires 0.19.0, but you are using 0.19.1 right now.

WARNING: Failed to upgrade elm/browser!
INFO: Switching from elm-lang/core (deprecated) to elm/core
INFO: Installing latest version of elm/core
It is already installed!
INFO: Detected use of elm-lang/core#Json.Decode; installing elm/json
I found it in your elm.json file, but in the "indirect" dependencies.
Should I move it into "direct" dependencies for more general use? [Y/n]: Y
-- ELM VERSION MISMATCH ----------------------------------------------- elm.json

Your elm.json says this application needs a different version of Elm.

It requires 0.19.0, but you are using 0.19.1 right now.

WARNING: Failed to upgrade elm/json!
INFO: Detected use of elm-lang/core#Random; installing elm/random
Here is my plan:

  Add:
    elm/random    1.0.0
    elm/time      1.0.0

Would you like me to update your elm.json accordingly? [Y/n]: Y
-- ELM VERSION MISMATCH ----------------------------------------------- elm.json

Your elm.json says this application needs a different version of Elm.

It requires 0.19.0, but you are using 0.19.1 right now.

WARNING: Failed to upgrade elm/random!
INFO: Detected use of elm-lang/core#Time; installing elm/time
Here is my plan:

  Add:
    elm/time    1.0.0

Would you like me to update your elm.json accordingly? [Y/n]: Y
-- ELM VERSION MISMATCH ----------------------------------------------- elm.json

Your elm.json says this application needs a different version of Elm.

It requires 0.19.0, but you are using 0.19.1 right now.

WARNING: Failed to upgrade elm/time!
INFO: Detected use of elm-lang/core#Regex; installing elm/regex
Here is my plan:

  Add:
    elm/regex    1.0.0

Would you like me to update your elm.json accordingly? [Y/n]: Y
-- ELM VERSION MISMATCH ----------------------------------------------- elm.json

Your elm.json says this application needs a different version of Elm.

It requires 0.19.0, but you are using 0.19.1 right now.

WARNING: Failed to upgrade elm/regex!
INFO: Switching from elm-lang/html (deprecated) to elm/html
INFO: Installing latest version of elm/html
Here is my plan:

  Add:
    elm/html           1.0.0
    elm/virtual-dom    1.0.2

Would you like me to update your elm.json accordingly? [Y/n]: Y
-- ELM VERSION MISMATCH ----------------------------------------------- elm.json

Your elm.json says this application needs a different version of Elm.

It requires 0.19.0, but you are using 0.19.1 right now.

WARNING: Failed to upgrade elm/html!
INFO: Switching from elm-lang/keyboard (deprecated) to elm/browser
INFO: Installing latest version of elm/browser
Here is my plan:

  Add:
    elm/browser        1.0.2
    elm/html           1.0.0
    elm/time           1.0.0
    elm/url            1.0.0
    elm/virtual-dom    1.0.2

Would you like me to update your elm.json accordingly? [Y/n]: Y
-- ELM VERSION MISMATCH ----------------------------------------------- elm.json

Your elm.json says this application needs a different version of Elm.

It requires 0.19.0, but you are using 0.19.1 right now.

WARNING: Failed to upgrade elm/browser!
INFO: Switching from elm-lang/mouse (deprecated) to elm/browser
INFO: Installing latest version of elm/browser
Here is my plan:

  Add:
    elm/browser        1.0.2
    elm/html           1.0.0
    elm/time           1.0.0
    elm/url            1.0.0
    elm/virtual-dom    1.0.2

Would you like me to update your elm.json accordingly? [Y/n]: Y
-- ELM VERSION MISMATCH ----------------------------------------------- elm.json

Your elm.json says this application needs a different version of Elm.

It requires 0.19.0, but you are using 0.19.1 right now.

WARNING: Failed to upgrade elm/browser!
INFO: Switching from elm-lang/window (deprecated) to elm/browser
INFO: Installing latest version of elm/browser
Here is my plan:

  Add:
    elm/browser        1.0.2
    elm/html           1.0.0
    elm/time           1.0.0
    elm/url            1.0.0
    elm/virtual-dom    1.0.2

Would you like me to update your elm.json accordingly? [Y/n]: Y
-- ELM VERSION MISMATCH ----------------------------------------------- elm.json

Your elm.json says this application needs a different version of Elm.

It requires 0.19.0, but you are using 0.19.1 right now.

WARNING: Failed to upgrade elm/browser!
INFO: Installing latest version of rtfeldman/elm-css
Here is my plan:

  Add:
    Skinney/murmur3       2.0.8
    elm/virtual-dom       1.0.2
    rtfeldman/elm-css    16.0.1
    rtfeldman/elm-hex     1.0.0

Would you like me to update your elm.json accordingly? [Y/n]: n
Okay, I did not change anything!
INFO: Upgrading *.elm files in ./
INFO: Upgrading *.elm files in ./src/

SUCCESS! Your project's dependencies and code have been upgraded.
However, your project may not yet compile due to API changes in your
dependencies.

See <https://github.com/elm/compiler/blob/master/upgrade-docs/0.19.md>
and the documentation for your dependencies for more information.

WARNING! 1 of your dependencies have not yet been upgraded to
support Elm 0.19.
  - https://github.com/Zinggi/elm-obj-loader

Here are some common upgrade steps that you will need to do manually:

- elm/browser
  - [ ] Change code using AnimationFrame.* to use Browser.Events.onAnimationFrame*
  - [ ] Change code using Window.* to use Browser.Events.onResize
- elm/core
  - [ ] Replace uses of toString with String.fromInt, String.fromFloat, or Debug.toString as appropriate
- undefined
  - [ ] Read the new documentation here: https://package.elm-lang.org/packages/elm/time/latest/
  - [ ] Replace uses of Date and Time with Time.Posix
- elm/html
  - [ ] If you used Html.program*, install elm/browser and switch to Browser.element or Browser.document
  - [ ] If you used Html.beginnerProgram, install elm/browser and switch Browser.sandbox
avh4 commented 4 years ago

Oh interesting, it seems like elm itself is complaining, and then Elm 0.19.1 refuses to compile projects that set elm-version to 0.19.0 <= v < 0.20.0 ?

avh4 commented 4 years ago

Oh, or maybe this only affects application projects which probably set a single Elm version instead of a range

avh4 commented 4 years ago

If the latter, the fix might be to just update https://github.com/avh4/elm-upgrade/blob/master/upgrade.js#L368 if someone's able to make a PR (or even better to set that based on the version reported by the elm binary that's found)

ChristophP commented 4 years ago

Ah yeah, setting it based on the elm version should it fix. I may be able to take a look over the weekend.

avh4 commented 4 years ago

Fixed in v0.19.7, thanks!