Skip to content

Commit 81e1cd1

Browse files
Switch to elm-live to add Apple Silicon M1 support 🤘🏿 (#10)
1 parent cd7f57b commit 81e1cd1

File tree

8 files changed

+591
-8154
lines changed

8 files changed

+591
-8154
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ $ cd frontend && yarn && yarn codegen && yarn start
4242
- [mu-haskell] uses the `schema.graphql` as the single source of truth, using it to generate type level representations of the schema that we can use to implement our server!
4343
- [elm-graphql] also supports code-generation from introspection files, local schema files, and remote servers with introspection enabled _(it usually is)_.
4444
- It's usually better to use a single schema file (like in this repo), with both backend and client code located in the same repo (rather than having duplicate schemas in several repositories - in that case someday they will become inconsistent).
45-
- both [elm-graphql] and [elm-app] can be installed as global dependencies, but we don't consider it a good practice, because it immediately becomes harder to maintain versions.
45+
- both [elm-graphql] and [elm-live] can be installed as global dependencies, but we don't consider it a good practice, because it immediately becomes harder to maintain versions.
4646
- old generated files are removed by [elm-graphql] automatically, we don't need to worry about it.
4747

4848
[elm ci]: https://github.com/kutyel/mu-graphql-example-elm/workflows/Elm%20CI/badge.svg
@@ -51,7 +51,7 @@ $ cd frontend && yarn && yarn codegen && yarn start
5151
[stack]: https://docs.haskellstack.org/en/stable/README/#how-to-install
5252
[yarn]: https://yarnpkg.com/getting-started/install
5353
[elm-graphql]: https://github.com/dillonkearns/elm-graphql/
54-
[elm-app]: https://github.com/halfzebra/create-elm-app
54+
[elm-live]: https://www.elm-live.com/
5555

5656
## Contributing:
5757

frontend/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Distribution
22
build/
33

4+
# Dev build artifacts
5+
public/bundle.js
6+
47
# elm-package generated files
58
elm-stuff
69

frontend/elm.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
"elm/regex": "1.0.0",
2222
"elm/time": "1.0.0",
2323
"elm/virtual-dom": "1.0.2",
24-
"elm-community/list-extra": "8.2.4",
24+
"elm-community/list-extra": "8.3.0",
2525
"lukewestby/elm-string-interpolate": "1.0.4"
2626
}
2727
},
2828
"test-dependencies": {
2929
"direct": {
30-
"elm-explorations/test": "1.0.0"
30+
"elm-explorations/test": "1.2.2"
3131
},
3232
"indirect": {
3333
"elm/random": "1.0.0"

frontend/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"description": "Elm client example for our mu-haskell GraphQL server!",
55
"scripts": {
66
"codegen": "elm-graphql --schema-file ../library.graphql --base LibraryApi --output src",
7-
"start": "elm-app start"
7+
"start": "elm-live src/Main.elm --dir=public --open --host=0.0.0.0 --port=8080 --pushstate --start-page=index.html -- --output=public/bundle.js"
88
},
99
"author": "higherkindness",
1010
"license": "MIT",
1111
"dependencies": {
12-
"@dillonkearns/elm-graphql": "^4.0.3"
12+
"@dillonkearns/elm-graphql": "^4.2.1"
1313
},
1414
"devDependencies": {
15-
"create-elm-app": "^5.11.0"
15+
"elm-live": "^4.0.2"
1616
}
1717
}

frontend/public/index.html

+7-6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
<meta http-equiv="x-ua-compatible" content="ie=edge">
66
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
77
<meta name="theme-color" content="#000000">
8-
<!--
9-
manifest.json provides metadata used when your web app is added to the
10-
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
11-
-->
12-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
13-
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
8+
9+
<link rel="manifest" href="/manifest.json">
10+
<link rel="shortcut icon" href="/favicon.ico">
1411
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600&display=swap" rel="stylesheet">
12+
<link rel="stylesheet" href="/main.css" />
13+
14+
<script type="text/javascript" src="/bundle.js"></script>
15+
<script type="text/javascript" src="/index.js"></script>
1516
<title>Library example</title>
1617
</head>
1718
<body>

frontend/src/index.js frontend/public/index.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
import './main.css'
2-
import { Elm } from './Main.elm'
3-
4-
const app = Elm.Main.init({ node: document.getElementById('root') })
5-
const graphqlWebsocketsUrl = 'ws://localhost:8000'
6-
71
document.addEventListener('DOMContentLoaded', () => {
2+
const app = Elm.Main.init({ node: document.getElementById('root') })
3+
const graphqlWebsocketsUrl = 'ws://localhost:8000'
84
let isActive = false
95

106
app.ports.subscribeToAllBooks.subscribe((subscriptionString) => {

frontend/src/main.css frontend/public/main.css

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
[data-elm-hot="true"] {
2-
height: inherit;
3-
}
4-
51
:root {
62
--main-color-100: rgba(0, 30, 56, 1);
73
--main-color-60: rgba(0, 30, 56, 0.6);

0 commit comments

Comments
 (0)