on master help sign in
Stop making elm.json files behind the scenes
8873a73Evan Czaplicki
builder/src/Elm/Project/Root.hs−34
@@ -59,43 +59,9 @@ moveToRoot =
59 do liftIO $ Dir.setCurrentDirectory root
59 do liftIO $ Dir.setCurrentDirectory root
60 return root
60 return root
61
61
62− Nothing ->
63− do addElmJson
64− Task.report Progress.ElmJsonAdded
65− liftIO $ Dir.getCurrentDirectory
66−
67−
68−addElmJson :: Task.Task ()
69−addElmJson =
70− do registry <- Cache.optionalUpdate
71− maybeSolution <- Explorer.run registry $ Solver.run $
72− msum $ map Solver.solve $
73− [ defaultDependencies
74− , Map.singleton Pkg.core Con.anything
75− ]
76− case maybeSolution of
77 Nothing ->
62 Nothing ->
78 Task.throw Exit.NoElmJson
63 Task.throw Exit.NoElmJson
79
64
80− Just solution ->
81− liftIO $ Encode.write "elm.json" $ Project.encode $ Project.App $
82− Project.AppInfo
83− Elm.version
84− ["src"]
85− (Map.intersection solution defaultDependencies)
86− Map.empty
87− (Map.difference solution defaultDependencies)
88−
89−
90−defaultDependencies :: Map.Map Pkg.Name Con.Constraint
91−defaultDependencies =
92− Map.fromList
93− [ (Pkg.browser, Con.anything)
94− , (Pkg.core, Con.anything)
95− , (Pkg.html, Con.anything)
96− , (Pkg.json, Con.anything)
97− ]
98−
99
65
100
66
101-- GET WITH FALLBACK
67-- GET WITH FALLBACK
builder/src/Reporting/Progress.hs+1−4
@@ -70,11 +70,8 @@ data Msg
70
70
71
71
72data Progress
72data Progress
73− -- elm.json
74− = ElmJsonAdded
75−
76 -- download packages
73 -- download packages
77− | DownloadSkip
74+ = DownloadSkip
78 | DownloadStart [(Name, Version)]
75 | DownloadStart [(Name, Version)]
79 | DownloadPkgStart Name Version
76 | DownloadPkgStart Name Version
80 | DownloadPkgEnd Name Version Outcome
77 | DownloadPkgEnd Name Version Outcome
builder/src/Reporting/Progress/Terminal.hs−13
@@ -90,19 +90,6 @@ loopHelp chan progress state@(State total good bad) =
90 case progress of
90 case progress of
91
91
92
92
93− -- ELM.JSON
94−
95− ElmJsonAdded ->
96− do Help.toStdout $ D.black $ D.vcat $ map D.fromString $
97− [ "--------------------------------------------------------------------------------"
98− , " Looks like you are starting a new Elm project, so I added an elm.json file."
99− , " Read " ++ D.makeLink "get-started" ++ " for tips on what to do next!"
100− , "--------------------------------------------------------------------------------"
101− ]
102− putStrLn ""
103− loop chan state
104−
105−
106 -- DOWNLOADS
93 -- DOWNLOADS
107
94
108 DownloadSkip ->
95 DownloadSkip ->