@lark-apaas/coding-templates 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +128 -0
  3. package/meta.json +22 -0
  4. package/package.json +22 -0
  5. package/template-html/README.md +148 -0
  6. package/template-html/_gitignore +2 -0
  7. package/template-html/index.html +22 -0
  8. package/template-html/package.json +12 -0
  9. package/template-html/routes.json +1 -0
  10. package/template-html/scripts/build.sh +31 -0
  11. package/template-nextjs-fullstack/README.md +169 -0
  12. package/template-nextjs-fullstack/_env.local.example +1 -0
  13. package/template-nextjs-fullstack/_gitignore +41 -0
  14. package/template-nextjs-fullstack/components.json +25 -0
  15. package/template-nextjs-fullstack/drizzle.config.ts +10 -0
  16. package/template-nextjs-fullstack/eslint.config.js +15 -0
  17. package/template-nextjs-fullstack/next.config.ts +5 -0
  18. package/template-nextjs-fullstack/package.json +85 -0
  19. package/template-nextjs-fullstack/postcss.config.js +8 -0
  20. package/template-nextjs-fullstack/scripts/build.sh +37 -0
  21. package/template-nextjs-fullstack/src/app/favicon.ico +0 -0
  22. package/template-nextjs-fullstack/src/app/globals.css +130 -0
  23. package/template-nextjs-fullstack/src/app/layout.tsx +24 -0
  24. package/template-nextjs-fullstack/src/app/page.tsx +69 -0
  25. package/template-nextjs-fullstack/src/app/todos/actions.ts +37 -0
  26. package/template-nextjs-fullstack/src/app/todos/page.tsx +26 -0
  27. package/template-nextjs-fullstack/src/app/todos/todo-form.tsx +27 -0
  28. package/template-nextjs-fullstack/src/app/todos/todo-list.tsx +44 -0
  29. package/template-nextjs-fullstack/src/components/header.tsx +32 -0
  30. package/template-nextjs-fullstack/src/components/theme-provider.tsx +8 -0
  31. package/template-nextjs-fullstack/src/components/ui/README.md +134 -0
  32. package/template-nextjs-fullstack/src/components/ui/accordion.tsx +66 -0
  33. package/template-nextjs-fullstack/src/components/ui/alert-dialog.tsx +157 -0
  34. package/template-nextjs-fullstack/src/components/ui/alert.tsx +71 -0
  35. package/template-nextjs-fullstack/src/components/ui/aspect-ratio.tsx +11 -0
  36. package/template-nextjs-fullstack/src/components/ui/avatar.tsx +53 -0
  37. package/template-nextjs-fullstack/src/components/ui/badge.tsx +42 -0
  38. package/template-nextjs-fullstack/src/components/ui/breadcrumb.tsx +109 -0
  39. package/template-nextjs-fullstack/src/components/ui/button-group.tsx +83 -0
  40. package/template-nextjs-fullstack/src/components/ui/button.tsx +69 -0
  41. package/template-nextjs-fullstack/src/components/ui/calendar.tsx +213 -0
  42. package/template-nextjs-fullstack/src/components/ui/card.tsx +82 -0
  43. package/template-nextjs-fullstack/src/components/ui/carousel.tsx +241 -0
  44. package/template-nextjs-fullstack/src/components/ui/chart.tsx +357 -0
  45. package/template-nextjs-fullstack/src/components/ui/checkbox.tsx +32 -0
  46. package/template-nextjs-fullstack/src/components/ui/collapsible.tsx +33 -0
  47. package/template-nextjs-fullstack/src/components/ui/command.tsx +208 -0
  48. package/template-nextjs-fullstack/src/components/ui/context-menu.tsx +324 -0
  49. package/template-nextjs-fullstack/src/components/ui/dialog.tsx +143 -0
  50. package/template-nextjs-fullstack/src/components/ui/drawer.tsx +135 -0
  51. package/template-nextjs-fullstack/src/components/ui/dropdown-menu.tsx +329 -0
  52. package/template-nextjs-fullstack/src/components/ui/empty.tsx +104 -0
  53. package/template-nextjs-fullstack/src/components/ui/field.tsx +248 -0
  54. package/template-nextjs-fullstack/src/components/ui/form.tsx +167 -0
  55. package/template-nextjs-fullstack/src/components/ui/hover-card.tsx +44 -0
  56. package/template-nextjs-fullstack/src/components/ui/icons/file-ae-colorful-icon.tsx +21 -0
  57. package/template-nextjs-fullstack/src/components/ui/icons/file-ai-colorful-icon.tsx +36 -0
  58. package/template-nextjs-fullstack/src/components/ui/icons/file-android-colorful-icon.tsx +33 -0
  59. package/template-nextjs-fullstack/src/components/ui/icons/file-audio-colorful-icon.tsx +21 -0
  60. package/template-nextjs-fullstack/src/components/ui/icons/file-code-colorful-icon.tsx +28 -0
  61. package/template-nextjs-fullstack/src/components/ui/icons/file-csv-colorful-icon.tsx +21 -0
  62. package/template-nextjs-fullstack/src/components/ui/icons/file-eml-colorful-icon.tsx +29 -0
  63. package/template-nextjs-fullstack/src/components/ui/icons/file-ios-colorful-icon.tsx +25 -0
  64. package/template-nextjs-fullstack/src/components/ui/icons/file-keynote-colorful-icon.tsx +29 -0
  65. package/template-nextjs-fullstack/src/components/ui/icons/file-pages-colorful-icon.tsx +29 -0
  66. package/template-nextjs-fullstack/src/components/ui/icons/file-ps-colorful-icon.tsx +21 -0
  67. package/template-nextjs-fullstack/src/components/ui/icons/file-sketch-colorful-icon.tsx +21 -0
  68. package/template-nextjs-fullstack/src/components/ui/icons/file-slide-colorful-icon.tsx +21 -0
  69. package/template-nextjs-fullstack/src/components/ui/icons/file-vcf-colorful-icon.tsx +29 -0
  70. package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +23 -0
  71. package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +27 -0
  72. package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +20 -0
  73. package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +21 -0
  74. package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +12 -0
  75. package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +14 -0
  76. package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +23 -0
  77. package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +38 -0
  78. package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +21 -0
  79. package/template-nextjs-fullstack/src/components/ui/image.tsx +183 -0
  80. package/template-nextjs-fullstack/src/components/ui/input-group.tsx +166 -0
  81. package/template-nextjs-fullstack/src/components/ui/input-otp.tsx +77 -0
  82. package/template-nextjs-fullstack/src/components/ui/input.tsx +21 -0
  83. package/template-nextjs-fullstack/src/components/ui/item.tsx +193 -0
  84. package/template-nextjs-fullstack/src/components/ui/kbd.tsx +28 -0
  85. package/template-nextjs-fullstack/src/components/ui/label.tsx +24 -0
  86. package/template-nextjs-fullstack/src/components/ui/menubar.tsx +348 -0
  87. package/template-nextjs-fullstack/src/components/ui/native-select.tsx +48 -0
  88. package/template-nextjs-fullstack/src/components/ui/navigation-menu.tsx +168 -0
  89. package/template-nextjs-fullstack/src/components/ui/pagination.tsx +127 -0
  90. package/template-nextjs-fullstack/src/components/ui/popover.tsx +48 -0
  91. package/template-nextjs-fullstack/src/components/ui/progress.tsx +31 -0
  92. package/template-nextjs-fullstack/src/components/ui/radio-group.tsx +45 -0
  93. package/template-nextjs-fullstack/src/components/ui/resizable.tsx +56 -0
  94. package/template-nextjs-fullstack/src/components/ui/scroll-area.tsx +58 -0
  95. package/template-nextjs-fullstack/src/components/ui/select.tsx +243 -0
  96. package/template-nextjs-fullstack/src/components/ui/separator.tsx +28 -0
  97. package/template-nextjs-fullstack/src/components/ui/sheet.tsx +139 -0
  98. package/template-nextjs-fullstack/src/components/ui/sidebar.tsx +727 -0
  99. package/template-nextjs-fullstack/src/components/ui/skeleton.tsx +13 -0
  100. package/template-nextjs-fullstack/src/components/ui/slider.tsx +87 -0
  101. package/template-nextjs-fullstack/src/components/ui/sonner.tsx +67 -0
  102. package/template-nextjs-fullstack/src/components/ui/spinner.tsx +16 -0
  103. package/template-nextjs-fullstack/src/components/ui/streamdown.tsx +186 -0
  104. package/template-nextjs-fullstack/src/components/ui/switch.tsx +31 -0
  105. package/template-nextjs-fullstack/src/components/ui/table.tsx +116 -0
  106. package/template-nextjs-fullstack/src/components/ui/tabs.tsx +66 -0
  107. package/template-nextjs-fullstack/src/components/ui/textarea.tsx +18 -0
  108. package/template-nextjs-fullstack/src/components/ui/toggle-group.tsx +83 -0
  109. package/template-nextjs-fullstack/src/components/ui/toggle.tsx +47 -0
  110. package/template-nextjs-fullstack/src/components/ui/tooltip.tsx +61 -0
  111. package/template-nextjs-fullstack/src/db/index.ts +8 -0
  112. package/template-nextjs-fullstack/src/db/schema.ts +11 -0
  113. package/template-nextjs-fullstack/src/hooks/use-mobile.ts +19 -0
  114. package/template-nextjs-fullstack/src/lib/utils.ts +6 -0
  115. package/template-nextjs-fullstack/tailwind.config.ts +10 -0
  116. package/template-nextjs-fullstack/tsconfig.json +34 -0
  117. package/template-nextjs-static/README.md +80 -0
  118. package/template-nextjs-static/_gitignore +41 -0
  119. package/template-nextjs-static/components.json +25 -0
  120. package/template-nextjs-static/eslint.config.js +15 -0
  121. package/template-nextjs-static/next.config.ts +8 -0
  122. package/template-nextjs-static/package.json +77 -0
  123. package/template-nextjs-static/postcss.config.js +8 -0
  124. package/template-nextjs-static/public/favicon.ico +0 -0
  125. package/template-nextjs-static/scripts/build.sh +36 -0
  126. package/template-nextjs-static/src/components/header.tsx +30 -0
  127. package/template-nextjs-static/src/components/theme-provider.tsx +6 -0
  128. package/template-nextjs-static/src/components/ui/README.md +134 -0
  129. package/template-nextjs-static/src/components/ui/accordion.tsx +66 -0
  130. package/template-nextjs-static/src/components/ui/alert-dialog.tsx +157 -0
  131. package/template-nextjs-static/src/components/ui/alert.tsx +71 -0
  132. package/template-nextjs-static/src/components/ui/aspect-ratio.tsx +11 -0
  133. package/template-nextjs-static/src/components/ui/avatar.tsx +53 -0
  134. package/template-nextjs-static/src/components/ui/badge.tsx +42 -0
  135. package/template-nextjs-static/src/components/ui/breadcrumb.tsx +109 -0
  136. package/template-nextjs-static/src/components/ui/button-group.tsx +83 -0
  137. package/template-nextjs-static/src/components/ui/button.tsx +69 -0
  138. package/template-nextjs-static/src/components/ui/calendar.tsx +213 -0
  139. package/template-nextjs-static/src/components/ui/card.tsx +82 -0
  140. package/template-nextjs-static/src/components/ui/carousel.tsx +241 -0
  141. package/template-nextjs-static/src/components/ui/chart.tsx +357 -0
  142. package/template-nextjs-static/src/components/ui/checkbox.tsx +32 -0
  143. package/template-nextjs-static/src/components/ui/collapsible.tsx +33 -0
  144. package/template-nextjs-static/src/components/ui/command.tsx +208 -0
  145. package/template-nextjs-static/src/components/ui/context-menu.tsx +324 -0
  146. package/template-nextjs-static/src/components/ui/dialog.tsx +143 -0
  147. package/template-nextjs-static/src/components/ui/drawer.tsx +135 -0
  148. package/template-nextjs-static/src/components/ui/dropdown-menu.tsx +329 -0
  149. package/template-nextjs-static/src/components/ui/empty.tsx +104 -0
  150. package/template-nextjs-static/src/components/ui/field.tsx +248 -0
  151. package/template-nextjs-static/src/components/ui/form.tsx +167 -0
  152. package/template-nextjs-static/src/components/ui/hover-card.tsx +44 -0
  153. package/template-nextjs-static/src/components/ui/icons/file-ae-colorful-icon.tsx +21 -0
  154. package/template-nextjs-static/src/components/ui/icons/file-ai-colorful-icon.tsx +36 -0
  155. package/template-nextjs-static/src/components/ui/icons/file-android-colorful-icon.tsx +33 -0
  156. package/template-nextjs-static/src/components/ui/icons/file-audio-colorful-icon.tsx +21 -0
  157. package/template-nextjs-static/src/components/ui/icons/file-code-colorful-icon.tsx +28 -0
  158. package/template-nextjs-static/src/components/ui/icons/file-csv-colorful-icon.tsx +21 -0
  159. package/template-nextjs-static/src/components/ui/icons/file-eml-colorful-icon.tsx +29 -0
  160. package/template-nextjs-static/src/components/ui/icons/file-ios-colorful-icon.tsx +25 -0
  161. package/template-nextjs-static/src/components/ui/icons/file-keynote-colorful-icon.tsx +29 -0
  162. package/template-nextjs-static/src/components/ui/icons/file-pages-colorful-icon.tsx +29 -0
  163. package/template-nextjs-static/src/components/ui/icons/file-ps-colorful-icon.tsx +21 -0
  164. package/template-nextjs-static/src/components/ui/icons/file-sketch-colorful-icon.tsx +21 -0
  165. package/template-nextjs-static/src/components/ui/icons/file-slide-colorful-icon.tsx +21 -0
  166. package/template-nextjs-static/src/components/ui/icons/file-vcf-colorful-icon.tsx +29 -0
  167. package/template-nextjs-static/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +23 -0
  168. package/template-nextjs-static/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +27 -0
  169. package/template-nextjs-static/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +20 -0
  170. package/template-nextjs-static/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +21 -0
  171. package/template-nextjs-static/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +12 -0
  172. package/template-nextjs-static/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +14 -0
  173. package/template-nextjs-static/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +23 -0
  174. package/template-nextjs-static/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +38 -0
  175. package/template-nextjs-static/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +21 -0
  176. package/template-nextjs-static/src/components/ui/image.tsx +183 -0
  177. package/template-nextjs-static/src/components/ui/input-group.tsx +166 -0
  178. package/template-nextjs-static/src/components/ui/input-otp.tsx +77 -0
  179. package/template-nextjs-static/src/components/ui/input.tsx +21 -0
  180. package/template-nextjs-static/src/components/ui/item.tsx +193 -0
  181. package/template-nextjs-static/src/components/ui/kbd.tsx +28 -0
  182. package/template-nextjs-static/src/components/ui/label.tsx +24 -0
  183. package/template-nextjs-static/src/components/ui/menubar.tsx +348 -0
  184. package/template-nextjs-static/src/components/ui/native-select.tsx +48 -0
  185. package/template-nextjs-static/src/components/ui/navigation-menu.tsx +168 -0
  186. package/template-nextjs-static/src/components/ui/pagination.tsx +127 -0
  187. package/template-nextjs-static/src/components/ui/popover.tsx +48 -0
  188. package/template-nextjs-static/src/components/ui/progress.tsx +31 -0
  189. package/template-nextjs-static/src/components/ui/radio-group.tsx +45 -0
  190. package/template-nextjs-static/src/components/ui/resizable.tsx +56 -0
  191. package/template-nextjs-static/src/components/ui/scroll-area.tsx +58 -0
  192. package/template-nextjs-static/src/components/ui/select.tsx +243 -0
  193. package/template-nextjs-static/src/components/ui/separator.tsx +28 -0
  194. package/template-nextjs-static/src/components/ui/sheet.tsx +139 -0
  195. package/template-nextjs-static/src/components/ui/sidebar.tsx +727 -0
  196. package/template-nextjs-static/src/components/ui/skeleton.tsx +13 -0
  197. package/template-nextjs-static/src/components/ui/slider.tsx +87 -0
  198. package/template-nextjs-static/src/components/ui/sonner.tsx +67 -0
  199. package/template-nextjs-static/src/components/ui/spinner.tsx +16 -0
  200. package/template-nextjs-static/src/components/ui/streamdown.tsx +186 -0
  201. package/template-nextjs-static/src/components/ui/switch.tsx +31 -0
  202. package/template-nextjs-static/src/components/ui/table.tsx +116 -0
  203. package/template-nextjs-static/src/components/ui/tabs.tsx +66 -0
  204. package/template-nextjs-static/src/components/ui/textarea.tsx +18 -0
  205. package/template-nextjs-static/src/components/ui/toggle-group.tsx +83 -0
  206. package/template-nextjs-static/src/components/ui/toggle.tsx +47 -0
  207. package/template-nextjs-static/src/components/ui/tooltip.tsx +61 -0
  208. package/template-nextjs-static/src/hooks/use-mobile.ts +19 -0
  209. package/template-nextjs-static/src/lib/utils.ts +6 -0
  210. package/template-nextjs-static/src/pages/_app.tsx +11 -0
  211. package/template-nextjs-static/src/pages/_document.tsx +13 -0
  212. package/template-nextjs-static/src/pages/hello.tsx +32 -0
  213. package/template-nextjs-static/src/pages/index.tsx +76 -0
  214. package/template-nextjs-static/src/styles/globals.css +143 -0
  215. package/template-nextjs-static/tailwind.config.ts +10 -0
  216. package/template-nextjs-static/tsconfig.json +34 -0
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "mclaw": {
6
+ "stack": "nextjs",
7
+ "stackVersion": "0.1.0"
8
+ },
9
+ "scripts": {
10
+ "dev": "next dev",
11
+ "build": "bash scripts/build.sh",
12
+ "start": "next start",
13
+ "lint": "eslint src",
14
+ "db:generate": "drizzle-kit generate",
15
+ "db:migrate": "drizzle-kit migrate",
16
+ "db:push": "drizzle-kit push",
17
+ "db:studio": "drizzle-kit studio"
18
+ },
19
+ "dependencies": {
20
+ "@base-ui/react": "^1.3.0",
21
+ "@radix-ui/react-accordion": "^1.2.12",
22
+ "@radix-ui/react-alert-dialog": "^1.1.15",
23
+ "@radix-ui/react-aspect-ratio": "^1.1.7",
24
+ "@radix-ui/react-avatar": "^1.1.10",
25
+ "@radix-ui/react-checkbox": "^1.3.3",
26
+ "@radix-ui/react-collapsible": "^1.1.12",
27
+ "@radix-ui/react-context-menu": "^2.2.16",
28
+ "@radix-ui/react-dialog": "^1.1.15",
29
+ "@radix-ui/react-dropdown-menu": "^2.1.16",
30
+ "@radix-ui/react-hover-card": "^1.1.15",
31
+ "@radix-ui/react-label": "^2.1.7",
32
+ "@radix-ui/react-menubar": "^1.1.16",
33
+ "@radix-ui/react-navigation-menu": "^1.2.14",
34
+ "@radix-ui/react-popover": "^1.1.15",
35
+ "@radix-ui/react-progress": "^1.1.7",
36
+ "@radix-ui/react-radio-group": "^1.3.8",
37
+ "@radix-ui/react-scroll-area": "^1.2.10",
38
+ "@radix-ui/react-select": "^2.2.6",
39
+ "@radix-ui/react-separator": "^1.1.7",
40
+ "@radix-ui/react-slider": "^1.3.6",
41
+ "@radix-ui/react-slot": "^1.2.3",
42
+ "@radix-ui/react-switch": "^1.2.6",
43
+ "@radix-ui/react-tabs": "^1.1.13",
44
+ "@radix-ui/react-toggle": "^1.1.10",
45
+ "@radix-ui/react-toggle-group": "^1.1.11",
46
+ "@radix-ui/react-tooltip": "^1.2.8",
47
+ "class-variance-authority": "^0.7.1",
48
+ "clsx": "^2.1.1",
49
+ "cmdk": "^1.1.1",
50
+ "drizzle-orm": "^0.45.1",
51
+ "embla-carousel-react": "^8.6.0",
52
+ "es-toolkit": "^1.43.0",
53
+ "framer-motion": "^12.36.0",
54
+ "input-otp": "^1.4.2",
55
+ "lucide-react": "^0.577.0",
56
+ "next": "16.1.6",
57
+ "next-themes": "^0.4.6",
58
+ "postgres": "^3.4.8",
59
+ "react": "19.2.3",
60
+ "react-day-picker": "^9.11.1",
61
+ "react-dom": "19.2.3",
62
+ "react-hook-form": "^7.65.0",
63
+ "react-resizable-panels": "^3.0.6",
64
+ "recharts": "^2.15.4",
65
+ "shadcn": "^4.0.8",
66
+ "sonner": "^2.0.7",
67
+ "streamdown": "^1.6.10",
68
+ "tailwind-merge": "^3.5.0",
69
+ "tw-animate-css": "^1.4.0",
70
+ "vaul": "^1.1.2",
71
+ "zod": "^4.3.6"
72
+ },
73
+ "devDependencies": {
74
+ "@eslint/js": "^9",
75
+ "@tailwindcss/postcss": "^4",
76
+ "@types/node": "^20",
77
+ "@types/react": "^19",
78
+ "@types/react-dom": "^19",
79
+ "drizzle-kit": "^0.31.9",
80
+ "eslint": "^9",
81
+ "tailwindcss": "^4",
82
+ "typescript": "^5",
83
+ "typescript-eslint": "^8"
84
+ }
85
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @type {import('postcss-load-config').Config}
3
+ */
4
+ module.exports = {
5
+ plugins: {
6
+ '@tailwindcss/postcss': {},
7
+ },
8
+ };
@@ -0,0 +1,37 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5
+ OUTPUT="$ROOT/dist/output"
6
+ OUTPUT_RESOURCE="$ROOT/dist/output_resource"
7
+
8
+ # 清理
9
+ rm -rf "$ROOT/dist"
10
+
11
+ # 1. Next.js 构建 → .next/
12
+ npx next build
13
+
14
+ # 2. standalone → dist/output/
15
+ mkdir -p "$OUTPUT"
16
+ cp -r "$ROOT/.next/standalone/." "$OUTPUT/"
17
+
18
+ # 复制 public/ 到 standalone
19
+ if [ -d "$ROOT/public" ]; then
20
+ cp -r "$ROOT/public" "$OUTPUT/public"
21
+ fi
22
+
23
+ # 3. static/ → dist/output_resource/(JS/CSS/字体,上传到 CDN)
24
+ if [ -d "$ROOT/.next/static" ]; then
25
+ mkdir -p "$OUTPUT_RESOURCE/_next"
26
+ cp -r "$ROOT/.next/static" "$OUTPUT_RESOURCE/_next/"
27
+ fi
28
+
29
+ # 复制 .next/static 到 standalone
30
+ if [ -d "$ROOT/.next/static" ]; then
31
+ mkdir -p "$OUTPUT/.next"
32
+ cp -r "$ROOT/.next/static" "$OUTPUT/.next/"
33
+ fi
34
+
35
+ echo "Build complete"
36
+ echo " Standalone → dist/output/"
37
+ [ -d "$OUTPUT_RESOURCE" ] && echo " Resource → dist/output_resource/"
@@ -0,0 +1,130 @@
1
+ @import "tailwindcss";
2
+ @import "tw-animate-css";
3
+ @import "shadcn/tailwind.css";
4
+ @config "../../tailwind.config.ts";
5
+
6
+ @custom-variant dark (&:is(.dark *));
7
+
8
+ @theme inline {
9
+ --color-background: var(--background);
10
+ --color-foreground: var(--foreground);
11
+ --font-sans: var(--font-sans);
12
+ --font-mono: var(--font-geist-mono);
13
+ --color-sidebar-ring: var(--sidebar-ring);
14
+ --color-sidebar-border: var(--sidebar-border);
15
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
16
+ --color-sidebar-accent: var(--sidebar-accent);
17
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
18
+ --color-sidebar-primary: var(--sidebar-primary);
19
+ --color-sidebar-foreground: var(--sidebar-foreground);
20
+ --color-sidebar: var(--sidebar);
21
+ --color-chart-5: var(--chart-5);
22
+ --color-chart-4: var(--chart-4);
23
+ --color-chart-3: var(--chart-3);
24
+ --color-chart-2: var(--chart-2);
25
+ --color-chart-1: var(--chart-1);
26
+ --color-ring: var(--ring);
27
+ --color-input: var(--input);
28
+ --color-border: var(--border);
29
+ --color-destructive: var(--destructive);
30
+ --color-accent-foreground: var(--accent-foreground);
31
+ --color-accent: var(--accent);
32
+ --color-muted-foreground: var(--muted-foreground);
33
+ --color-muted: var(--muted);
34
+ --color-secondary-foreground: var(--secondary-foreground);
35
+ --color-secondary: var(--secondary);
36
+ --color-primary-foreground: var(--primary-foreground);
37
+ --color-primary: var(--primary);
38
+ --color-popover-foreground: var(--popover-foreground);
39
+ --color-popover: var(--popover);
40
+ --color-card-foreground: var(--card-foreground);
41
+ --color-card: var(--card);
42
+ --radius-sm: calc(var(--radius) * 0.6);
43
+ --radius-md: calc(var(--radius) * 0.8);
44
+ --radius-lg: var(--radius);
45
+ --radius-xl: calc(var(--radius) * 1.4);
46
+ --radius-2xl: calc(var(--radius) * 1.8);
47
+ --radius-3xl: calc(var(--radius) * 2.2);
48
+ --radius-4xl: calc(var(--radius) * 2.6);
49
+ }
50
+
51
+ :root {
52
+ --background: oklch(1 0 0);
53
+ --foreground: oklch(0.145 0 0);
54
+ --card: oklch(1 0 0);
55
+ --card-foreground: oklch(0.145 0 0);
56
+ --popover: oklch(1 0 0);
57
+ --popover-foreground: oklch(0.145 0 0);
58
+ --primary: oklch(0.205 0 0);
59
+ --primary-foreground: oklch(0.985 0 0);
60
+ --secondary: oklch(0.97 0 0);
61
+ --secondary-foreground: oklch(0.205 0 0);
62
+ --muted: oklch(0.97 0 0);
63
+ --muted-foreground: oklch(0.556 0 0);
64
+ --accent: oklch(0.97 0 0);
65
+ --accent-foreground: oklch(0.205 0 0);
66
+ --destructive: oklch(0.577 0.245 27.325);
67
+ --border: oklch(0.922 0 0);
68
+ --input: oklch(0.922 0 0);
69
+ --ring: oklch(0.708 0 0);
70
+ --chart-1: oklch(0.809 0.105 251.813);
71
+ --chart-2: oklch(0.623 0.214 259.815);
72
+ --chart-3: oklch(0.546 0.245 262.881);
73
+ --chart-4: oklch(0.488 0.243 264.376);
74
+ --chart-5: oklch(0.424 0.199 265.638);
75
+ --radius: 0.625rem;
76
+ --sidebar: oklch(0.985 0 0);
77
+ --sidebar-foreground: oklch(0.145 0 0);
78
+ --sidebar-primary: oklch(0.205 0 0);
79
+ --sidebar-primary-foreground: oklch(0.985 0 0);
80
+ --sidebar-accent: oklch(0.97 0 0);
81
+ --sidebar-accent-foreground: oklch(0.205 0 0);
82
+ --sidebar-border: oklch(0.922 0 0);
83
+ --sidebar-ring: oklch(0.708 0 0);
84
+ }
85
+
86
+ .dark {
87
+ --background: oklch(0.145 0 0);
88
+ --foreground: oklch(0.985 0 0);
89
+ --card: oklch(0.205 0 0);
90
+ --card-foreground: oklch(0.985 0 0);
91
+ --popover: oklch(0.205 0 0);
92
+ --popover-foreground: oklch(0.985 0 0);
93
+ --primary: oklch(0.922 0 0);
94
+ --primary-foreground: oklch(0.205 0 0);
95
+ --secondary: oklch(0.269 0 0);
96
+ --secondary-foreground: oklch(0.985 0 0);
97
+ --muted: oklch(0.269 0 0);
98
+ --muted-foreground: oklch(0.708 0 0);
99
+ --accent: oklch(0.269 0 0);
100
+ --accent-foreground: oklch(0.985 0 0);
101
+ --destructive: oklch(0.704 0.191 22.216);
102
+ --border: oklch(1 0 0 / 10%);
103
+ --input: oklch(1 0 0 / 15%);
104
+ --ring: oklch(0.556 0 0);
105
+ --chart-1: oklch(0.809 0.105 251.813);
106
+ --chart-2: oklch(0.623 0.214 259.815);
107
+ --chart-3: oklch(0.546 0.245 262.881);
108
+ --chart-4: oklch(0.488 0.243 264.376);
109
+ --chart-5: oklch(0.424 0.199 265.638);
110
+ --sidebar: oklch(0.205 0 0);
111
+ --sidebar-foreground: oklch(0.985 0 0);
112
+ --sidebar-primary: oklch(0.488 0.243 264.376);
113
+ --sidebar-primary-foreground: oklch(0.985 0 0);
114
+ --sidebar-accent: oklch(0.269 0 0);
115
+ --sidebar-accent-foreground: oklch(0.985 0 0);
116
+ --sidebar-border: oklch(1 0 0 / 10%);
117
+ --sidebar-ring: oklch(0.556 0 0);
118
+ }
119
+
120
+ @layer base {
121
+ * {
122
+ @apply border-border outline-ring/50;
123
+ }
124
+ body {
125
+ @apply bg-background text-foreground;
126
+ }
127
+ html {
128
+ @apply font-sans;
129
+ }
130
+ }
@@ -0,0 +1,24 @@
1
+ import type { Metadata } from "next";
2
+ import { Geist, Geist_Mono } from "next/font/google";
3
+ import "./globals.css";
4
+ import { ThemeProvider } from "@/components/theme-provider";
5
+
6
+ const geistSans = Geist({ variable: "--font-geist-sans", subsets: ["latin"] });
7
+ const geistMono = Geist_Mono({ variable: "--font-geist-mono", subsets: ["latin"] });
8
+
9
+ export const metadata: Metadata = {
10
+ title: "OpenClaw Fullstack",
11
+ description: "Next.js Fullstack Template with Drizzle + PostgreSQL",
12
+ };
13
+
14
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
15
+ return (
16
+ <html lang="zh" suppressHydrationWarning>
17
+ <body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
18
+ <ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
19
+ {children}
20
+ </ThemeProvider>
21
+ </body>
22
+ </html>
23
+ );
24
+ }
@@ -0,0 +1,69 @@
1
+ import { Button } from "@/components/ui/button";
2
+ import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
3
+ import { Badge } from "@/components/ui/badge";
4
+ import { Header } from "@/components/header";
5
+ import { Database, Zap, Shield } from "lucide-react";
6
+ import Link from "next/link";
7
+
8
+ export default function Home() {
9
+ return (
10
+ <div className="min-h-screen bg-background">
11
+ <Header />
12
+ <main>
13
+ <section className="container mx-auto px-4 py-24 text-center">
14
+ <Badge variant="secondary" className="mb-4">Next.js Fullstack</Badge>
15
+ <h1 className="text-4xl font-bold tracking-tight sm:text-6xl mb-6">
16
+ 全栈应用模版
17
+ </h1>
18
+ <p className="text-lg text-muted-foreground max-w-2xl mx-auto mb-8">
19
+ 基于 Next.js + Drizzle ORM + PostgreSQL 的全栈模版,Server Actions 驱动数据变更,为 AI 协作开发而生。
20
+ </p>
21
+ <div className="flex gap-4 justify-center">
22
+ <Link href="/todos">
23
+ <Button size="lg">查看 Todos 示例</Button>
24
+ </Link>
25
+ <Button size="lg" variant="outline">了解更多</Button>
26
+ </div>
27
+ </section>
28
+
29
+ <section className="container mx-auto px-4 py-16">
30
+ <div className="grid gap-6 md:grid-cols-3">
31
+ <Card>
32
+ <CardHeader>
33
+ <Database className="h-10 w-10 mb-2 text-primary" />
34
+ <CardTitle>类型安全数据库</CardTitle>
35
+ <CardDescription>
36
+ Drizzle ORM 提供端到端类型安全,schema 即代码,迁移自动生成。
37
+ </CardDescription>
38
+ </CardHeader>
39
+ </Card>
40
+ <Card>
41
+ <CardHeader>
42
+ <Zap className="h-10 w-10 mb-2 text-primary" />
43
+ <CardTitle>Server Actions</CardTitle>
44
+ <CardDescription>
45
+ 数据变更直接写在服务端函数里,无需手写 API 路由,AI 生成代码更高效。
46
+ </CardDescription>
47
+ </CardHeader>
48
+ </Card>
49
+ <Card>
50
+ <CardHeader>
51
+ <Shield className="h-10 w-10 mb-2 text-primary" />
52
+ <CardTitle>数据校验</CardTitle>
53
+ <CardDescription>
54
+ Zod schema 校验贯穿前后端,类型安全从表单到数据库全链路保障。
55
+ </CardDescription>
56
+ </CardHeader>
57
+ </Card>
58
+ </div>
59
+ </section>
60
+
61
+ <footer className="border-t py-8">
62
+ <div className="container mx-auto px-4 text-center text-sm text-muted-foreground">
63
+ OpenClaw Template — Built for Vibe Coding
64
+ </div>
65
+ </footer>
66
+ </main>
67
+ </div>
68
+ );
69
+ }
@@ -0,0 +1,37 @@
1
+ "use server";
2
+
3
+ import { db } from "@/db";
4
+ import { todos } from "@/db/schema";
5
+ import { eq } from "drizzle-orm";
6
+ import { revalidatePath } from "next/cache";
7
+ import { z } from "zod";
8
+
9
+ const createTodoSchema = z.object({
10
+ title: z.string().min(1, "标题不能为空").max(200, "标题不能超过200字"),
11
+ });
12
+
13
+ export async function createTodo(formData: FormData) {
14
+ const parsed = createTodoSchema.safeParse({
15
+ title: formData.get("title"),
16
+ });
17
+
18
+ if (!parsed.success) {
19
+ return { error: parsed.error.flatten().fieldErrors.title?.[0] };
20
+ }
21
+
22
+ await db.insert(todos).values({ title: parsed.data.title });
23
+ revalidatePath("/todos");
24
+ }
25
+
26
+ export async function toggleTodo(id: number) {
27
+ const [todo] = await db.select().from(todos).where(eq(todos.id, id));
28
+ if (todo) {
29
+ await db.update(todos).set({ completed: !todo.completed }).where(eq(todos.id, id));
30
+ }
31
+ revalidatePath("/todos");
32
+ }
33
+
34
+ export async function deleteTodo(id: number) {
35
+ await db.delete(todos).where(eq(todos.id, id));
36
+ revalidatePath("/todos");
37
+ }
@@ -0,0 +1,26 @@
1
+ import { db } from "@/db";
2
+ import { todos } from "@/db/schema";
3
+ import { desc } from "drizzle-orm";
4
+ import { Header } from "@/components/header";
5
+ import { TodoList } from "./todo-list";
6
+ import { TodoForm } from "./todo-form";
7
+
8
+ export const dynamic = "force-dynamic";
9
+
10
+ export default async function TodosPage() {
11
+ const allTodos = await db.select().from(todos).orderBy(desc(todos.createdAt));
12
+
13
+ return (
14
+ <div className="min-h-screen bg-background">
15
+ <Header />
16
+ <main className="container mx-auto px-4 py-8 max-w-2xl">
17
+ <h1 className="text-3xl font-bold mb-8">Todos 示例</h1>
18
+ <p className="text-muted-foreground mb-6">
19
+ 完整的 CRUD 示例,使用 Server Actions + Drizzle ORM + PostgreSQL。
20
+ </p>
21
+ <TodoForm />
22
+ <TodoList todos={allTodos} />
23
+ </main>
24
+ </div>
25
+ );
26
+ }
@@ -0,0 +1,27 @@
1
+ "use client";
2
+
3
+ import { useRef } from "react";
4
+ import { Button } from "@/components/ui/button";
5
+ import { Input } from "@/components/ui/input";
6
+ import { createTodo } from "./actions";
7
+ import { Plus } from "lucide-react";
8
+
9
+ export function TodoForm() {
10
+ const formRef = useRef<HTMLFormElement>(null);
11
+
12
+ return (
13
+ <form
14
+ ref={formRef}
15
+ action={async (formData) => {
16
+ await createTodo(formData);
17
+ formRef.current?.reset();
18
+ }}
19
+ className="flex gap-2 mb-6"
20
+ >
21
+ <Input name="title" placeholder="添加新的待办事项..." className="flex-1" />
22
+ <Button type="submit" size="icon">
23
+ <Plus className="h-4 w-4" />
24
+ </Button>
25
+ </form>
26
+ );
27
+ }
@@ -0,0 +1,44 @@
1
+ "use client";
2
+
3
+ import { Card, CardContent } from "@/components/ui/card";
4
+ import { Button } from "@/components/ui/button";
5
+ import { toggleTodo, deleteTodo } from "./actions";
6
+ import { Trash2, Check } from "lucide-react";
7
+ import type { Todo } from "@/db/schema";
8
+
9
+ export function TodoList({ todos }: { todos: Todo[] }) {
10
+ if (todos.length === 0) {
11
+ return (
12
+ <p className="text-center text-muted-foreground py-8">
13
+ 还没有待办事项,添加一个吧!
14
+ </p>
15
+ );
16
+ }
17
+
18
+ return (
19
+ <div className="space-y-2">
20
+ {todos.map((todo) => (
21
+ <Card key={todo.id}>
22
+ <CardContent className="flex items-center justify-between p-4">
23
+ <div className="flex items-center gap-3">
24
+ <Button
25
+ variant={todo.completed ? "default" : "outline"}
26
+ size="icon"
27
+ className="h-6 w-6 rounded-full"
28
+ onClick={() => toggleTodo(todo.id)}
29
+ >
30
+ {todo.completed && <Check className="h-3 w-3" />}
31
+ </Button>
32
+ <span className={todo.completed ? "line-through text-muted-foreground" : ""}>
33
+ {todo.title}
34
+ </span>
35
+ </div>
36
+ <Button variant="ghost" size="icon" onClick={() => deleteTodo(todo.id)}>
37
+ <Trash2 className="h-4 w-4" />
38
+ </Button>
39
+ </CardContent>
40
+ </Card>
41
+ ))}
42
+ </div>
43
+ );
44
+ }
@@ -0,0 +1,32 @@
1
+ "use client";
2
+
3
+ import { Moon, Sun } from "lucide-react";
4
+ import { useTheme } from "next-themes";
5
+ import { Button } from "@/components/ui/button";
6
+ import Link from "next/link";
7
+
8
+ export function Header() {
9
+ const { theme, setTheme } = useTheme();
10
+
11
+ return (
12
+ <header className="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
13
+ <div className="container flex h-14 items-center justify-between mx-auto px-4">
14
+ <div className="flex items-center gap-6">
15
+ <Link href="/" className="font-semibold">OpenClaw</Link>
16
+ <nav className="flex items-center gap-4 text-sm">
17
+ <Link href="/todos" className="text-muted-foreground hover:text-foreground transition-colors">Todos 示例</Link>
18
+ </nav>
19
+ </div>
20
+ <Button
21
+ variant="ghost"
22
+ size="icon"
23
+ onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
24
+ >
25
+ <Sun className="h-5 w-5 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
26
+ <Moon className="absolute h-5 w-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
27
+ <span className="sr-only">切换主题</span>
28
+ </Button>
29
+ </div>
30
+ </header>
31
+ );
32
+ }
@@ -0,0 +1,8 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { ThemeProvider as NextThemesProvider } from "next-themes";
5
+
6
+ export function ThemeProvider({ children, ...props }: React.ComponentProps<typeof NextThemesProvider>) {
7
+ return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
8
+ }
@@ -0,0 +1,134 @@
1
+ # shadcn/ui 组件开发指南
2
+
3
+ ## 核心原则
4
+
5
+ - 组件位置:`/client/src/components/ui/`
6
+ - 图标库:必须使用 `lucide-react`,禁用 Emoji
7
+ - 查阅源码实现:直接读取组件源码了解最新组件实现
8
+ - 交互系统:Button、Badge 使用 elevate 遮罩系统处理 hover/active 状态(通过 `::after` 伪元素叠加 `--elevate-1` / `--elevate-2`)
9
+
10
+ ## 关键组件规范
11
+
12
+ #### 1. Button 组件
13
+
14
+ **导入路径**:`import { Button } from '@/components/ui/button'`
15
+
16
+ **Props**:
17
+ - `variant`: `"link" | "default" | "destructive" | "outline" | "secondary" | "ghost"` - 按钮样式变体
18
+
19
+ ```tsx
20
+ // ✅ 使用变体
21
+ <Button variant="secondary">标准按钮</Button>
22
+
23
+ // ✅ 自定义颜色时必须配对前景色
24
+ <Button className="bg-primary text-primary-foreground">自定义按钮</Button>
25
+ ```
26
+
27
+ #### 2. Badge 组件
28
+
29
+ **导入路径**:`import { Badge } from '@/components/ui/badge'`
30
+
31
+ **Props**:
32
+ - `variant`: `"default" | "destructive" | "outline" | "secondary"` - 样式变体
33
+
34
+ ```tsx
35
+ // ✅ 使用变体
36
+ <Badge>默认</Badge>
37
+ <Badge variant="secondary">次要</Badge>
38
+ <Badge variant="outline">边框</Badge>
39
+ <Badge variant="destructive">危险</Badge>
40
+ ```
41
+
42
+ #### 3. Alert 组件
43
+
44
+ **导入路径**:`import { Alert, AlertTitle, AlertDescription, AlertAction } from '@/components/ui/alert'`
45
+
46
+ **Props**:
47
+ - `variant`: `"default" | "destructive" | "success" | "warning"` - 样式变体
48
+
49
+ ```tsx
50
+ // ✅ default / destructive / success / warning 四种变体
51
+ <Alert variant="success">
52
+ <CheckCircle className="size-4" />
53
+ <AlertTitle>操作成功</AlertTitle>
54
+ <AlertDescription>您的更改已保存</AlertDescription>
55
+ </Alert>
56
+
57
+ <Alert variant="warning">
58
+ <AlertTriangle className="size-4" />
59
+ <AlertTitle>警告</AlertTitle>
60
+ <AlertDescription>请注意检查</AlertDescription>
61
+ </Alert>
62
+
63
+ ```
64
+
65
+ #### 4. Empty 组件
66
+
67
+ **导入路径**:`import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent } from '@/components/ui/empty'`
68
+
69
+ **子组件 Props**:
70
+ - `EmptyMedia` 组件的 `variant`: `"default" | "icon"` - 媒体展示方式
71
+
72
+ ```tsx
73
+ // 标准结构:EmptyHeader 包含 EmptyMedia + EmptyTitle + EmptyDescription
74
+ <Empty>
75
+ <EmptyHeader>
76
+ <EmptyMedia variant="icon">
77
+ <SearchIcon className="size-6" />
78
+ </EmptyMedia>
79
+ <EmptyTitle>暂无数据</EmptyTitle>
80
+ <EmptyDescription>当前没有找到相关内容</EmptyDescription>
81
+ </EmptyHeader>
82
+ <EmptyContent>
83
+ <Button>添加数据</Button>
84
+ </EmptyContent>
85
+ </Empty>
86
+ ```
87
+
88
+ #### 5. Card Padding 系统
89
+
90
+ **导入路径**:`import { CardHeader, CardContent, CardFooter } from '@/components/ui/card'`
91
+
92
+ - `CardHeader`: `p-6` (24px 全方向)
93
+ - `CardContent`: `p-6 pt-0` (与 header 无缝衔接)
94
+ - `CardFooter`: `p-6 pt-0` (与 content 无缝衔接)
95
+
96
+ #### 6. Dialog 组件
97
+
98
+ **导入路径**:`import { Dialog, DialogContent } from '@/components/ui/dialog'`
99
+
100
+ Dialog 默认提供了右上角的close能力,同时也提供了自定义关闭按钮的能力,即通过设置showCloseButton为false来关闭默认的关闭按钮。所以当默认存在close时,禁止在内容区域提供自定义的关闭按钮。
101
+
102
+ #### 7. Image 组件
103
+
104
+ **导入路径**:`import { Image } from '@/components/ui/image'`
105
+
106
+ **Props**:支持原生 `<img>` 标签所有属性。
107
+
108
+ ```typescript
109
+ interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement>
110
+ ```
111
+
112
+ **使用规范**:
113
+
114
+ 1. **响应式图片场景**:当图片尺寸需要根据视口宽度变化时,必须设置 `sizes` 属性
115
+ 2. **固定尺寸图片场景**:当图片有固定尺寸时,必须设置 `width` 属性(number 类型)
116
+ 3. **必须提供有意义的 `alt` 属性**
117
+
118
+ ```tsx
119
+ // ✅ 响应式图片
120
+ <Image
121
+ src="/path/to/image.jpg"
122
+ alt="描述文字"
123
+ sizes="(max-width: 768px) 100vw, 50vw"
124
+ />
125
+
126
+ // ✅ 固定尺寸图片(width/height 使用 number)
127
+ <Image
128
+ src="/path/to/image.jpg"
129
+ alt="描述文字"
130
+ width={300}
131
+ height={200}
132
+ />
133
+
134
+ ```