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

Rewrite app with astro with preact #49

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

.astro
dist
8 changes: 8 additions & 0 deletions astro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'astro/config';
import tailwind from "@astrojs/tailwind";
import preact from "@astrojs/preact";

// https://astro.build/config
export default defineConfig({
integrations: [tailwind(), preact({compat: true})]
});
Binary file modified bun.lockb
Binary file not shown.
22 changes: 0 additions & 22 deletions index.html

This file was deleted.

12 changes: 12 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": [
"src/*"
]
},
"jsx": "react-jsx",
"jsxImportSource": "preact"
}
}
21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,32 @@
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"start": "vite preview",
"dev": "astro dev",
"build": "astro build",
"start": "astro preview",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives",
"test": "vitest"
},
"engines": {
"node": ">=20.11.0"
},
"dependencies": {
"@astrojs/preact": "^3.5.0",
"@astrojs/react": "^3.6.0",
"@astrojs/tailwind": "^5.1.0",
"@fontsource-variable/inter": "^5.0.18",
"@fontsource-variable/jetbrains-mono": "^5.0.21",
"@testing-library/preact": "^3.2.4",
"android-fastboot": "github:commaai/fastboot.js#c3ec6fe3c96a48dab46e23d0c8c861af15b2144a",
"astro": "^4.10.3",
"comlink": "^4.4.1",
"jssha": "^3.3.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"preact": "^10.22.0",
"xz-decompress": "^0.2.1"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.13",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^15.0.7",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.0",
"autoprefixer": "10.4.14",
"eslint": "^8.57.0",
Expand All @@ -37,9 +38,7 @@
"eslint-plugin-react-refresh": "^0.4.7",
"jsdom": "^22.1.0",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3",
"vite": "^5.2.12",
"vite-svg-loader": "^5.1.0",
"tailwindcss": "^3.4.4",
"vitest": "^1.6.0"
}
}
File renamed without changes.
File renamed without changes
File renamed without changes
10 changes: 0 additions & 10 deletions src/app/App.test.jsx

This file was deleted.

162 changes: 0 additions & 162 deletions src/app/index.jsx

This file was deleted.

4 changes: 2 additions & 2 deletions src/app/Flash.jsx → src/components/Flash.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useCallback } from 'react'
import { useCallback } from 'preact/hooks'

import { Step, Error, useFastboot } from '@/utils/fastboot'

Expand Down Expand Up @@ -228,7 +228,7 @@ export default function Flash() {
onClick={handleContinue}
>
<img
src={icon}
src={icon.src}
alt="cable"
width={128}
height={128}
Expand Down
13 changes: 13 additions & 0 deletions src/components/LazyFlash.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Suspense, lazy } from 'preact/compat'

const Flash = lazy(() => import('./Flash'))

export default function LazyFlash() {
return (
<div className="lg:flex-1 h-[700px] lg:h-screen bg-gray-100 dark:bg-gray-800">
<Suspense fallback={<p className="text-black dark:text-white">Loading...</p>}>
<Flash />
</Suspense>
</div>
)
}
1 change: 1 addition & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="astro/client" />
3 changes: 0 additions & 3 deletions src/index.css

This file was deleted.

14 changes: 0 additions & 14 deletions src/main.jsx

This file was deleted.

Loading