Skip to content

Commit cd7f69d

Browse files
committed
feat(cook-order): init project
- add React + Hono Cloudflare Worker project scaffolding - add worker entry with Hono framework and middleware setup (access/session/less/startTime) - add SQLite schema and DB utility - add Vite build config and TypeScript tsconfig files - add CI workflow for cook-order deployment - add oxfmt/oxlint config for code style enforcement - update package-lock.json with linux-x64 native bindings
1 parent a229fb4 commit cd7f69d

35 files changed

Lines changed: 15193 additions & 1050 deletions

‎.github/workflows/cook_order.yml‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Cloud Storage
2+
3+
on:
4+
push:
5+
paths:
6+
- apps/cf-worker/cook-order/**
7+
- package.json
8+
- package-lock.json
9+
- tsconfig.json
10+
- turbo.json
11+
pull_request:
12+
paths:
13+
- apps/cf-worker/cook-order/**
14+
- package.json
15+
- package-lock.json
16+
- tsconfig.json
17+
- turbo.json
18+
19+
jobs:
20+
cook-order:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 24.12.0
29+
cache: npm
30+
cache-dependency-path: package-lock.json
31+
32+
- name: Install dependencies
33+
run: npm ci --workspaces --include-workspace-root
34+
35+
- name: Lint
36+
run: npm run lint
37+
env:
38+
TURBO_FILTER: ./apps/cf-worker/cook-order
39+
40+
- name: Test
41+
run: npm run test
42+
env:
43+
TURBO_FILTER: ./apps/cf-worker/cook-order
44+
45+
- name: Build
46+
run: npm run build --ignore-scripts
47+
env:
48+
TURBO_FILTER: ./apps/cf-worker/cook-order
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"singleQuote": true,
3+
"semi": false,
4+
"sortImports": {
5+
"newlinesBetween": false
6+
},
7+
"ignorePatterns": ["*.md", "dist/**", ".wrangler/**", "src/react-app/Components/**"]
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "../../../node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["import"],
4+
"env": {
5+
"browser": true,
6+
"es6": true
7+
},
8+
"ignorePatterns": ["dist/**", "node_modules/**", "src/react-app/Components/**"],
9+
"rules": {}
10+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"files.associations": {
3+
"wrangler.json": "jsonc"
4+
}
5+
}

‎apps/cf-worker/cook-order/README.md‎

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Road Map
2+
3+
## v1.0
4+
5+
### 管理端
6+
7+
### 访客端
8+
9+
### 基础能力
10+
11+
- [x] 基于 MD5 hash 的文件去重(同内容只存储一份)
12+
- [x] Cloudflare R2 作为文件存储后端
13+
- [x] Cloudflare D1(SQLite)作为元数据存储
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "base-lyra",
4+
"rsc": false,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "",
8+
"css": "src/react-app/index.css",
9+
"baseColor": "neutral",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"iconLibrary": "phosphor",
14+
"rtl": false,
15+
"aliases": {
16+
"components": "@/components",
17+
"utils": "@/lib/utils",
18+
"ui": "@/components/ui",
19+
"lib": "@/lib",
20+
"hooks": "@/hooks"
21+
},
22+
"menuColor": "default",
23+
"menuAccent": "subtle",
24+
"registries": {}
25+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# 库 / 框架文档位置
2+
3+
## 公共
4+
5+
| 库 / 工具 | 用途 | 文档链接 |
6+
|-----------|------|----------|
7+
| [oxfmt](https://oxc.rs/docs/guide/usage/formatter) | 代码格式化 | https://oxc.rs/docs/guide/usage/formatter |
8+
| [oxlint](https://oxc.rs/docs/guide/usage/linter) | 代码 Lint | https://oxc.rs/docs/guide/usage/linter |
9+
| [Vite](https://vitejs.dev/) | 构建工具 | https://vitejs.dev/guide/ |
10+
| [Vitest](https://vitest.dev/) | 单元测试 | https://vitest.dev/guide/ |
11+
| [Wrangler](https://developers.cloudflare.com/workers/wrangler/) | Cloudflare Worker 本地开发 / 部署 CLI | https://developers.cloudflare.com/workers/wrangler/ |
12+
| [yn](https://github.com/sindresorhus/yn) | 布尔值解析(环境变量 DEBUG) | https://github.com/sindresorhus/yn |
13+
14+
## Worker(后端)
15+
16+
| 库 / 平台 | 用途 | 文档链接 |
17+
|-----------|------|----------|
18+
| [Hono](https://hono.dev/) | HTTP 框架 | https://hono.dev/docs |
19+
| [Drizzle ORM](https://orm.drizzle.team/) | 数据库 ORM | https://orm.drizzle.team/docs/overview |
20+
| [Cloudflare D1](https://developers.cloudflare.com/d1/) | SQLite 托管数据库 | https://developers.cloudflare.com/d1/ |
21+
| [Cloudflare KV](https://developers.cloudflare.com/kv/) | 键值存储(session / bg 缓存) | https://developers.cloudflare.com/kv/ |
22+
| [Cloudflare R2](https://developers.cloudflare.com/r2/) | 对象存储(文件二进制) | https://developers.cloudflare.com/r2/ |
23+
| [ulid](https://github.com/ulid/spec) | 时间有序唯一 ID 生成 | https://github.com/ulid/javascript |
24+
25+
## React App(前端)
26+
27+
| 库 / 工具 | 用途 | 文档链接 |
28+
|-----------|------|----------|
29+
| [React](https://react.dev/) | UI 框架 | https://react.dev/reference/react |
30+
| [React Router v7](https://reactrouter.com/) | 客户端路由 | https://reactrouter.com/home |
31+
| [shadcn/ui](https://ui.shadcn.com/) | 无样式 UI 组件集(基于 Radix) | https://ui.shadcn.com/docs |
32+
| [Tailwind CSS](https://tailwindcss.com/) | 样式框架 | https://tailwindcss.com/docs |
33+
| [axios](https://axios-http.com/) | HTTP 请求客户端 | https://axios-http.com/docs/intro |
34+
| [react-use](https://github.com/streamich/react-use) | 常用 React Hooks 工具集 | https://github.com/streamich/react-use |
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>乜乜网盘</title>
7+
</head>
8+
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/react-app/main.tsx"></script>
12+
</body>
13+
</html>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"name": "@scripts/cook-order",
3+
"private": true,
4+
"description": "A template for building a React application with Vite, Hono, and Cloudflare Workers",
5+
"type": "module",
6+
"scripts": {
7+
"cf-typegen": "wrangler types",
8+
"deploy": "npm run build && wrangler deploy",
9+
"dev": "vite --host",
10+
"preview": "npm run build && vite preview",
11+
"clean": "rimraf dist",
12+
"build": "vite build",
13+
"lint": "concurrently -m 1 --timings npm:lint:*",
14+
"lint:type-check": "tsc -p tsconfig.json --noEmit",
15+
"lint:formatter": "oxfmt --check",
16+
"lint:oxlint": "oxlint",
17+
"fix": "concurrently -m 1 --timings npm:fix:*",
18+
"fix:formatter": "oxfmt"
19+
},
20+
"dependencies": {
21+
"@base-ui/react": "^1.3.0",
22+
"@fontsource-variable/jetbrains-mono": "^5.2.8",
23+
"@phosphor-icons/react": "^2.1.10",
24+
"@tanstack/react-query": "^5.96.1",
25+
"@videojs/react": "^10.0.0-beta.14",
26+
"axios": "^1.15.0",
27+
"class-variance-authority": "^0.7.1",
28+
"classcat": "^5.0.5",
29+
"clsx": "^2.1.1",
30+
"crypto-js": "^4.2.0",
31+
"dayjs": "^1.11.20",
32+
"drizzle-orm": "^0.45.2",
33+
"hls.js": "^1.6.15",
34+
"hono": "4.11.1",
35+
"lucide-react": "^1.8.0",
36+
"mime-types": "^2.1.35",
37+
"next-themes": "^0.4.6",
38+
"react": "19.2.1",
39+
"react-dom": "19.2.1",
40+
"react-helmet": "^6.1.0",
41+
"react-router": "^7.13.2",
42+
"react-use": "^17.6.0",
43+
"sonner": "^2.0.7",
44+
"tailwind-merge": "^3.5.0",
45+
"tailwindcss": "^4.2.2",
46+
"ts-pattern": "^5.9.0",
47+
"tw-animate-css": "^1.4.0",
48+
"ulid": "^3.0.2",
49+
"yn": "^5.1.0"
50+
},
51+
"devDependencies": {
52+
"@cloudflare/vite-plugin": "1.32.2",
53+
"@eslint/js": "9.39.1",
54+
"@tailwindcss/vite": "^4.2.2",
55+
"@types/crypto-js": "^4.2.2",
56+
"@types/mime-types": "^3.0.1",
57+
"@types/node": "^24.12.0",
58+
"@types/react": "19.2.7",
59+
"@types/react-dom": "19.2.3",
60+
"@types/react-helmet": "^6.1.11",
61+
"@vitejs/plugin-react": "^6.0.1",
62+
"concurrently": "^8.2.2",
63+
"drizzle-kit": "^0.31.10",
64+
"globals": "16.5.0",
65+
"oxfmt": "^0.35.0",
66+
"oxlint": "^1.58.0",
67+
"rimraf": "^6.1.3",
68+
"shadcn": "^4.2.0",
69+
"typescript": "~5.9.3",
70+
"vite": "^8.0.8",
71+
"vitest": "^4.1.4",
72+
"wrangler": "^4.80.0"
73+
},
74+
"cloudflare": {
75+
"label": "Cloud Storage",
76+
"products": [
77+
"Workers"
78+
],
79+
"categories": [],
80+
"publish": true
81+
}
82+
}

0 commit comments

Comments
 (0)