Add helper to parse elm.json files

This commit is contained in:
Jeroen Engels 2023-04-10 11:39:07 +02:00
parent 6019524a87
commit 084b8d3860

View File

@ -343,10 +343,7 @@ runWithOptions rule project buildOptions =
applicationElmJson : String -> { path : String, raw : String, project : Elm.Project.Project }
applicationElmJson depsDirectString =
let
raw : String
raw =
"""{
parseElmJson ("""{
"type": "application",
"source-directories": [
"src"
@ -363,8 +360,11 @@ applicationElmJson depsDirectString =
"indirect": {}
}
}
"""
in
""")
parseElmJson : String -> { path : String, raw : String, project : Elm.Project.Project }
parseElmJson raw =
case Decode.decodeString Elm.Project.decoder raw of
Ok project ->
{ path = "elm.json"