Skip to content

Commit

Permalink
Merge pull request #103 from elm-land/release/0.19.1
Browse files Browse the repository at this point in the history
📦 Release 0.19.1
  • Loading branch information
ryan-haskell committed Jun 22, 2023
2 parents 309aeb7 + e6789f5 commit 445207b
Show file tree
Hide file tree
Showing 25 changed files with 271 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/.vitepress/config.js
@@ -1,4 +1,4 @@
const version = '0.19.0'
const version = '0.19.1'

const sidebar = [
{
Expand Down
1 change: 1 addition & 0 deletions docs/.vitepress/theme/components/ExampleGallery.vue
Expand Up @@ -20,6 +20,7 @@ export default {
{ kind: "official", title: "📊 Query Parameters", id: "06-query-parameters", src: "/images/guide/query-parameters.gif" },
{ kind: "official", title: "🧱 Working with JS", id: "07-working-with-js", src: "/images/examples/working-with-js.gif" },
{ kind: "official", title: "🪆 Nested Layouts", id: "08-nested-layouts", src: "/images/examples/nested-layouts.gif" },
{ kind: "official", title: "🪄 Catch-all Routes", id: "09-catch-all-routes", src: "/images/examples/catch-all-routes.jpg" },
{ kind: "official", title: "🧩 TypeScript Interop", id: "10-typescript-interop", src: "/images/examples/typescript.gif" },
{ kind: "official", title: "🚨 Error Reporting", id: "11-error-reporting", src: "/images/examples/sentry.gif" },
{ kind: "official", title: "🎨 Using Elm UI", id: "12-elm-ui", src: "/images/examples/elm-ui.jpg" },
Expand Down
2 changes: 1 addition & 1 deletion docs/concepts/cli.md
Expand Up @@ -172,7 +172,7 @@ Here's example output of what you'd see if you ran this command in the ["Pages a

```txt
🌈 Elm Land (v0.19.0) found 5 pages in your application
🌈 Elm Land (v0.19.1) found 5 pages in your application
⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺
src/Pages/Home_.elm ............... http://localhost:1234/
src/Pages/SignIn.elm .............. http://localhost:1234/sign-in
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/deploying.md
Expand Up @@ -16,7 +16,7 @@ elm-land build

```txt
🌈 Elm Land (v0.19.0) build was successful.
🌈 Elm Land (v0.19.1) build was successful.
⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺
```

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/pages-and-routes.md
Expand Up @@ -326,7 +326,7 @@ elm-land routes

```txt
🌈 Elm Land (v0.19.0) found 6 pages in your application
🌈 Elm Land (v0.19.1) found 6 pages in your application
⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺
src/Pages/Home_.elm ........................... /
src/Pages/SignIn.elm .......................... /sign-in
Expand Down
7 changes: 7 additions & 0 deletions docs/index.md
Expand Up @@ -56,6 +56,13 @@ const members = [
{ icon: 'github', link: 'https://github.com/ianmackenzie' }
]
},
{
avatar: 'https://www.github.com/alpakaxaxa.png',
name: '@alpakaxaxa',
links: [
{ icon: 'github', link: 'https://github.com/alpakaxaxa' }
]
},
]
</script>

Expand Down
Binary file added docs/public/images/examples/catch-all-routes.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions examples/09-catch-all-routes/.gitignore
@@ -0,0 +1,7 @@
/dist
/.elm-land
/.env
/elm-stuff
/node_modules
.DS_Store
*.pem
28 changes: 28 additions & 0 deletions examples/09-catch-all-routes/elm-land.json
@@ -0,0 +1,28 @@
{
"app": {
"elm": {
"development": { "debugger": true },
"production": { "debugger": false }
},
"env": [],
"html": {
"attributes": {
"html": { "lang": "en" },
"head": {}
},
"title": "Elm Land",
"meta": [
{ "charset": "UTF-8" },
{ "http-equiv": "X-UA-Compatible", "content": "IE=edge" },
{ "name": "viewport", "content": "width=device-width, initial-scale=1.0" }
],
"link": [
{ "rel": "stylesheet", "href": "/main.css" }
],
"script": []
},
"router": {
"useHashRouting": false
}
}
}
25 changes: 25 additions & 0 deletions examples/09-catch-all-routes/elm.json
@@ -0,0 +1,25 @@
{
"type": "application",
"source-directories": [
"src",
".elm-land/src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"elm/json": "1.1.3",
"elm/url": "1.0.0"
},
"indirect": {
"elm/time": "1.0.0",
"elm/virtual-dom": "1.0.3"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
106 changes: 106 additions & 0 deletions examples/09-catch-all-routes/src/Pages/Home_.elm
@@ -0,0 +1,106 @@
module Pages.Home_ exposing (page)

import Html exposing (..)
import Html.Attributes exposing (..)
import Route.Path
import View exposing (View)


type alias Link =
{ label : String
, path : Route.Path.Path
}


page : View msg
page =
{ title = "Homepage"
, body =
[ h1 [] [ text "🏡 Homepage" ]
, p [] [ text "Click a link below to learn how URLs work in Elm Land" ]
, section []
[ h3 [] [ text "🧑\u{200D}💻 Users" ]
, viewLinks
[ { label = "@elm-land"
, path = Route.Path.User_ { user = "elm-land" }
}
, { label = "@ryannhg"
, path = Route.Path.User_ { user = "ryannhg" }
}
, { label = "@elm"
, path = Route.Path.User_ { user = "elm" }
}
]
]
, section []
[ h3 [] [ text "📦 Repos" ]
, viewLinks
[ { label = "@elm-land/vscode"
, path =
Route.Path.User__Repo_
{ user = "elm-land"
, repo = "vscode"
}
}
, { label = "@ryannhg/graphql"
, path =
Route.Path.User__Repo_
{ user = "ryannhg"
, repo = "graphql"
}
}
, { label = "@elm/compiler"
, path =
Route.Path.User__Repo_
{ user = "elm"
, repo = "compiler"
}
}
]
]
, section []
[ h3 [] [ text "🗃 File Explorer" ]
, viewLinks
[ { label = "README from @elm-land/vscode"
, path =
Route.Path.User__Repo__Tree_Branch__ALL_
{ user = "elm-land"
, repo = "vscode"
, branch = "main"
, all_ = [ "README.md" ]
}
}
, { label = "`Decode.elm` from @ryannhg/graphql"
, path =
Route.Path.User__Repo__Tree_Branch__ALL_
{ user = "ryannhg"
, repo = "graphql"
, branch = "main"
, all_ = [ "src", "GraphQL", "Decode.elm" ]
}
}
, { label = "`Compile.hs` from @elm/compiler"
, path =
Route.Path.User__Repo__Tree_Branch__ALL_
{ user = "elm"
, repo = "compiler"
, branch = "master"
, all_ = [ "compiler", "src", "Compile.hs" ]
}
}
]
]
]
}


viewLinks : List Link -> Html msg
viewLinks links =
ul [] (List.map viewLink links)


viewLink : Link -> Html msg
viewLink link =
li []
[ a [ Route.Path.href link.path ] [ text link.label ]
]
16 changes: 16 additions & 0 deletions examples/09-catch-all-routes/src/Pages/User_.elm
@@ -0,0 +1,16 @@
module Pages.User_ exposing (page)

import Html exposing (..)
import Route.Path
import View exposing (View)


page : { user : String } -> View msg
page params =
{ title = "@" ++ params.user ++ " | Users"
, body =
[ h1 [] [ text ("🧑\u{200D}💻 @" ++ params.user) ]
, p [] [ text "Hello from `src/Pages/User_.elm 👋" ]
, a [ Route.Path.href Route.Path.Home_ ] [ text "Back to homepage" ]
]
}
16 changes: 16 additions & 0 deletions examples/09-catch-all-routes/src/Pages/User_/Repo_.elm
@@ -0,0 +1,16 @@
module Pages.User_.Repo_ exposing (page)

import Html exposing (..)
import Route.Path
import View exposing (View)


page : { user : String, repo : String } -> View msg
page params =
{ title = "@" ++ params.user ++ "/" ++ params.repo ++ " | Repos"
, body =
[ h1 [] [ text ("📦 @" ++ params.user ++ "/" ++ params.repo) ]
, p [] [ text "Hello from `src/Pages/User_/Repo_.elm 👋" ]
, a [ Route.Path.href Route.Path.Home_ ] [ text "Back to homepage" ]
]
}
@@ -0,0 +1,22 @@
module Pages.User_.Repo_.Tree.Branch_.ALL_ exposing (page)

import Html exposing (..)
import Route.Path
import View exposing (View)


page :
{ user : String
, repo : String
, branch : String
, all_ : List String
}
-> View msg
page params =
{ title = "@" ++ params.user ++ "/" ++ params.repo ++ " | File Explorer"
, body =
[ h1 [] [ text ("🗃 ~/" ++ String.join "/" params.all_) ]
, p [] [ text "Hello from `src/Pages/User_/Repo_/Tree/Branch_/ALL_.elm 👋" ]
, a [ Route.Path.href Route.Path.Home_ ] [ text "Back to homepage" ]
]
}
10 changes: 10 additions & 0 deletions examples/09-catch-all-routes/static/main.css
@@ -0,0 +1,10 @@
body {
margin: 2rem auto;
padding: 0 2rem;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
max-width: 40em;
}

p {
color: #555;
}
2 changes: 1 addition & 1 deletion projects/cli/README.md
Expand Up @@ -17,7 +17,7 @@ The `elm-land` CLI comes with everything you need to create your next web applic
```
$ elm-land
🌈 Welcome to Elm Land! (v0.19.0)
🌈 Welcome to Elm Land! (v0.19.1)
⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺
Here are the available commands:
Expand Down
4 changes: 2 additions & 2 deletions projects/cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion projects/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "elm-land",
"version": "0.19.0",
"version": "0.19.1",
"description": "Reliable web apps for everyone",
"main": "index.js",
"types": "./index.d.ts",
Expand Down
12 changes: 8 additions & 4 deletions projects/cli/src/codegen/src/Commands/Generate.elm
Expand Up @@ -2832,13 +2832,17 @@ routePathFromStringExpression { pages } =
CodeGen.Expression.caseExpression
{ value = CodeGen.Argument.new "urlPathSegments"
, branches =
let
pageBranches =
pages
|> List.filter (\page -> not (PageFile.isNotFoundPage page))
|> List.map toBranch
in
if List.any PageFile.isTopLevelCatchAllPage pages then
pages
|> List.filter (\page -> not (PageFile.isNotFoundPage page))
|> List.map toBranch
pageBranches

else
List.map toBranch pages ++ [ nothingBranch ]
pageBranches ++ [ nothingBranch ]
}
}

Expand Down
2 changes: 1 addition & 1 deletion projects/cli/src/effects.js
Expand Up @@ -529,7 +529,7 @@ const generateHtml = async (config) => {
? [toHtmlTag('title', {}, config.app.html.title)]
: []
let metaTags = toSelfClosingHtmlTags('meta', [
{ name: 'elm-land', content: '0.19.0' }
{ name: 'elm-land', content: '0.19.1' }
].concat(attempt(_ => config.app.html.meta)))
let linkTags = toSelfClosingHtmlTags('link', attempt(_ => config.app.html.link))
let scriptTags = toHtmlTags('script', attempt(_ => config.app.html.script))
Expand Down
6 changes: 6 additions & 0 deletions projects/cli/tests/08-examples.bats
Expand Up @@ -42,6 +42,12 @@ load helpers
expectElmExampleBuilds
}

@test "'09-catch-all-routes' example builds successfully" {
cd ../../examples/09-catch-all-routes
run npm install
expectElmExampleBuilds
}

@test "'10-typescript-interop' example builds successfully" {
cd ../../examples/10-typescript-interop
expectElmExampleBuilds
Expand Down
6 changes: 3 additions & 3 deletions projects/cli/tests/09-elm-binary.bats
Expand Up @@ -54,7 +54,7 @@ load helpers

cp -r ../../examples/01-hello-world ../../examples/01-local-hello
cd ../../examples/01-local-hello
echo '{ "dependencies": { "elm-land": "file:../../projects/cli/elm-land-0.19.0.tgz" } }' > package.json
echo '{ "dependencies": { "elm-land": "file:../../projects/cli/elm-land-0.19.1.tgz" } }' > package.json
npm install

run npx elm-land build
Expand All @@ -72,7 +72,7 @@ load helpers

cp -r ../../examples/01-hello-world ../../examples/01-local-hello
cd ../../examples/01-local-hello
echo '{ "dependencies": { "elm-land": "file:../../projects/cli/elm-land-0.19.0.tgz" } }' > package.json
echo '{ "dependencies": { "elm-land": "file:../../projects/cli/elm-land-0.19.1.tgz" } }' > package.json
npm install -g yarn
yarn

Expand All @@ -91,7 +91,7 @@ load helpers

cp -r ../../examples/01-hello-world ../../examples/01-local-hello
cd ../../examples/01-local-hello
echo '{ "dependencies": { "elm-land": "file:../../projects/cli/elm-land-0.19.0.tgz" } }' > package.json
echo '{ "dependencies": { "elm-land": "file:../../projects/cli/elm-land-0.19.1.tgz" } }' > package.json
npm install -g pnpm
pnpm install

Expand Down

0 comments on commit 445207b

Please sign in to comment.