Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from React to svelte #43

Closed
wants to merge 60 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
f1fe9eb
Switch to svelte
wgenh May 30, 2024
6263010
Switch to svelte
wgenh May 30, 2024
14e29a2
prettify the code
wgenh May 31, 2024
5cf12db
fix static builds
wgenh May 31, 2024
f6dbcc7
Some fixes
wgenh May 31, 2024
d145070
Fix production build
wgenh May 31, 2024
3ee6ec3
Fix title + minor cleanup
wgenh May 31, 2024
3636a25
Fix telemetry and eslint
wgenh May 31, 2024
fa3f987
Fix tests
wgenh May 31, 2024
d8e7927
Fix tests
wgenh May 31, 2024
68d6041
add setup.js
wgenh May 31, 2024
551790c
Fix path
wgenh May 31, 2024
83aeb45
Fix path
wgenh May 31, 2024
496f251
Fix path
wgenh May 31, 2024
4407c66
Fix tests
wgenh May 31, 2024
567a36e
Fix tests
wgenh May 31, 2024
c337593
Fix tests
wgenh May 31, 2024
2499215
Fix tests
wgenh May 31, 2024
8e13d3d
Fix tests(finally)
wgenh May 31, 2024
51d9629
Cleanup
wgenh May 31, 2024
27783c9
Clean up
wgenh May 31, 2024
79059f5
quick fix
wgenh May 31, 2024
61471b7
Clean up
wgenh May 31, 2024
71431fb
Fix build
wgenh May 31, 2024
c7cb0b5
Change next.js to vite
wgenh May 31, 2024
807a651
Fix path
wgenh May 31, 2024
40948d0
Fix message
wgenh May 31, 2024
b6e9266
Fix docker
wgenh Jun 1, 2024
25c889c
Clean up
wgenh Jun 1, 2024
3a5a0d0
Fix flash.svelte
wgenh Jun 1, 2024
423678f
Clean up dependencies
wgenh Jun 1, 2024
76c8a13
Change require to import
wgenh Jun 1, 2024
95fb6ba
bun.lockb
wgenh Jun 1, 2024
4923308
remove .env
wgenh Jun 1, 2024
4b0ec77
Dockerfile: rename to vitejs
wgenh Jun 1, 2024
d3751f4
Add jsdom
wgenh Jun 1, 2024
0743fb6
Change font
wgenh Jun 1, 2024
e0a1e78
return original formatting
wgenh Jun 1, 2024
338cea1
Clean up and fixes
wgenh Jun 1, 2024
c933cd1
Fix image.worker.js
wgenh Jun 1, 2024
938e19b
Fix progress.js
wgenh Jun 1, 2024
3dec676
Fix progress.js and fastboot.js
wgenh Jun 1, 2024
77a64c3
progress.js fix
wgenh Jun 1, 2024
80e5983
fix progress.js
wgenh Jun 1, 2024
584b3a2
progress.js fix
wgenh Jun 1, 2024
e1c53e1
progress.js fix
wgenh Jun 1, 2024
93da797
Fix stupid errors
wgenh Jun 1, 2024
10287bc
Fix another stupid error
wgenh Jun 1, 2024
f546a00
Fix...
wgenh Jun 1, 2024
16d66bc
Merge branch 'commaai:master' into master
wgenh Jun 1, 2024
c05d2ce
Stupid errors
wgenh Jun 1, 2024
6dc6492
Use fontsource
wgenh Jun 1, 2024
24ee6c5
Fix bugs, it works nowgit add -p!
wgenh Jun 2, 2024
95ddd0c
Fix typo
wgenh Jun 2, 2024
cb101ef
Fix message
wgenh Jun 2, 2024
45f4797
Delete old class
wgenh Jun 2, 2024
c93364e
refactor
wgenh Jun 2, 2024
5535966
Ask when user closes page
wgenh Jun 2, 2024
819ffa9
Use plausible.io/script.js instead of plausible-tracker
wgenh Jun 3, 2024
b5e3aa9
delete vitest.config.js
wgenh Jun 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
static_site_generator: next
- name: Install dependencies
run: bun install
- name: Build with Next.js
- name: Build with Vite
run: bun run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@
/.pnp
.pnp.js
/.pnpm-store

