Skip to content

Commit 72ed653

Browse files
committed
Migrate to vite
1 parent af5e12e commit 72ed653

File tree

96 files changed

+6134
-8123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+6134
-8123
lines changed

.github/workflows/frontend.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,20 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v5
1818

19-
- name: Setup yarn
19+
- name: Enable Corepack
20+
run: corepack enable
21+
22+
- name: Setup pnpm
2023
uses: actions/setup-node@v6
2124
with:
2225
node-version: '22'
23-
cache: 'yarn'
24-
cache-dependency-path: frontend/yarn.lock
26+
cache: 'pnpm'
27+
cache-dependency-path: frontend/pnpm-lock.yaml
2528

2629
- name: Install npm modules
27-
run: yarn
30+
run: pnpm i
2831
working-directory: frontend
2932

3033
- name: Run prettier, lint, jest checks
31-
run: yarn test
34+
run: pnpm test
3235
working-directory: frontend

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ uv.lock
66
.mypy_cache
77
.dmypy.json
88
.pytest_cache
9+
.yarn
910

1011
*.env
1112
!ci.env

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ The frontend doesn't can be configured by environment variables as well, as well
109109
# Running Bracket in production
110110
Read the [deployment docs](https://docs.bracketapp.nl/docs/deployment) for how to deploy Bracket and run it in production.
111111

112-
Bracket can be run in Docker or by itself (using `uv` and `yarn`).
112+
Bracket can be run in Docker or by itself (using `uv` and `pnpm`).
113113

114114
# Development setup
115115
Read the [development docs](https://docs.bracketapp.nl/docs/community/development) for how to run Bracket for development.
116116

117-
Prerequisites are `yarn`, `postgresql` and `uv` to run the frontend, database and backend.
117+
Prerequisites are `pnpm`, `postgresql` and `uv` to run the frontend, database and backend.
118118

119119
# Translations
120120
Based on your browser settings, your language should be automatically detected and loaded. For now,

docs/content/community/development.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ two sections.
5656

5757
```bash
5858
cd frontend
59-
yarn run dev
59+
pnpm run dev
6060
```
6161

6262
### Backend

docs/content/deployment/nomad.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ job "bracket-frontend" {
9797
config {
9898
image = "ghcr.io/evroon/bracket-frontend"
9999
ports = ["nextjs"]
100-
args = ["yarn", "start", "-p", "${NOMAD_PORT_nextjs}"]
100+
args = ["pnpm", "start", "-p", "${NOMAD_PORT_nextjs}"]
101101
}
102102
103103
resources {

docs/content/deployment/systemd.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ After=network.target
5151
Type=simple
5252
User=bracket
5353
WorkingDirectory=/var/lib/bracket/frontend
54-
ExecStart=/usr/local/bin/yarn start
54+
ExecStart=/usr/local/bin/pnpm start
5555
Environment=NODE_ENV=production
5656
TimeoutSec=15
5757
Restart=always

frontend/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
# production
1616
/build
17+
/dist
1718

1819
# misc
1920
.DS_Store

frontend/Dockerfile

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ FROM node:22-alpine AS deps
33

44
WORKDIR /app
55

6-
COPY package.json yarn.lock ./
6+
COPY pnpm-lock.yaml package.json ./
77

8-
# Increase timeout for slow QEMU arm64 builds
9-
# https://github.com/nodejs/docker-node/issues/1335
10-
RUN yarn --network-timeout 1000000
8+
RUN corepack enable && pnpm i
119

1210
# Rebuild the source code only when needed
1311
FROM node:22-alpine AS builder
@@ -17,9 +15,11 @@ WORKDIR /app
1715
COPY . .
1816
COPY --from=deps /app/node_modules ./node_modules
1917

20-
RUN NEXT_PUBLIC_API_BASE_URL=http://NEXT_PUBLIC_API_BASE_URL_PLACEHOLDER \
21-
NEXT_PUBLIC_HCAPTCHA_SITE_KEY=NEXT_PUBLIC_HCAPTCHA_SITE_KEY_PLACEHOLDER \
22-
yarn build
18+
RUN corepack enable
19+
20+
RUN VITE_API_BASE_URL=http://VITE_API_BASE_URL_PLACEHOLDER \
21+
VITE_HCAPTCHA_SITE_KEY=VITE_HCAPTCHA_SITE_KEY_PLACEHOLDER \
22+
pnpm build
2323

2424
# Production image, copy all the files and run next
2525
FROM node:22-alpine AS runner
@@ -29,21 +29,16 @@ WORKDIR /app
2929
ENV NODE_ENV=production
3030

3131
RUN addgroup -g 1001 --system nodejs && \
32-
adduser --system nextjs -u 1001 -G nodejs
32+
adduser --system vite -u 1001 -G nodejs
3333

34-
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
35-
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
34+
COPY --from=builder --chown=vite:nodejs /app/public ./public
3635
COPY --from=builder /app/node_modules ./node_modules
3736
COPY --from=builder /app/package.json ./package.json
3837
COPY --from=builder --chmod=0755 /app/docker-entrypoint.sh ./entrypoint.sh
39-
COPY --from=builder /app/next.config.js ./next.config.js
40-
COPY --from=builder /app/next-i18next.config.js ./next-i18next.config.js
4138

4239
RUN apk add bash
4340

44-
RUN yarn next telemetry disable
45-
46-
USER nextjs
41+
USER vite
4742

4843
EXPOSE 3000
4944

@@ -52,4 +47,4 @@ ENTRYPOINT ["/app/entrypoint.sh"]
5247
HEALTHCHECK --interval=10s --timeout=5s --retries=5 \
5348
CMD ["wget", "--spider", "http://0.0.0.0:3000", "||", "exit", "1"]
5449

55-
CMD ["yarn", "start"]
50+
CMD ["pnpm", "start"]

frontend/i18n.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import i18n from 'i18next';
2+
import LanguageDetector from 'i18next-browser-languagedetector';
3+
import Backend from 'i18next-http-backend';
4+
import { initReactI18next } from 'react-i18next';
5+
6+
i18n
7+
.use(Backend)
8+
.use(LanguageDetector)
9+
.use(initReactI18next)
10+
.init({
11+
fallbackLng: 'en',
12+
defaultNS: 'common',
13+
interpolation: {
14+
escapeValue: false,
15+
},
16+
});
17+
18+
export default i18n;

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" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Bracket</title>
8+
<meta charSet="UTF-8" />
9+
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
10+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
11+
<link rel="shortcut icon" href="/favicon.svg" />
12+
</head>
13+
<body>
14+
<div id="root"></div>
15+
<script type="module" src="/src/main.tsx"></script>
16+
</body>
17+
</html>

0 commit comments

Comments
 (0)