39 lines
1.2 KiB
Markdown
39 lines
1.2 KiB
Markdown
# web-tool
|
|
|
|
React 19 + TypeScript 6 + Vite 8 + Tailwind CSS 4.
|
|
|
|
## Commands
|
|
|
|
```bash
|
|
npm run dev # dev server
|
|
npm run build # tsc -b && vite build (typecheck first, then bundle)
|
|
npm run lint # eslint .
|
|
npm run preview # vite preview (serve built dist/)
|
|
```
|
|
|
|
## Architecture
|
|
|
|
- **Entry**: `src/main.tsx` → `src/App.tsx`
|
|
- **Tools**: 6 single-file tools in `src/tools/` (JsonTool, Base64Tool, UrlTool, TimestampTool, HtmlEntitiesTool, CaseConverterTool)
|
|
- **Nav**: sidebar in `src/components/Sidebar.tsx`; add a new tool by importing in `App.tsx` and registering in `tools` record
|
|
- **Styling**: Tailwind CSS v4 — uses `@import "tailwindcss"` (NOT `@tailwind` directives)
|
|
|
|
## Conventions
|
|
|
|
- `verbatimModuleSyntax` is on — use `import type` for type-only imports
|
|
- `erasableSyntaxOnly` is on — no enums, no namespaces, no parameter properties
|
|
- Chinese (zh-CN) labels only, no i18n
|
|
|
|
## Docker
|
|
|
|
```bash
|
|
docker compose up -d
|
|
```
|
|
|
|
Multi-stage build (node:22-alpine → nginx). Serves via Traefik behind `tool.linkerhand.cc`. Requires external `traefik-net` network.
|
|
|
|
## Gotchas
|
|
|
|
- `npm run build` runs `tsc -b` first; fix type errors before expecting a build to succeed
|
|
- No test framework or test scripts; nothing to run for verification beyond build + lint
|