# testing
/coverage

# next.js
/.next/
/out/

# svelte-kit
.svelte-kit
# production
/build

Expand Down
17 changes: 5 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,27 @@ FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

ENV NEXT_TELEMETRY_DISABLED 1
ARG NEXT_PUBLIC_GIT_SHA
ENV NEXT_PUBLIC_GIT_SHA $NEXT_PUBLIC_GIT_SHA

ENV STANDALONE 1
RUN bun run build


# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 bunjs
RUN adduser --system --uid 1001 nextjs
RUN adduser --system --uid 1001 vitejs

#COPY --from=builder /app/public ./public

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:bunjs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:bunjs /app/.next/static ./.next/static
COPY --from=builder --chown=vitejs:bunjs /app/out ./

USER nextjs
USER vitejs

EXPOSE 3000

ENV PORT 3000

CMD ["bun", "server.js"]
CMD ["bun", "index.js"]
Binary file modified bun.lockb
Binary file not shown.
27 changes: 27 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import js from '@eslint/js';
import globals from 'globals';
import svelte from 'eslint-plugin-svelte';
import svelteParser from "svelte-eslint-parser";
/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
js.configs.recommended,
...svelte.configs['flat/recommended'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.jest
}
}
},
{
ignores: ['build/', '.svelte-kit/', 'dist/']
},
{
files: ["**/*.svelte.js", "*.svelte.js"],
languageOptions: {
parser: svelteParser
},
},
];
7 changes: 1 addition & 6 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
}
"extends": "./.svelte-kit/tsconfig.json"
}
6 changes: 0 additions & 6 deletions next.config.js

This file was deleted.

49 changes: 26 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,41 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test": "vitest",
"lint": "eslint ."
},
"packageManager": "bun",
"engines": {
"node": ">=18.0.0"
},
"devDependencies": {
"@sveltejs/adapter-node": "^5.0.1",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.0.0",
"@tailwindcss/typography": "^0.5.13",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/svelte": "^5.1.0",
"@vitest/web-worker": "^1.6.0",
"eslint": "^9.0.0",
"eslint-plugin-svelte": "next",
"jsdom": "^24.1.0",
"svelte": "^5.0.0-next.1",
"vite": "^5.0.3",
"vitest": "^1.2.0"
},
"type": "module",
"dependencies": {
"@fontsource-variable/inter": "^5.0.18",
"@fontsource-variable/jetbrains-mono": "^5.0.21",
"android-fastboot": "github:commaai/fastboot.js#c3ec6fe3c96a48dab46e23d0c8c861af15b2144a",
"autoprefixer": "10.4.14",
"autoprefixer": "^10.4.19",
"comlink": "^4.4.1",
"eslint": "8.40.0",
"eslint-config-next": "13.4.1",
"jssha": "^3.3.1",
"next": "13.4.1",
"next-plausible": "^3.10.1",
"postcss": "8.4.24",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "3.3.2",
"web-vitals": "^3.4.0",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3",
"xz-decompress": "^0.2.1"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.9",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^14.0.0",
"@vitejs/plugin-react": "^4.0.4",
"jsdom": "^22.1.0",
"vite-plugin-svgr": "^3.2.0",
"vitest": "^0.34.2"
}
}
12 changes: 6 additions & 6 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
13 changes: 13 additions & 0 deletions src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script defer data-domain="flash.comma.ai" src="https://plausible.io/js/script.js"></script>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
10 changes: 0 additions & 10 deletions src/app/App.test.jsx

This file was deleted.

Loading