Update test projects.

This commit is contained in:
Dillon Kearns 2022-03-09 10:33:33 -08:00
parent 8c87da2d04
commit aa98e1b914
29 changed files with 135 additions and 113 deletions

View File

@ -123,7 +123,7 @@ type alias RouteParams = { name : String }
route : StatelessRoute RouteParams Data
route =
Page.preRender
RouteBuilder.preRender
{ head = head
, pages = pages
, data = data

View File

@ -1,4 +1,4 @@
module Page.Escaping exposing (Data, Model, Msg, page)
module Route.Escaping exposing (Data, Model, Msg, route)
import Css exposing (..)
import Css.Global
@ -9,9 +9,9 @@ import Head.Seo as Seo
import Html.Styled as Html exposing (..)
import Html.Styled.Attributes as Attr
import Html.Styled.Lazy as HtmlLazy
import RouteBuilder exposing (StatelessRoute, StatefulRoute, StaticPayload)
import Pages.PageUrl exposing (PageUrl)
import Pages.Url
import RouteBuilder exposing (StatefulRoute, StatelessRoute, StaticPayload)
import Shared
import View exposing (View)
@ -21,15 +21,15 @@ type alias Model =
type alias Msg =
Never
()
type alias RouteParams =
{}
page : StatelessRoute RouteParams Data
page =
route : StatelessRoute RouteParams Data
route =
RouteBuilder.single
{ head = head
, data = data

View File

@ -1,4 +1,4 @@
module Page.Index exposing (Data, Model, Msg, page)
module Route.Index exposing (Data, Model, Msg, route)
import DataSource exposing (DataSource)
import DataSource.File
@ -6,9 +6,9 @@ import Head
import Head.Seo as Seo
import Html.Styled as Html exposing (text)
import Html.Styled.Attributes as Attr
import RouteBuilder exposing (StatelessRoute, StatefulRoute, StaticPayload)
import Pages.PageUrl exposing (PageUrl)
import Pages.Url
import RouteBuilder exposing (StatefulRoute, StatelessRoute, StaticPayload)
import Shared
import View exposing (View)
@ -18,15 +18,15 @@ type alias Model =
type alias Msg =
Never
()
type alias RouteParams =
{}
page : StatelessRoute RouteParams Data
page =
route : StatelessRoute RouteParams Data
route =
RouteBuilder.single
{ head = head
, data = data
@ -73,5 +73,5 @@ view maybeUrl sharedModel static =
, body =
[ text "This is the index page."
, Html.div [] [ Html.a [ Attr.href "/escaping" ] [ text "Escaping Page" ] ]
]
]
}

View File

@ -1,6 +1,7 @@
{
"type": "application",
"source-directories": [
"app",
"src",
"../../src",
".elm-pages",
@ -11,36 +12,41 @@
"direct": {
"MartinSStewart/elm-serialize": "1.2.5",
"avh4/elm-color": "1.0.0",
"danfishgold/base64-bytes": "1.1.0",
"danyx23/elm-mimetype": "4.0.1",
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
"dillonkearns/elm-markdown": "6.0.1",
"elm/browser": "1.0.2",
"elm/bytes": "1.0.8",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"elm/http": "2.0.0",
"elm/json": "1.1.3",
"elm/parser": "1.1.0",
"elm/regex": "1.0.0",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.2",
"elm-community/dict-extra": "2.4.0",
"elm-community/list-extra": "8.3.0",
"jluckyiv/elm-utc-date-strings": "1.0.0",
"lamdera/codecs": "1.0.0",
"lamdera/core": "1.0.0",
"matheus23/elm-default-tailwind-modules": "2.0.1",
"miniBill/elm-codec": "2.0.0",
"noahzgordon/elm-color-extra": "1.0.2",
"pablohirafuji/elm-syntax-highlight": "3.4.0",
"robinheghan/fnv1a": "1.0.0",
"robinheghan/murmur3": "1.0.0",
"rtfeldman/elm-css": "16.1.1",
"tripokey/elm-fuzzy": "5.2.1",
"turboMaCk/non-empty-list-alias": "1.2.0",
"vito/elm-ansi": "10.0.1",
"zwilias/json-decode-exploration": "6.0.0"
},
"indirect": {
"bburdette/toop": "1.0.1",
"danfishgold/base64-bytes": "1.1.0",
"elm/bytes": "1.0.8",
"elm/file": "1.0.5",
"elm/parser": "1.1.0",
"elm/random": "1.0.0",
"fredcy/elm-parseint": "2.0.1",
"mgold/elm-nonempty-list": "4.2.0",

View File

@ -20,23 +20,28 @@
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"chokidar": "3.5.2",
"busboy": "^1.0.0",
"chokidar": "^3.5.3",
"commander": "8.3.0",
"connect": "^3.7.0",
"cookie-signature": "^1.1.0",
"cross-spawn": "7.0.3",
"devcert": "^1.2.0",
"elm-doc-preview": "^5.0.5",
"elm-hot": "^1.1.6",
"esbuild": "^0.14.23",
"fs-extra": "^10.0.0",
"globby": "11.0.4",
"gray-matter": "^4.0.3",
"jsesc": "^3.0.2",
"kleur": "^4.1.4",
"memfs": "^3.4.1",
"micromatch": "^4.0.4",
"node-fetch": "^2.6.7",
"object-hash": "^2.2.0",
"serve-static": "^1.14.1",
"terser": "^5.7.2",
"undici": "^4.4.7",
"terser": "^5.11.0",
"vite": "^2.8.4",
"which": "^2.0.2"
},
"bin": {
@ -48,12 +53,12 @@
"@types/micromatch": "^4.0.2",
"@types/node": "12.20.12",
"@types/serve-static": "1.13.10",
"cypress": "^8.3.0",
"cypress": "^9.5.0",
"elm-optimize-level-2": "^0.1.5",
"elm-review": "^2.5.3",
"elm-review": "^2.7.0",
"elm-test": "^0.19.1-revision7",
"elm-tooling": "^1.3.0",
"elm-verify-examples": "^5.0.0",
"elm-verify-examples": "^5.2.0",
"elmi-to-json": "^1.2.0",
"mocha": "^9.1.0",
"typescript": "4.3.5"
@ -1493,32 +1498,37 @@
"@types/micromatch": "^4.0.2",
"@types/node": "12.20.12",
"@types/serve-static": "1.13.10",
"chokidar": "3.5.2",
"busboy": "^1.0.0",
"chokidar": "^3.5.3",
"commander": "8.3.0",
"connect": "^3.7.0",
"cookie-signature": "^1.1.0",
"cross-spawn": "7.0.3",
"cypress": "^8.3.0",
"cypress": "^9.5.0",
"devcert": "^1.2.0",
"elm-doc-preview": "^5.0.5",
"elm-hot": "^1.1.6",
"elm-optimize-level-2": "^0.1.5",
"elm-review": "^2.5.3",
"elm-review": "^2.7.0",
"elm-test": "^0.19.1-revision7",
"elm-tooling": "^1.3.0",
"elm-verify-examples": "^5.0.0",
"elm-verify-examples": "^5.2.0",
"elmi-to-json": "^1.2.0",
"esbuild": "^0.14.23",
"fs-extra": "^10.0.0",
"globby": "11.0.4",
"gray-matter": "^4.0.3",
"jsesc": "^3.0.2",
"kleur": "^4.1.4",
"memfs": "^3.4.1",
"micromatch": "^4.0.4",
"mocha": "^9.1.0",
"node-fetch": "^2.6.7",
"object-hash": "^2.2.0",
"serve-static": "^1.14.1",
"terser": "^5.7.2",
"terser": "^5.11.0",
"typescript": "4.3.5",
"undici": "^4.4.7",
"vite": "^2.8.4",
"which": "^2.0.2"
},
"dependencies": {

View File

@ -2,12 +2,8 @@ module Api exposing (routes)
import ApiRoute
import DataSource exposing (DataSource)
import DataSource.Http
import Html exposing (Html)
import Json.Encode
import OptimizedDecoder as Decode
import Route exposing (Route)
import Secrets
routes :

View File

@ -1,19 +1,14 @@
module Shared exposing (Data, Model, Msg(..), SharedMsg(..), template)
import Browser.Navigation
import Css.Global
import DataSource
import DataSource.Http
import Html exposing (Html)
import Html.Styled
import OptimizedDecoder as D
import Pages.Flags
import Pages.PageUrl exposing (PageUrl)
import Path exposing (Path)
import Route exposing (Route)
import Secrets
import SharedTemplate exposing (SharedTemplate)
import Tailwind.Utilities
import View exposing (View)

View File

@ -1,7 +1,7 @@
module Site exposing (config)
import Cloudinary
import DataSource
import DataSource exposing (DataSource)
import Head
import MimeType
import Pages.Manifest as Manifest
@ -10,11 +10,9 @@ import Route exposing (Route)
import SiteConfig exposing (SiteConfig)
config : SiteConfig Data
config : SiteConfig
config =
{ data = data
, canonicalUrl = canonicalUrl
, manifest = manifest
{ canonicalUrl = canonicalUrl
, head = head
}
@ -31,14 +29,15 @@ data =
(DataSource.succeed "site-name")
head : Data -> List Head.Tag
head static =
head : DataSource (List Head.Tag)
head =
[ Head.icon [ ( 32, 32 ) ] MimeType.Png (cloudinaryIcon MimeType.Png 32)
, Head.icon [ ( 16, 16 ) ] MimeType.Png (cloudinaryIcon MimeType.Png 16)
, Head.appleTouchIcon (Just 180) (cloudinaryIcon MimeType.Png 180)
, Head.appleTouchIcon (Just 192) (cloudinaryIcon MimeType.Png 192)
, Head.sitemapLink "/sitemap.xml"
]
|> DataSource.succeed
canonicalUrl : String

View File

@ -1,12 +1,12 @@
module Page.Cats.Name__ exposing (Data, Model, Msg, page)
module Route.Cats.Name__ exposing (Data, Model, Msg, route)
import DataSource
import Head
import Head.Seo as Seo
import Html.Styled exposing (text)
import RouteBuilder exposing (StatelessRoute, StatefulRoute, StaticPayload)
import Pages.PageUrl exposing (PageUrl)
import Pages.Url
import RouteBuilder exposing (StatefulRoute, StatelessRoute, StaticPayload)
import Shared
import View exposing (View)
@ -16,16 +16,16 @@ type alias Model =
type alias Msg =
Never
()
type alias RouteParams =
{ name : Maybe String }
page : StatelessRoute RouteParams Data
page =
Page.preRender
route : StatelessRoute RouteParams Data
route =
RouteBuilder.preRender
{ head = head
, pages = pages
, data = data

View File

@ -1,4 +1,4 @@
module Page.Date.SPLAT_ exposing (Data, Model, Msg, page)
module Route.Date.SPLAT_ exposing (Data, Model, Msg, route)
import DataSource
import Head
@ -14,16 +14,16 @@ type alias Model =
type alias Msg =
Never
()
type alias RouteParams =
{ splat : ( String, List String ) }
page : StatelessRoute RouteParams Data
page =
Page.preRender
route : StatelessRoute RouteParams Data
route =
RouteBuilder.preRender
{ head = head
, pages = pages
, data = data

View File

@ -1,10 +1,10 @@
module Page.SPLAT__ exposing (Data, Model, Msg, page)
module Route.SPLAT__ exposing (Data, Model, Msg, route)
import DataSource
import Head
import Html.Styled exposing (text)
import RouteBuilder exposing (StatelessRoute, StatefulRoute, StaticPayload)
import Pages.PageUrl exposing (PageUrl)
import RouteBuilder exposing (StatefulRoute, StatelessRoute, StaticPayload)
import Shared
import View exposing (View)
@ -14,16 +14,16 @@ type alias Model =
type alias Msg =
Never
()
type alias RouteParams =
{ splat : List String }
page : StatelessRoute RouteParams Data
page =
Page.preRender
route : StatelessRoute RouteParams Data
route =
RouteBuilder.preRender
{ head = head
, pages = DataSource.succeed []
, data = data

View File

@ -1,4 +1,4 @@
module Page.Slide exposing (Data, Model, Msg, page)
module Route.Slide exposing (Data, Model, Msg, route)
import DataSource
import Head
@ -15,15 +15,15 @@ type alias Model =
type alias Msg =
Never
()
type alias RouteParams =
{}
page : StatelessRoute RouteParams Data
page =
route : StatelessRoute RouteParams Data
route =
RouteBuilder.single
{ head = head
, data = DataSource.succeed {}

View File

@ -1,4 +1,4 @@
module Page.Slide.Number_ exposing (Data, Model, Msg, page)
module Route.Slide.Number_ exposing (Data, Model, Msg, route)
import Browser.Events
import Browser.Navigation
@ -13,10 +13,9 @@ import Markdown.Block
import Markdown.Parser
import Markdown.Renderer
import MarkdownRenderer
import OptimizedDecoder
import RouteBuilder exposing (Page, StaticPayload)
import Pages.PageUrl exposing (PageUrl)
import Pages.Url
import RouteBuilder exposing (StatefulRoute, StaticPayload)
import Shared
import Tailwind.Utilities as Tw
import View exposing (View)
@ -34,9 +33,9 @@ type alias RouteParams =
{ number : String }
page : Page.PageWithState RouteParams Data Model Msg
page =
Page.preRender
route : StatefulRoute RouteParams Data Model Msg
route =
RouteBuilder.preRender
{ head = head
, pages =
slideCount
@ -123,14 +122,14 @@ data routeParams =
slideBody : RouteParams -> DataSource.DataSource (List (Html.Html Msg))
slideBody route =
slideBody route_ =
DataSource.File.bodyWithoutFrontmatter
"slides.md"
|> DataSource.andThen
(\rawBody ->
rawBody
|> Markdown.Parser.parse
|> Result.map (markdownIndexedByHeading (route.number |> String.toInt |> Maybe.withDefault 1))
|> Result.map (markdownIndexedByHeading (route_.number |> String.toInt |> Maybe.withDefault 1))
|> Result.mapError (\_ -> "Markdown parsing error.")
|> Result.andThen (Markdown.Renderer.render MarkdownRenderer.renderer)
|> DataSource.fromResult

View File

@ -1,6 +1,7 @@
{
"type": "application",
"source-directories": [
"app",
"src",
"../../src",
".elm-pages",
@ -11,36 +12,41 @@
"direct": {
"MartinSStewart/elm-serialize": "1.2.5",
"avh4/elm-color": "1.0.0",
"danfishgold/base64-bytes": "1.1.0",
"danyx23/elm-mimetype": "4.0.1",
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
"dillonkearns/elm-markdown": "6.0.1",
"elm/browser": "1.0.2",
"elm/bytes": "1.0.8",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"elm/http": "2.0.0",
"elm/json": "1.1.3",
"elm/parser": "1.1.0",
"elm/regex": "1.0.0",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.2",
"elm-community/dict-extra": "2.4.0",
"elm-community/list-extra": "8.3.0",
"jluckyiv/elm-utc-date-strings": "1.0.0",
"lamdera/codecs": "1.0.0",
"lamdera/core": "1.0.0",
"matheus23/elm-default-tailwind-modules": "2.0.1",
"miniBill/elm-codec": "2.0.0",
"noahzgordon/elm-color-extra": "1.0.2",
"pablohirafuji/elm-syntax-highlight": "3.4.0",
"robinheghan/fnv1a": "1.0.0",
"robinheghan/murmur3": "1.0.0",
"rtfeldman/elm-css": "16.1.1",
"tripokey/elm-fuzzy": "5.2.1",
"turboMaCk/non-empty-list-alias": "1.2.0",
"vito/elm-ansi": "10.0.1",
"zwilias/json-decode-exploration": "6.0.0"
},
"indirect": {
"bburdette/toop": "1.0.1",
"danfishgold/base64-bytes": "1.1.0",
"elm/bytes": "1.0.8",
"elm/file": "1.0.5",
"elm/parser": "1.1.0",
"elm/random": "1.0.0",
"fredcy/elm-parseint": "2.0.1",
"mgold/elm-nonempty-list": "4.2.0",

View File

@ -20,23 +20,28 @@
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"chokidar": "3.5.2",
"busboy": "^1.0.0",
"chokidar": "^3.5.3",
"commander": "8.3.0",
"connect": "^3.7.0",
"cookie-signature": "^1.1.0",
"cross-spawn": "7.0.3",
"devcert": "^1.2.0",
"elm-doc-preview": "^5.0.5",
"elm-hot": "^1.1.6",
"esbuild": "^0.14.23",
"fs-extra": "^10.0.0",
"globby": "11.0.4",
"gray-matter": "^4.0.3",
"jsesc": "^3.0.2",
"kleur": "^4.1.4",
"memfs": "^3.4.1",
"micromatch": "^4.0.4",
"node-fetch": "^2.6.7",
"object-hash": "^2.2.0",
"serve-static": "^1.14.1",
"terser": "^5.7.2",
"undici": "^4.4.7",
"terser": "^5.11.0",
"vite": "^2.8.4",
"which": "^2.0.2"
},
"bin": {
@ -48,12 +53,12 @@
"@types/micromatch": "^4.0.2",
"@types/node": "12.20.12",
"@types/serve-static": "1.13.10",
"cypress": "^8.3.0",
"cypress": "^9.5.0",
"elm-optimize-level-2": "^0.1.5",
"elm-review": "^2.5.3",
"elm-review": "^2.7.0",
"elm-test": "^0.19.1-revision7",
"elm-tooling": "^1.3.0",
"elm-verify-examples": "^5.0.0",
"elm-verify-examples": "^5.2.0",
"elmi-to-json": "^1.2.0",
"mocha": "^9.1.0",
"typescript": "4.3.5"
@ -1493,32 +1498,37 @@
"@types/micromatch": "^4.0.2",
"@types/node": "12.20.12",
"@types/serve-static": "1.13.10",
"chokidar": "3.5.2",
"busboy": "^1.0.0",
"chokidar": "^3.5.3",
"commander": "8.3.0",
"connect": "^3.7.0",
"cookie-signature": "^1.1.0",
"cross-spawn": "7.0.3",
"cypress": "^8.3.0",
"cypress": "^9.5.0",
"devcert": "^1.2.0",
"elm-doc-preview": "^5.0.5",
"elm-hot": "^1.1.6",
"elm-optimize-level-2": "^0.1.5",
"elm-review": "^2.5.3",
"elm-review": "^2.7.0",
"elm-test": "^0.19.1-revision7",
"elm-tooling": "^1.3.0",
"elm-verify-examples": "^5.0.0",
"elm-verify-examples": "^5.2.0",
"elmi-to-json": "^1.2.0",
"esbuild": "^0.14.23",
"fs-extra": "^10.0.0",
"globby": "11.0.4",
"gray-matter": "^4.0.3",
"jsesc": "^3.0.2",
"kleur": "^4.1.4",
"memfs": "^3.4.1",
"micromatch": "^4.0.4",
"mocha": "^9.1.0",
"node-fetch": "^2.6.7",
"object-hash": "^2.2.0",
"serve-static": "^1.14.1",
"terser": "^5.7.2",
"terser": "^5.11.0",
"typescript": "4.3.5",
"undici": "^4.4.7",
"vite": "^2.8.4",
"which": "^2.0.2"
},
"dependencies": {

View File

@ -5,7 +5,7 @@
"scripts": {
"start": "elm-pages dev",
"serve": "npm run build && http-server ./dist -a localhost -p 3000 -c-1",
"build": "elm-pages build"
"build": "elm-pages build --debug --keep-cache"
},
"author": "Dillon Kearns",
"license": "BSD-3",
@ -15,4 +15,4 @@
"elm-tooling": "^1.3.0",
"http-server": "^0.11.1"
}
}
}

View File

@ -2,12 +2,8 @@ module Api exposing (routes)
import ApiRoute
import DataSource exposing (DataSource)
import DataSource.Http
import Html exposing (Html)
import Json.Encode
import OptimizedDecoder as Decode
import Route exposing (Route)
import Secrets
routes :

View File

@ -6,12 +6,11 @@ import DataSource
import DataSource.Http
import Html exposing (Html)
import Html.Styled
import OptimizedDecoder as D
import Json.Decode as D
import Pages.Flags
import Pages.PageUrl exposing (PageUrl)
import Path exposing (Path)
import Route exposing (Route)
import Secrets
import SharedTemplate exposing (SharedTemplate)
import Tailwind.Utilities
import View exposing (View)
@ -83,8 +82,9 @@ subscriptions _ _ =
data : DataSource.DataSource Data
data =
DataSource.Http.get (Secrets.succeed "https://api.github.com/repos/dillonkearns/elm-pages")
(D.field "stargazers_count" D.int)
--DataSource.Http.get "https://api.github.com/repos/dillonkearns/elm-pages"
-- (D.field "stargazers_count" D.int)
DataSource.succeed 123
view :

View File

@ -1,7 +1,7 @@
module Site exposing (config)
import Cloudinary
import DataSource
import DataSource exposing (DataSource)
import Head
import MimeType
import Pages.Manifest as Manifest
@ -10,11 +10,9 @@ import Route exposing (Route)
import SiteConfig exposing (SiteConfig)
config : SiteConfig Data
config : SiteConfig
config =
{ data = data
, canonicalUrl = canonicalUrl
, manifest = manifest
{ canonicalUrl = canonicalUrl
, head = head
}
@ -24,21 +22,22 @@ type alias Data =
}
data : DataSource.DataSource Data
data : DataSource Data
data =
DataSource.map Data
--(StaticFile.request "site-name.txt" StaticFile.body)
(DataSource.succeed "site-name")
head : Data -> List Head.Tag
head static =
head : DataSource (List Head.Tag)
head =
[ Head.icon [ ( 32, 32 ) ] MimeType.Png (cloudinaryIcon MimeType.Png 32)
, Head.icon [ ( 16, 16 ) ] MimeType.Png (cloudinaryIcon MimeType.Png 16)
, Head.appleTouchIcon (Just 180) (cloudinaryIcon MimeType.Png 180)
, Head.appleTouchIcon (Just 192) (cloudinaryIcon MimeType.Png 192)
, Head.sitemapLink "/sitemap.xml"
]
|> DataSource.succeed
canonicalUrl : String

View File

@ -24,7 +24,7 @@ type alias RouteParams =
page : StatelessRoute RouteParams Data
page =
Page.preRender
RouteBuilder.preRender
{ head = head
, pages = pages
, data = data

View File

@ -34,7 +34,7 @@ type alias RouteParams =
page : Page.PageWithState RouteParams Data Model Msg
page =
Page.preRender
RouteBuilder.preRender
{ head = head
, pages =
slideCount

View File

@ -7,7 +7,7 @@
"main": "index.js",
"scripts": {
"start": "cd examples/end-to-end && npm start",
"test": "npx elmi-to-json --version && elm-verify-examples --run-tests && elm-test && (cd generator && mocha) && (cd examples/routing && npm i && npm run build -- --debug && elm-test) && npm run test:snapshot",
"test": "set -x; npx elmi-to-json --version && elm-verify-examples --run-tests && elm-test && (cd generator && mocha) && (cd examples/routing && npm i && npm run build && elm-test-rs) && npm run test:snapshot",
"test:snapshot": "(cd examples/escaping && npm install && npm test && cd ../..) && (cd examples/base-path && npm install && npm test && cd ../..)",
"cypress": "npm start & cypress run",
"review": "elm-review"
@ -73,4 +73,4 @@
"bin": {
"elm-pages": "generator/src/cli.js"
}
}
}

View File

@ -144,8 +144,11 @@ cliApplication config =
Decode.decodeValue decoder jsonValue
|> Result.mapError
(\error ->
error
|> Decode.errorToString
("From location 1: "
++ (error
|> Decode.errorToString
)
)
|> BuildError.internal
|> GotBuildError
)
@ -158,8 +161,11 @@ cliApplication config =
|> Result.map GotDataBatch
|> Result.mapError
(\error ->
error
|> Decode.errorToString
("From location 2: "
++ (error
|> Decode.errorToString
)
)
|> BuildError.internal
|> GotBuildError
)