Skip to content

Commit 03ed948

Browse files
authored
Use Vite for dev and migrate to SWR for pages (#60)
* Use Vite for dev and migrate to SWR for pages * checkpoint again * move to pnpm for gh actions * install pnpm in github actions * testing more for pnpm in ga * ok found docs on this - there is another stage for setting up pnpm * progress, set the correct lock file * use only frozen lockfile * set working-directory * set the pnpm version to 8.6.12 * TS fixes and hacks * set the output dir to build
1 parent 3feb3b2 commit 03ed948

File tree

20 files changed

+1759
-43308
lines changed

20 files changed

+1759
-43308
lines changed

.github/workflows/docker-frontend.yaml

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,21 @@ jobs:
88
runs-on: ubuntu-latest
99
defaults:
1010
run:
11-
working-directory: 'frontend'
11+
working-directory: "frontend"
1212

1313
permissions:
1414
contents: read
1515
packages: write
1616

1717
steps:
18-
-
19-
uses: actions/checkout@v3
20-
-
21-
name: Set up QEMU
18+
- uses: actions/checkout@v3
19+
- name: Set up QEMU
2220
uses: docker/setup-qemu-action@v2
2321
with:
2422
platforms: arm64
25-
-
26-
name: Set up Docker Buildx
23+
- name: Set up Docker Buildx
2724
uses: docker/setup-buildx-action@v2
28-
-
29-
name: Docker image metadata
25+
- name: Docker image metadata
3026
id: meta
3127
uses: docker/metadata-action@v4
3228
with:
@@ -36,33 +32,29 @@ jobs:
3632
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}
3733
type=ref,event=pr
3834
type=sha
39-
-
40-
name: Login to GitHub Container Registry
35+
- name: Login to GitHub Container Registry
4136
uses: docker/login-action@v2
4237
with:
43-
registry: ghcr.io
44-
username: ${{ github.actor }}
45-
password: ${{ secrets.GITHUB_TOKEN }}
46-
-
47-
name: Install Node.js
48-
uses: actions/setup-node@v3
38+
registry: ghcr.io
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
- uses: pnpm/action-setup@v2
42+
with:
43+
version: 8.6.12
44+
- name: Install Node.js
45+
uses: actions/setup-node@v4
4946
with:
5047
node-version-file: frontend/.node-version
51-
cache: 'npm'
52-
cache-dependency-path: frontend/package-lock.json
48+
cache: "pnpm"
49+
cache-dependency-path: frontend/pnpm-lock.yaml
5350

54-
-
55-
name: Install dependencies
56-
run: npm install
51+
- name: Install dependencies
52+
run: pnpm i --frozen-lockfile
5753

58-
-
59-
name: Build
60-
run: npm run build
61-
env:
62-
NODE_OPTIONS: --openssl-legacy-provider
54+
- name: Build
55+
run: pnpm build
6356

64-
-
65-
name: Build and push
57+
- name: Build and push
6658
uses: docker/build-push-action@v4
6759
with:
6860
context: frontend/

docker-compose.dev.yml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ services:
2525
- |
2626
python manage.py migrate
2727
python manage.py runserver 0.0.0.0:8000
28+
ports:
29+
- "8000:8000"
2830
volumes:
2931
- .:/code
3032
depends_on:
@@ -33,14 +35,6 @@ services:
3335
- redis
3436
- rabbitmq
3537

36-
web:
37-
build:
38-
context: ./frontend
39-
dockerfile: Dockerfile.dev
40-
volumes:
41-
- ./frontend/public:/frontend/public
42-
- ./frontend/src:/frontend/src
43-
4438
db:
4539
image: postgres:14-alpine
4640
restart: on-failure
@@ -85,18 +79,6 @@ services:
8579
image: zookeeper:3.7.0
8680
restart: on-failure
8781

88-
caddy:
89-
image: caddy:2.6.1
90-
ports:
91-
- "8888:8888"
92-
environment:
93-
SITE_ADDRESS: ":8888"
94-
volumes:
95-
- ./docker/Caddyfile:/etc/caddy/Caddyfile
96-
depends_on:
97-
- web
98-
- app
99-
10082
rabbitmq:
10183
image: rabbitmq:3.12.2-management-alpine
10284
ports:

frontend/Dockerfile.dev

Lines changed: 0 additions & 13 deletions
This file was deleted.

frontend/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" />
6+
<link rel="icon" type="image/x-icon" href="/favicons/favicon.ico" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<meta name="theme-color" content="#000000" />
9+
<meta name="description" content="Web site created using create-react-app" />
10+
<title>HouseWatch</title>
11+
</head>
12+
<body>
13+
<noscript>You need to enable JavaScript to run this app.</noscript>
14+
<div id="root"></div>
15+
<script type="module" src="/src/index.tsx"></script>
16+
</body>
17+
</html>

0 commit comments

Comments
 (0)