elm-lang / elm-package

Command line tool to share Elm libraries
BSD 3-Clause "New" or "Revised" License
213 stars 66 forks source link

solver: demanding future versions removes everything #116

Open rtfeldman opened 9 years ago

rtfeldman commented 9 years ago

To reproduce, start a new project with these dependencies:

    "dependencies": {
        "elm-lang/core": "2.1.0 <= v <= 2.1.0",
        "evancz/elm-html": "4.0.0 <= v <= 4.0.0"
    },

If you run elm package install, you get a fairly standard output:

$ elm package install
Some new packages are needed. Here is the upgrade plan.

  Install:
    elm-lang/core 2.1.0
    evancz/elm-html 4.0.0
    evancz/virtual-dom 2.0.0

Do you approve of this plan? (y/n) y
Downloading elm-lang/core
Downloading evancz/elm-html
Downloading evancz/virtual-dom
Packages configured successfully!

Now change the core version to a version that does not exist yet:

    "dependencies": {
        "elm-lang/core": "9.0.0 <= v <= 9.0.0",
        "evancz/elm-html": "4.0.0 <= v <= 4.0.0"
    },

Now it tries to remove everything:

$ elm package install
Some new packages are needed. Here is the upgrade plan.

  Remove:
    elm-lang/core
    evancz/elm-html
    evancz/virtual-dom

Do you approve of this plan? (y/n) y
Packages configured successfully!

...however, in practice it does not actually remove them:

$ ls -al elm-stuff/packages
total 0
drwxr-xr-x  4 rtfeldman  staff  136 Aug  4 14:43 .
drwxr-xr-x  4 rtfeldman  staff  136 Aug  4 14:42 ..
drwxr-xr-x  3 rtfeldman  staff  102 Aug  4 14:43 elm-lang
drwxr-xr-x  4 rtfeldman  staff  136 Aug  4 14:43 evancz

...but it does empty them out!

$ ls -al elm-stuff/packages/elm-lang/core/
total 0
drwxr-xr-x  2 rtfeldman  staff   68 Aug  4 14:45 .
drwxr-xr-x  3 rtfeldman  staff  102 Aug  4 14:43 ..

Expected behavior would be some sort of error explaining "there's no such version as 9.0.0" and aborting.

vito commented 8 years ago

Ran into this myself. That was quite confusing.

evancz commented 8 years ago

Still true in 0.17.1?

vito commented 8 years ago

Yep.

yigitozkavci commented 7 years ago

I have this issue right now. Currently, elm-package.json contains

"dependencies": {
     "elm-lang/core": "4.0.5 <= v < 5.0.0",
     "elm-lang/html": "1.1.0 <= v < 2.0.0",
     "elm-lang/navigation": "1.0.0 <= v < 2.0.0",
     "evancz/elm-http": "3.0.1 <= v < 4.0.0",
     "evancz/url-parser": "1.0.0 <= v < 2.0.0"
 },

and when modify it to have

elm-lang/navigation: "2.0.0 <= v < 3.0.0"

then type elm-package install, it's output is:

Some new packages are needed. Here is the upgrade plan.

  Remove:
    elm-lang/core
    elm-lang/dom
    elm-lang/html
    elm-lang/navigation
    elm-lang/virtual-dom
    evancz/elm-http
    evancz/url-parser

Versions:

elm 0.17.1
elm-package 0.17.1
francisdb commented 7 years ago

Still happens with 0.18.0

putting this in package.json

"elm-community/webgl": "3.0.3 <= v < 4.0.0"

makes elm-package install silently fail and leaves an empty 'elm-stuff' folder

(correct range at this time is "elm-community/webgl": "1.0.1 <= v < 2.0.0")