zwilias / elm-json

Install, upgrade and uninstall Elm dependencies
MIT License
183 stars 9 forks source link

elm-json upgrade copies elm-explorations/test from test-dependencies to dependencies #27

Closed sentience closed 4 years ago

sentience commented 4 years ago

Initial elm.json:

{
    "type": "application",
    "source-directories": [
        ".",
        "../ca-three-sixty-common",
        "../../../../lib/client/modules/ca-ui",
        "../../../../lib/client/modules/ca-utils",
        "../../../../node_modules/elm-upgrade-shims/lib-0.19",
        "../../../../node_modules/@kaizen/component-library/components"
    ],
    "elm-version": "0.19.1",
    "dependencies": {
        "direct": {
            "CurrySoftware/elm-datepicker": "4.0.0",
            "NoRedInk/elm-json-decode-pipeline": "1.0.0",
            "cultureamp/elm-css-modules-loader": "2.0.10",
            "danyx23/elm-uuid": "2.1.2",
            "elm/browser": "1.0.2",
            "elm/core": "1.0.5",
            "elm/html": "1.0.0",
            "elm/http": "1.0.0",
            "elm/json": "1.1.3",
            "elm/random": "1.0.0",
            "elm/svg": "1.0.1",
            "elm/time": "1.0.0",
            "elm/url": "1.0.0",
            "elm-community/dict-extra": "2.4.0",
            "elm-community/easing-functions": "2.0.0",
            "elm-community/html-extra": "3.4.0",
            "elm-community/json-extra": "4.2.0",
            "elm-community/list-extra": "8.2.4",
            "elm-community/maybe-extra": "5.2.0",
            "elm-community/string-extra": "4.0.1",
            "elm-community/typed-svg": "6.0.0",
            "fapian/elm-html-aria": "1.4.0",
            "jamesmacaulay/elm-graphql": "2.0.0",
            "justinmimbs/date": "3.2.0",
            "justinmimbs/time-extra": "1.1.0",
            "krisajenkins/remotedata": "5.0.0",
            "mdgriffith/elm-style-animation": "4.0.0",
            "rtfeldman/elm-iso8601-date-strings": "1.1.3",
            "truqu/elm-dictset": "2.1.0",
            "y0hy0h/ordered-containers": "1.0.0"
        },
        "indirect": {
            "avh4/elm-color": "1.0.0",
            "elm/parser": "1.1.0",
            "elm/regex": "1.0.0",
            "elm/virtual-dom": "1.0.2"
        }
    },
    "test-dependencies": {
        "direct": {
            "elm-explorations/test": "1.2.2"
        },
        "indirect": {}
    }
}

Ran yarn elm-json upgrade --yes ./path/to/elm.json.

Console output:

-- PACKAGE UPGRADES FOUND ------------------------------------------------------

I want to make some changes to your direct dependencies

- [CHG] justinmimbs/date 3.2.0 -> 3.2.1

I want to make some changes to your indirect dependencies

- [ADD] elm-explorations/test 1.2.2

Saved updated elm.json!

Resulting elm.json:

{
    "type": "application",
    "source-directories": [
        ".",
        "../ca-three-sixty-common",
        "../../../../lib/client/modules/ca-ui",
        "../../../../lib/client/modules/ca-utils",
        "../../../../node_modules/elm-upgrade-shims/lib-0.19",
        "../../../../node_modules/@kaizen/component-library/components"
    ],
    "elm-version": "0.19.1",
    "dependencies": {
        "direct": {
            "CurrySoftware/elm-datepicker": "4.0.0",
            "NoRedInk/elm-json-decode-pipeline": "1.0.0",
            "cultureamp/elm-css-modules-loader": "2.0.10",
            "danyx23/elm-uuid": "2.1.2",
            "elm/browser": "1.0.2",
            "elm/core": "1.0.5",
            "elm/html": "1.0.0",
            "elm/http": "1.0.0",
            "elm/json": "1.1.3",
            "elm/random": "1.0.0",
            "elm/svg": "1.0.1",
            "elm/time": "1.0.0",
            "elm/url": "1.0.0",
            "elm-community/dict-extra": "2.4.0",
            "elm-community/easing-functions": "2.0.0",
            "elm-community/html-extra": "3.4.0",
            "elm-community/json-extra": "4.2.0",
            "elm-community/list-extra": "8.2.4",
            "elm-community/maybe-extra": "5.2.0",
            "elm-community/string-extra": "4.0.1",
            "elm-community/typed-svg": "6.0.0",
            "fapian/elm-html-aria": "1.4.0",
            "jamesmacaulay/elm-graphql": "2.0.0",
            "justinmimbs/date": "3.2.1",
            "justinmimbs/time-extra": "1.1.0",
            "krisajenkins/remotedata": "5.0.0",
            "mdgriffith/elm-style-animation": "4.0.0",
            "rtfeldman/elm-iso8601-date-strings": "1.1.3",
            "truqu/elm-dictset": "2.1.0",
            "y0hy0h/ordered-containers": "1.0.0"
        },
        "indirect": {
            "avh4/elm-color": "1.0.0",
            "elm/parser": "1.1.0",
            "elm/regex": "1.0.0",
            "elm/virtual-dom": "1.0.2",
            "elm-explorations/test": "1.2.2"
        }
    },
    "test-dependencies": {
        "direct": {
            "elm-explorations/test": "1.2.2"
        },
        "indirect": {}
    }
}

We've been seeing this consistently with elm-json 0.2.6, and we're still seeing it with 0.2.7.

sentience commented 4 years ago

Our work-around for this for now is to manually edit elm.json to remove elm-explorations/test from our indirect dependencies after running elm.json.

jfmengels commented 4 years ago

Hey @sentience :wave:

This looks normal to me. y0hy0h/ordered-containers v1.0.0 depends on elm-explorations/test, which means that your project indirectly depends on elm-explorations/test, which warrants it being (also) in the indirect dependencies.

You didn't explicit why you were removing it manually, but I am guessing it is because elm-test will crash? If so, I already raised this issue here where @zwilias responded (correctly in my opinion) that the "one at fault" is elm-test. If you tried bumping the dependencies yourself with elm install, then you'd have that indirect dependency too. I have since then raised the issue over at rtfeldman/node-test-runner (https://github.com/rtfeldman/node-test-runner/issues/423) but I haven't had the chance to try and solve the issue.

Another workaround would be for you to upgrade y0hy0h/ordered-containers to v2, where it does not depend on elm-explorations/test anymore.

zwilias commented 4 years ago

Great bug report, thank you so much!

What @jfmengels mentioned above is a pretty good summary of the current state. Having the dependency "twice" is technically correct. The incompatibility this causes with elm-test is a shame, but I've made the decision not to work around bugs in non-core tools. Since elm has the same behaviour as elm-json, here, I feel like mirroring what elm does in this situation is the better way forward.

Hope you managed to get around it by upgrading your dependency, tho! :)