@lark-apaas/coding-template-vite-react 0.1.0-alpha.1

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 (82) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +20 -0
  3. package/hooks/after-install.mjs +3 -0
  4. package/hooks/after-render.mjs +3 -0
  5. package/hooks/before-render.mjs +3 -0
  6. package/package.json +27 -0
  7. package/template/README.md +109 -0
  8. package/template/_gitignore +24 -0
  9. package/template/client/index.html +14 -0
  10. package/template/client/public/favicon.svg +1 -0
  11. package/template/client/public/icons.svg +24 -0
  12. package/template/client/src/app.tsx +15 -0
  13. package/template/client/src/components/layout.tsx +9 -0
  14. package/template/client/src/components/ui/accordion.tsx +66 -0
  15. package/template/client/src/components/ui/alert-dialog.tsx +157 -0
  16. package/template/client/src/components/ui/alert.tsx +71 -0
  17. package/template/client/src/components/ui/aspect-ratio.tsx +11 -0
  18. package/template/client/src/components/ui/avatar.tsx +53 -0
  19. package/template/client/src/components/ui/badge.tsx +42 -0
  20. package/template/client/src/components/ui/breadcrumb.tsx +109 -0
  21. package/template/client/src/components/ui/button-group.tsx +83 -0
  22. package/template/client/src/components/ui/button.tsx +69 -0
  23. package/template/client/src/components/ui/calendar.tsx +213 -0
  24. package/template/client/src/components/ui/card.tsx +82 -0
  25. package/template/client/src/components/ui/carousel.tsx +241 -0
  26. package/template/client/src/components/ui/chart.tsx +357 -0
  27. package/template/client/src/components/ui/checkbox.tsx +32 -0
  28. package/template/client/src/components/ui/collapsible.tsx +33 -0
  29. package/template/client/src/components/ui/command.tsx +208 -0
  30. package/template/client/src/components/ui/context-menu.tsx +324 -0
  31. package/template/client/src/components/ui/dialog.tsx +143 -0
  32. package/template/client/src/components/ui/drawer.tsx +135 -0
  33. package/template/client/src/components/ui/dropdown-menu.tsx +329 -0
  34. package/template/client/src/components/ui/empty.tsx +104 -0
  35. package/template/client/src/components/ui/field.tsx +248 -0
  36. package/template/client/src/components/ui/form.tsx +167 -0
  37. package/template/client/src/components/ui/hover-card.tsx +44 -0
  38. package/template/client/src/components/ui/image.tsx +183 -0
  39. package/template/client/src/components/ui/input-group.tsx +166 -0
  40. package/template/client/src/components/ui/input-otp.tsx +77 -0
  41. package/template/client/src/components/ui/input.tsx +21 -0
  42. package/template/client/src/components/ui/item.tsx +193 -0
  43. package/template/client/src/components/ui/kbd.tsx +28 -0
  44. package/template/client/src/components/ui/label.tsx +24 -0
  45. package/template/client/src/components/ui/menubar.tsx +348 -0
  46. package/template/client/src/components/ui/native-select.tsx +48 -0
  47. package/template/client/src/components/ui/navigation-menu.tsx +168 -0
  48. package/template/client/src/components/ui/pagination.tsx +127 -0
  49. package/template/client/src/components/ui/popover.tsx +48 -0
  50. package/template/client/src/components/ui/progress.tsx +31 -0
  51. package/template/client/src/components/ui/radio-group.tsx +45 -0
  52. package/template/client/src/components/ui/resizable.tsx +56 -0
  53. package/template/client/src/components/ui/scroll-area.tsx +58 -0
  54. package/template/client/src/components/ui/select.tsx +243 -0
  55. package/template/client/src/components/ui/separator.tsx +28 -0
  56. package/template/client/src/components/ui/sheet.tsx +139 -0
  57. package/template/client/src/components/ui/sidebar.tsx +728 -0
  58. package/template/client/src/components/ui/skeleton.tsx +13 -0
  59. package/template/client/src/components/ui/slider.tsx +87 -0
  60. package/template/client/src/components/ui/sonner.tsx +67 -0
  61. package/template/client/src/components/ui/spinner.tsx +16 -0
  62. package/template/client/src/components/ui/switch.tsx +31 -0
  63. package/template/client/src/components/ui/table.tsx +116 -0
  64. package/template/client/src/components/ui/tabs.tsx +66 -0
  65. package/template/client/src/components/ui/textarea.tsx +18 -0
  66. package/template/client/src/components/ui/toggle-group.tsx +83 -0
  67. package/template/client/src/components/ui/toggle.tsx +47 -0
  68. package/template/client/src/components/ui/tooltip.tsx +61 -0
  69. package/template/client/src/hooks/use-mobile.ts +19 -0
  70. package/template/client/src/index.css +131 -0
  71. package/template/client/src/index.tsx +16 -0
  72. package/template/client/src/pages/NotFoundPage/NotFoundPage.tsx +11 -0
  73. package/template/components.json +21 -0
  74. package/template/eslint.config.mjs +34 -0
  75. package/template/package-lock.json +10533 -0
  76. package/template/package.json +84 -0
  77. package/template/scripts/build.sh +45 -0
  78. package/template/shared/types.ts +1 -0
  79. package/template/tsconfig.app.json +13 -0
  80. package/template/tsconfig.json +14 -0
  81. package/template/tsconfig.node.json +26 -0
  82. package/template/vite.config.ts +12 -0
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "miaoda-vite-react-app",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "build": "bash scripts/build.sh",
7
+ "typecheck": "tsc -p tsconfig.app.json",
8
+ "lint": "concurrently npm:typecheck npm:lint:eslint",
9
+ "lint:eslint": "eslint client/src"
10
+ },
11
+ "dependencies": {
12
+ "@hookform/resolvers": "^5.2.2",
13
+ "@radix-ui/react-accordion": "^1.2.11",
14
+ "@radix-ui/react-alert-dialog": "^1.1.14",
15
+ "@radix-ui/react-aspect-ratio": "^1.1.7",
16
+ "@radix-ui/react-avatar": "^1.1.10",
17
+ "@radix-ui/react-checkbox": "^1.3.2",
18
+ "@radix-ui/react-collapsible": "^1.1.11",
19
+ "@radix-ui/react-context-menu": "^2.2.14",
20
+ "@radix-ui/react-dialog": "^1.1.14",
21
+ "@radix-ui/react-dropdown-menu": "^2.1.14",
22
+ "@radix-ui/react-hover-card": "^1.1.14",
23
+ "@radix-ui/react-label": "^2.1.7",
24
+ "@radix-ui/react-menubar": "^1.1.14",
25
+ "@radix-ui/react-navigation-menu": "^1.2.13",
26
+ "@radix-ui/react-popover": "^1.1.14",
27
+ "@radix-ui/react-progress": "^1.1.7",
28
+ "@radix-ui/react-radio-group": "^1.3.7",
29
+ "@radix-ui/react-scroll-area": "^1.2.8",
30
+ "@radix-ui/react-select": "^2.1.14",
31
+ "@radix-ui/react-separator": "^1.1.7",
32
+ "@radix-ui/react-slider": "^1.3.5",
33
+ "@radix-ui/react-slot": "^1.2.3",
34
+ "@radix-ui/react-switch": "^1.2.5",
35
+ "@radix-ui/react-tabs": "^1.1.11",
36
+ "@radix-ui/react-toggle": "^1.1.9",
37
+ "@radix-ui/react-toggle-group": "^1.1.10",
38
+ "@radix-ui/react-tooltip": "^1.1.18",
39
+ "@lark-apaas/client-toolkit-lite": "^1.1.0",
40
+ "@formkit/auto-animate": "^0.9.0",
41
+ "@gsap/react": "^2.1.2",
42
+ "framer-motion": "^12.38.0",
43
+ "gsap": "^3.15.0",
44
+ "class-variance-authority": "^0.7.1",
45
+ "clsx": "^2.1.1",
46
+ "cmdk": "^1.1.1",
47
+ "date-fns": "^4.1.0",
48
+ "echarts": "~5.6.0",
49
+ "echarts-for-react": "~3.0.2",
50
+ "embla-carousel-react": "^8.6.0",
51
+ "input-otp": "^1.4.2",
52
+ "lucide-react": "^1.7.0",
53
+ "next-themes": "^0.4.6",
54
+ "react": "^19.2.4",
55
+ "react-day-picker": "^9.14.0",
56
+ "react-dom": "^19.2.4",
57
+ "react-hook-form": "^7.72.0",
58
+ "react-resizable-panels": "^4.7.6",
59
+ "react-router-dom": "^7.13.2",
60
+ "recharts": "^3.8.0",
61
+ "sonner": "^2.0.7",
62
+ "tailwind-merge": "^3.5.0",
63
+ "tailwindcss": "^4.2.2",
64
+ "tw-animate-css": "^1.2.0",
65
+ "vaul": "^1.1.2",
66
+ "zod": "^4.3.6"
67
+ },
68
+ "devDependencies": {
69
+ "@eslint/js": "^9",
70
+ "@types/node": "^24",
71
+ "@types/react": "^19",
72
+ "@types/react-dom": "^19",
73
+ "@lark-apaas/coding-presets": "^1.0.0",
74
+ "@lark-apaas/coding-vite-preset": "^1.0.0",
75
+ "concurrently": "^9",
76
+ "eslint": "^9",
77
+ "eslint-plugin-react-hooks": "^7",
78
+ "eslint-plugin-react-refresh": "^0.5",
79
+ "globals": "^17",
80
+ "typescript": "~5.9",
81
+ "typescript-eslint": "^8",
82
+ "vite": "^8"
83
+ }
84
+ }
@@ -0,0 +1,45 @@
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
+ OUTPUT_STATIC="$ROOT/dist/output_static"
8
+
9
+ # 映射平台环境变量到 preset 期望的变量名
10
+ export CLIENT_BASE_PATH="${MCLAW_APP_ID:+/app/$MCLAW_APP_ID}"
11
+ export ASSETS_CDN_PATH="${MCLAW_CDN_DOMAIN:-/}"
12
+ export NODE_ENV="${NODE_ENV:-production}"
13
+
14
+ # 清理
15
+ rm -rf "$ROOT/dist"
16
+
17
+ # 1. Vite 构建 → dist/client/(相对于项目根目录输出)
18
+ npx vite build --outDir "$ROOT/dist/client" --emptyOutDir
19
+
20
+ # 2. HTML → dist/output/
21
+ mkdir -p "$OUTPUT"
22
+ find "$ROOT/dist/client" -maxdepth 1 -name '*.html' -exec cp {} "$OUTPUT/" \;
23
+
24
+ # 生成 routes.json
25
+ echo '{ "version": 1, "type": "vite-react", "fallback": "index.html" }' > "$OUTPUT/routes.json"
26
+
27
+ # 3. assets/ → dist/output_resource/(JS/CSS/字体,上传到 CDN)
28
+ if [ -d "$ROOT/dist/client/assets" ]; then
29
+ mkdir -p "$OUTPUT_RESOURCE"
30
+ cp -r "$ROOT/dist/client/assets" "$OUTPUT_RESOURCE/"
31
+ fi
32
+
33
+ # 4. 私有静态资源 → dist/output_static/(排除代码文件)
34
+ if [ -d "$ROOT/shared/static" ]; then
35
+ mkdir -p "$OUTPUT_STATIC"
36
+ rsync -a --exclude='*.ts' --exclude='*.tsx' --exclude='*.js' --exclude='*.jsx' "$ROOT/shared/static/" "$OUTPUT_STATIC/"
37
+ fi
38
+
39
+ # 清理中间产物
40
+ rm -rf "$ROOT/dist/client"
41
+
42
+ echo "Build complete"
43
+ echo " HTML → dist/output/"
44
+ [ -d "$OUTPUT_RESOURCE" ] && echo " Resource → dist/output_resource/" || true
45
+ [ -d "$OUTPUT_STATIC" ] && echo " Static → dist/output_static/" || true
@@ -0,0 +1 @@
1
+ // 前后端共享类型定义
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "@lark-apaas/coding-presets/lib/tsconfig/tsconfig.app.json",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "baseUrl": ".",
6
+ "paths": {
7
+ "@/*": ["./client/src/*"],
8
+ "@shared/*": ["./shared/*"]
9
+ }
10
+ },
11
+ "include": ["client/src", "shared"],
12
+ "exclude": ["client/src/components/ui"]
13
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "paths": {
5
+ "@/*": ["./client/src/*"],
6
+ "@shared/*": ["./shared/*"]
7
+ }
8
+ },
9
+ "files": [],
10
+ "references": [
11
+ { "path": "./tsconfig.app.json" },
12
+ { "path": "./tsconfig.node.json" }
13
+ ]
14
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
+ "target": "ES2023",
5
+ "lib": ["ES2023"],
6
+ "module": "ESNext",
7
+ "types": ["node"],
8
+ "skipLibCheck": true,
9
+
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "verbatimModuleSyntax": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+
17
+ /* Linting */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "erasableSyntaxOnly": true,
22
+ "noFallthroughCasesInSwitch": true,
23
+ "noUncheckedSideEffectImports": true
24
+ },
25
+ "include": ["vite.config.ts"]
26
+ }
@@ -0,0 +1,12 @@
1
+ import path from 'path'
2
+ import { defineConfig } from '@lark-apaas/coding-vite-preset'
3
+
4
+ export default defineConfig({
5
+ root: path.resolve(__dirname, 'client'),
6
+ resolve: {
7
+ alias: {
8
+ '@': path.resolve(__dirname, 'client/src'),
9
+ '@shared': path.resolve(__dirname, 'shared'),
10
+ },
11
+ },
12
+ })