feat(web): vite+react+ts+tailwind4 scaffold, vitest, /api dev proxy

This commit is contained in:
2026-09-07 15:19:02 +08:00
parent b730b7acb4
commit 0cc040d750
11 changed files with 8293 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
node_modules
dist
dev-dist
+14
View File
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#09090b" />
<link rel="icon" href="/icon.svg" type="image/svg+xml" />
<title>BookLib — 个人书库</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
+8180
View File
File diff suppressed because it is too large Load Diff
+39
View File
@@ -0,0 +1,39 @@
{
"name": "booklib-web",
"version": "0.1.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "vitest run",
"dev": "vite",
"build": "tsc --noEmit && vite build",
"preview": "vite preview",
"check": "tsc --noEmit && vitest run && vite build"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "module",
"private": "true",
"dependencies": {
"@tanstack/react-query": "^5.102.8",
"dompurify": "^3.4.15",
"epubjs": "^0.3.93",
"marked": "^18.0.11",
"pdfjs-dist": "^6.3.289",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"react-router-dom": "^7.18.3"
},
"devDependencies": {
"@tailwindcss/vite": "^4.3.3",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.7",
"@vitejs/plugin-react": "^6.1.1",
"tailwindcss": "^4.3.3",
"typescript": "^7.0.2",
"vite": "^8.2.2",
"vite-plugin-pwa": "^1.3.0",
"vitest": "^5.0.0"
}
}
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><rect width="128" height="128" rx="24" fill="#09090b"/><path d="M24 30h34v68H24zM70 30h34v68H70z" fill="none" stroke="#34d399" stroke-width="6"/><path d="M58 30v68" stroke="#34d399" stroke-width="6"/></svg>

After

Width:  |  Height:  |  Size: 269 B

+3
View File
@@ -0,0 +1,3 @@
export default function App() {
return <div className="p-8 text-zinc-400">booklib web</div>;
}
+17
View File
@@ -0,0 +1,17 @@
@import "tailwindcss";
html,
body,
#root {
height: 100%;
}
body {
@apply bg-zinc-950 text-zinc-100 antialiased;
}
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-thumb {
@apply rounded bg-zinc-700;
}
+5
View File
@@ -0,0 +1,5 @@
import { createRoot } from "react-dom/client";
import App from "./App";
import "./index.css";
createRoot(document.getElementById("root")!).render(<App />);
+18
View File
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2023", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"isolatedModules": true,
"skipLibCheck": true,
"noEmit": true,
"types": ["vite/client"]
},
"include": ["src", "test"]
}
+8
View File
@@ -0,0 +1,8 @@
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import tailwindcss from "@tailwindcss/vite";
export default defineConfig({
plugins: [react(), tailwindcss()],
server: { proxy: { "/api": "http://localhost:8080" } },
});
+5
View File
@@ -0,0 +1,5 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: { include: ["test/**/*.test.ts", "test/**/*.test.tsx"], passWithNoTests: true },
});