on master help sign in
allow elm/json to be in "indirect" deps and make error message better
commit9b912896b16afa4d78b9fbeffcf3b7bc0a3acee1 authorEvan Czaplicki <evancz@users.noreply.github.com> dateFri 5 Jul 2019, 15:01 (7 years ago) parent5e73421
2 files changed+25−12
builder/src/Elm/Outline.hs+7−3 builder/src/Reporting/Exit.hs+18−9
builder/src/Elm/Outline.hs+7−3
@@ -184,9 +184,13 @@ read root =
184184 then Left Exit.OutlineNoPkgCore
185185 else Right outline
186186
187− App (AppOutline _ srcDirs deps _ _ _)
188− | Map.notMember Pkg.core deps -> return $ Left Exit.OutlineNoAppCore
189− | Map.notMember Pkg.json deps -> return $ Left Exit.OutlineNoAppJson
187+ App (AppOutline _ srcDirs direct indirect _ _)
188+ | Map.notMember Pkg.core direct ->
189+ return $ Left Exit.OutlineNoAppCore
190+
191+ | Map.notMember Pkg.json direct && Map.notMember Pkg.json indirect ->
192+ return $ Left Exit.OutlineNoAppJson
193+
190194 | otherwise ->
191195 do badDirs <- filterM (isBadSrcDir root) (NE.toList srcDirs)
192196 case badDirs of
builder/src/Reporting/Exit.hs+18−9
@@ -1009,23 +1009,32 @@ toOutlineReport problem =
10091009
10101010 OutlineNoPkgCore ->
10111011 Help.report "MISSING DEPENDENCY" (Just "elm.json")
1012− "I need a valid elm.json file, so I need to see an \"elm/core\" dependency in there. Try running:"
1013− [ D.indent 4 $ D.green $ "elm install elm/core"
1014− , D.reflow "I need it for the default imports that make `List` and `Maybe` available."
1012+ "I need to see an \"elm/core\" dependency your elm.json file. The default imports\
1013+ \ of `List` and `Maybe` do not work without it."
1014+ [ D.reflow $
1015+ "If you modified your elm.json by hand, try to change it back! And if you are\
1016+ \ having trouble getting back to a working elm.json, it may be easier to find a\
1017+ \ working package and start fresh with their elm.json file."
10151018 ]
10161019
10171020 OutlineNoAppCore ->
10181021 Help.report "MISSING DEPENDENCY" (Just "elm.json")
1019− "I need a valid elm.json file, so I need to see an \"elm/core\" dependency in there. Try running:"
1020− [ D.indent 4 $ D.green $ "elm install elm/core"
1021− , D.reflow "It has some supporting code that is needed by every Elm application!"
1022+ "I need to see an \"elm/core\" dependency your elm.json file. The default imports\
1023+ \ of `List` and `Maybe` do not work without it."
1024+ [ D.reflow $
1025+ "If you modified your elm.json by hand, try to change it back! And if you are\
1026+ \ having trouble getting back to a working elm.json, it may be easier to delete it\
1027+ \ and use `elm init` to start fresh."
10221028 ]
10231029
10241030 OutlineNoAppJson ->
10251031 Help.report "MISSING DEPENDENCY" (Just "elm.json")
1026− "I need a valid elm.json file, so I need to see an \"elm/json\" dependency in there. Try running:"
1027− [ D.indent 4 $ D.green $ "elm install elm/json"
1028− , D.reflow "It helps me handle flags and ports."
1032+ "I need to see an \"elm/json\" dependency your elm.json file. It helps me handle\
1033+ \ flags and ports."
1034+ [ D.reflow $
1035+ "If you modified your elm.json by hand, try to change it back! And if you are\
1036+ \ having trouble getting back to a working elm.json, it may be easier to delete it\
1037+ \ and use `elm init` to start fresh."
10291038 ]
10301039
10311040