on master help sign in
allow elm/json to be in "indirect" deps and make error message better
9b91289Evan Czaplicki
builder/src/Elm/Outline.hs+7−3
@@ -184,9 +184,13 @@ read root =
184 then Left Exit.OutlineNoPkgCore
184 then Left Exit.OutlineNoPkgCore
185 else Right outline
185 else Right outline
186
186
187− App (AppOutline _ srcDirs deps _ _ _)
187+ App (AppOutline _ srcDirs direct indirect _ _)
188+ | Map.notMember Pkg.core direct ->
188− | Map.notMember Pkg.core deps -> return $ Left Exit.OutlineNoAppCore
189+ return $ Left Exit.OutlineNoAppCore
190+
191+ | Map.notMember Pkg.json direct && Map.notMember Pkg.json indirect ->
189− | Map.notMember Pkg.json deps -> return $ Left Exit.OutlineNoAppJson
192+ return $ Left Exit.OutlineNoAppJson
193+
190 | otherwise ->
194 | otherwise ->
191 do badDirs <- filterM (isBadSrcDir root) (NE.toList srcDirs)
195 do badDirs <- filterM (isBadSrcDir root) (NE.toList srcDirs)
192 case badDirs of
196 case badDirs of
builder/src/Reporting/Exit.hs+18−9
@@ -1009,23 +1009,32 @@ toOutlineReport problem =
1009
1009
1010 OutlineNoPkgCore ->
1010 OutlineNoPkgCore ->
1011 Help.report "MISSING DEPENDENCY" (Just "elm.json")
1011 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:"
1012+ "I need to see an \"elm/core\" dependency your elm.json file. The default imports\
1013− [ D.indent 4 $ D.green $ "elm install elm/core"
1013+ \ of `List` and `Maybe` do not work without it."
1014− , D.reflow "I need it for the default imports that make `List` and `Maybe` available."
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."
1015 ]
1018 ]
1016
1019
1017 OutlineNoAppCore ->
1020 OutlineNoAppCore ->
1018 Help.report "MISSING DEPENDENCY" (Just "elm.json")
1021 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:"
1022+ "I need to see an \"elm/core\" dependency your elm.json file. The default imports\
1020− [ D.indent 4 $ D.green $ "elm install elm/core"
1023+ \ of `List` and `Maybe` do not work without it."
1021− , D.reflow "It has some supporting code that is needed by every Elm application!"
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."
1022 ]
1028 ]
1023
1029
1024 OutlineNoAppJson ->
1030 OutlineNoAppJson ->
1025 Help.report "MISSING DEPENDENCY" (Just "elm.json")
1031 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:"
1032+ "I need to see an \"elm/json\" dependency your elm.json file. It helps me handle\
1027− [ D.indent 4 $ D.green $ "elm install elm/json"
1028− , D.reflow "It helps me handle flags and ports."
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."
1029 ]
1038 ]
1030
1039
1031
1040