Skip to content

Commit 757ee5e

Browse files
committed
Add new Lustre's frontend
1 parent 64cd8ac commit 757ee5e

40 files changed

+3215
-0
lines changed

.github/workflows/frontend.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Lustre Frontend CI
2+
3+
on: [push, pull_request]
4+
5+
defaults:
6+
run:
7+
working-directory: ./frontend
8+
9+
jobs:
10+
test:
11+
name: Test Lustre Frontend
12+
runs-on: ubuntu-24.04
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install OTP and Gleam
18+
uses: erlef/setup-beam@v1
19+
with:
20+
otp-version: 27.2
21+
gleam-version: 1.12.0
22+
rebar3-version: 3
23+
24+
- name: Install dependencies
25+
run: gleam deps download
26+
27+
- name: Run tests
28+
run: gleam test
29+
30+
- name: Check Gleam formatted
31+
run: gleam format --check src test
32+
33+
build:
34+
name: Build Lustre Frontend
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Install OTP and Gleam
40+
uses: erlef/setup-beam@v1
41+
with:
42+
otp-version: 27.2
43+
gleam-version: 1.12.0
44+
rebar3-version: 3
45+
46+
- name: Install dependencies
47+
run: gleam deps download
48+
49+
- name: Build Hexdocs website
50+
run: gleam run -m lustre/dev build
51+
52+
# - name: Copy files
53+
# run: |
54+
# mkdir _site
55+
# cp -r dist _site
56+
# cp -r assets _site
57+
58+
# - name: Upload artifacts
59+
# uses: actions/upload-pages-artifact@v3

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@
66
erl_crash.dump
77
*.ez
88
hexdocs-*.tar
9+
10+
# Lustre need some additional ignores.
11+
/frontend/.lustre
12+
/frontend/build
13+
/frontend/dist

frontend/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Hexdocs Frontend
2+
3+
Hexdocs Frontend is using [Lustre](https://lustre.build), a single-page
4+
application running in client, interacting with the backend through asynchronous
5+
HTTP requests.
6+
7+
Running a Lustre application can easily be achieved using [Gleam](https://gleam.run/)
8+
and the [Lustre Dev Tools](https://hexdocs.pm/lustre_dev_tools/).
9+
Lustre Dev Tools is a companion package to Lustre, in charge of compiling,
10+
bundling, and running the application in browser.
11+
12+
## Launching the dev server
13+
14+
With Gleam installed on your path, you can directly start the development server
15+
using Lustre Dev Tools.
16+
17+
```sh
18+
gleam run -m lustre/dev start
19+
```
20+
21+
The application will be running at `http://localhost:1234`.
22+
23+
## Building the application
24+
25+
Building the application can be done with the Lustre Dev Tools too.
26+
27+
```sh
28+
gleam run -m lustre/dev build
29+
```
30+
31+
## Quick reminder of the structure
32+
33+
- All source files reside in `src` folder.
34+
- There's no `index.html` in the sources, as the file is automatically
35+
generated by Lustre Dev Tools with the configuration written in `gleam.toml`.
36+
- `hexdocs.css` is the entrypoint for CSS for the application. Tailwind is
37+
setup in that file.
5.59 KB
Loading
3.92 KB
Loading
14.7 KB
Binary file not shown.
Lines changed: 17 additions & 0 deletions
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "Hexdocs",
3+
"short_name": "Hexdocs",
4+
"icons": [
5+
{
6+
"src": "/favicon/web-app-manifest-192x192.png",
7+
"sizes": "192x192",
8+
"type": "image/png",
9+
"purpose": "maskable"
10+
},
11+
{
12+
"src": "/favicon/web-app-manifest-512x512.png",
13+
"sizes": "512x512",
14+
"type": "image/png",
15+
"purpose": "maskable"
16+
}
17+
],
18+
"theme_color": "#ffffff",
19+
"background_color": "#ffffff",
20+
"display": "standalone"
21+
}
6.14 KB
Loading
20.4 KB
Loading

0 commit comments

Comments
 (0)