From c1fb9c343657dc74c7ccfe61c2dec4ea7727904c Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Sun, 1 Aug 2021 10:23:20 -0700 Subject: [PATCH] Remove obsolete argument. --- generator/src/SiteConfig.elm | 16 +++++++-------- .../src/generate-template-module-connector.js | 17 ++++++---------- src/Pages/Internal/Platform/Cli.elm | 20 ++++++------------- .../Internal/Platform/StaticResponses.elm | 2 +- src/Pages/ProgramConfig.elm | 2 +- src/Pages/SiteConfig.elm | 16 ++++++--------- 6 files changed, 27 insertions(+), 46 deletions(-) diff --git a/generator/src/SiteConfig.elm b/generator/src/SiteConfig.elm index f2db8d4f..4faf9960 100644 --- a/generator/src/SiteConfig.elm +++ b/generator/src/SiteConfig.elm @@ -7,12 +7,10 @@ import Route exposing (Route) type alias SiteConfig data = - List (Maybe Route) - -> - { data : DataSource data - , canonicalUrl : String - , manifest : data -> Pages.Manifest.Config - , head : - data - -> List Head.Tag - } + { data : DataSource data + , canonicalUrl : String + , manifest : data -> Pages.Manifest.Config + , head : + data + -> List Head.Tag + } diff --git a/generator/src/generate-template-module-connector.js b/generator/src/generate-template-module-connector.js index b2d8ed32..74e5bc32 100644 --- a/generator/src/generate-template-module-connector.js +++ b/generator/src/generate-template-module-connector.js @@ -633,17 +633,12 @@ pathsToGenerateHandler = manifestHandler : ApiRoute.ApiRoute ApiRoute.Response manifestHandler = ApiRoute.succeed - (getStaticRoutes - |> DataSource.map (List.map Just) - |> DataSource.andThen - (\\resolvedRoutes -> - Site.config resolvedRoutes - |> .data - |> DataSource.map - (\\data -> - (Site.config resolvedRoutes |> .manifest) data - |> manifestToFile (Site.config resolvedRoutes |> .canonicalUrl) - ) + (Site.config + |> .data + |> DataSource.map + (\\data -> + Site.config.manifest data + |> manifestToFile (Site.config.canonicalUrl) ) ) |> ApiRoute.literal "manifest.json" diff --git a/src/Pages/Internal/Platform/Cli.elm b/src/Pages/Internal/Platform/Cli.elm index 3e4f333a..f3dc3594 100644 --- a/src/Pages/Internal/Platform/Cli.elm +++ b/src/Pages/Internal/Platform/Cli.elm @@ -198,7 +198,7 @@ perform renderRequest config toJsPort effect = let canonicalSiteUrl : String canonicalSiteUrl = - config.site [] |> .canonicalUrl + config.site.canonicalUrl in case effect of Effect.NoEffect -> @@ -669,14 +669,10 @@ nextStepToEffect contentCache config model ( updatedStaticResponsesModel, nextSt case pageFoundResult of Ok Nothing -> let - allRoutes : List route - allRoutes = - [] - currentUrl : Url.Url currentUrl = { protocol = Url.Https - , host = config.site [] |> .canonicalUrl + , host = config.site.canonicalUrl , port_ = Nothing , path = payload.path |> Path.toRelative , query = Nothing @@ -755,7 +751,7 @@ nextStepToEffect contentCache config model ( updatedStaticResponsesModel, nextSt siteDataResult : Result BuildError siteData siteDataResult = StaticHttpRequest.resolve ApplicationType.Cli - (config.site allRoutes |> .data) + config.site.data (staticData |> Dict.map (\_ v -> Just v)) |> Result.mapError (StaticHttpRequest.toBuildError "Site.elm") in @@ -829,10 +825,6 @@ sendSinglePageProgress contentJson config model = model.allRawResponses |> Result.mapError (StaticHttpRequest.toBuildError currentUrl.path) - allRoutes : List route - allRoutes = - [] - renderedResult : Result BuildError { head : List Head.Tag, view : String, title : String } renderedResult = case includeHtml of @@ -880,7 +872,7 @@ sendSinglePageProgress contentJson config model = currentUrl : Url.Url currentUrl = { protocol = Url.Https - , host = config.site allRoutes |> .canonicalUrl + , host = config.site.canonicalUrl , port_ = Nothing , path = page |> Path.toRelative , query = Nothing @@ -908,7 +900,7 @@ sendSinglePageProgress contentJson config model = siteDataResult : Result BuildError siteData siteDataResult = StaticHttpRequest.resolve ApplicationType.Cli - (config.site allRoutes |> .data) + config.site.data (contentJson |> Dict.map (\_ v -> Just v)) |> Result.mapError (StaticHttpRequest.toBuildError "Site.elm") in @@ -920,7 +912,7 @@ sendSinglePageProgress contentJson config model = , contentJson = contentJson , html = rendered.view , errors = [] - , head = rendered.head ++ (config.site allRoutes |> .head) siteData + , head = rendered.head ++ config.site.head siteData , title = rendered.title , staticHttpCache = model.allRawResponses |> Dict.Extra.filterMap (\_ v -> v) , is404 = False diff --git a/src/Pages/Internal/Platform/StaticResponses.elm b/src/Pages/Internal/Platform/StaticResponses.elm index f4f5f518..df0e865f 100644 --- a/src/Pages/Internal/Platform/StaticResponses.elm +++ b/src/Pages/Internal/Platform/StaticResponses.elm @@ -189,7 +189,7 @@ nextStep : , routeToPath : route -> List String , data : route -> DataSource pageData , sharedData : DataSource sharedData - , site : SiteConfig route siteData + , site : SiteConfig siteData , apiRoutes : (Html Never -> String) -> List (ApiRoute.ApiRoute ApiRoute.Response) } -> diff --git a/src/Pages/ProgramConfig.elm b/src/Pages/ProgramConfig.elm index 4b185ab4..8ed22dd4 100644 --- a/src/Pages/ProgramConfig.elm +++ b/src/Pages/ProgramConfig.elm @@ -52,7 +52,7 @@ type alias ProgramConfig userMsg userModel route siteData pageData sharedData = , getStaticRoutes : DataSource.DataSource (List route) , urlToRoute : Url -> route , routeToPath : route -> List String - , site : SiteConfig route siteData + , site : SiteConfig siteData , toJsPort : Json.Encode.Value -> Cmd Never , fromJsPort : Sub Decode.Value , onPageChange : diff --git a/src/Pages/SiteConfig.elm b/src/Pages/SiteConfig.elm index 946ff200..7325a2cf 100644 --- a/src/Pages/SiteConfig.elm +++ b/src/Pages/SiteConfig.elm @@ -5,13 +5,9 @@ import Head import Pages.Manifest -type alias SiteConfig route data = - List route - -> - { data : DataSource data - , canonicalUrl : String - , manifest : data -> Pages.Manifest.Config - , head : - data - -> List Head.Tag - } +type alias SiteConfig data = + { data : DataSource data + , canonicalUrl : String + , manifest : data -> Pages.Manifest.Config + , head : data -> List Head.Tag + }