Set module name

This commit is contained in:
Jeroen Engels 2021-03-12 00:06:24 +01:00
parent ef8eb61f61
commit 2c596edd59

View File

@ -12,6 +12,7 @@ import Html.Attributes exposing (form, type_)
import Json.Decode as Decode import Json.Decode as Decode
import Review.Project exposing (elmJson) import Review.Project exposing (elmJson)
import Review.Project.Dependency as Dependency exposing (Dependency) import Review.Project.Dependency as Dependency exposing (Dependency)
import String
type alias Flags = type alias Flags =
@ -160,6 +161,10 @@ formatDep ( name, constraint ) =
"( unsafePackageName " ++ stringify (Elm.Package.toString name) ++ ", unsafeConstraint " ++ stringify (Elm.Constraint.toString constraint) ++ ")" "( unsafePackageName " ++ stringify (Elm.Package.toString name) ++ ", unsafeConstraint " ++ stringify (Elm.Constraint.toString constraint) ++ ")"
capitalize s =
String.toUpper (String.left 1 s) ++ String.dropLeft 1 s
formatFile : Elm.Project.PackageInfo -> List Elm.Docs.Module -> String formatFile : Elm.Project.PackageInfo -> List Elm.Docs.Module -> String
formatFile elmJson docsJson = formatFile elmJson docsJson =
let let
@ -177,7 +182,14 @@ formatFile elmJson docsJson =
"Elm.Project.ExposedDict [ " ++ String.join ", " (List.map (\( section, list ) -> "( \"" ++ section ++ "\", " ++ listOfModuleNames list ++ " ) ") dict) ++ " ]" "Elm.Project.ExposedDict [ " ++ String.join ", " (List.map (\( section, list ) -> "( \"" ++ section ++ "\", " ++ listOfModuleNames list ++ " ) ") dict) ++ " ]"
moduleName = moduleName =
"Hello" "Review.Test.Dependencies."
++ (elmJson.name
|> Elm.Package.toString
|> String.replace "/" "-"
|> String.split "-"
|> List.map capitalize
|> String.join ""
)
dependencyModules = dependencyModules =
listOfThings formatModule docsJson listOfThings formatModule docsJson