@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.
- package/LICENSE +13 -0
- package/README.md +20 -0
- package/hooks/after-install.mjs +3 -0
- package/hooks/after-render.mjs +3 -0
- package/hooks/before-render.mjs +3 -0
- package/package.json +27 -0
- package/template/README.md +109 -0
- package/template/_gitignore +24 -0
- package/template/client/index.html +14 -0
- package/template/client/public/favicon.svg +1 -0
- package/template/client/public/icons.svg +24 -0
- package/template/client/src/app.tsx +15 -0
- package/template/client/src/components/layout.tsx +9 -0
- package/template/client/src/components/ui/accordion.tsx +66 -0
- package/template/client/src/components/ui/alert-dialog.tsx +157 -0
- package/template/client/src/components/ui/alert.tsx +71 -0
- package/template/client/src/components/ui/aspect-ratio.tsx +11 -0
- package/template/client/src/components/ui/avatar.tsx +53 -0
- package/template/client/src/components/ui/badge.tsx +42 -0
- package/template/client/src/components/ui/breadcrumb.tsx +109 -0
- package/template/client/src/components/ui/button-group.tsx +83 -0
- package/template/client/src/components/ui/button.tsx +69 -0
- package/template/client/src/components/ui/calendar.tsx +213 -0
- package/template/client/src/components/ui/card.tsx +82 -0
- package/template/client/src/components/ui/carousel.tsx +241 -0
- package/template/client/src/components/ui/chart.tsx +357 -0
- package/template/client/src/components/ui/checkbox.tsx +32 -0
- package/template/client/src/components/ui/collapsible.tsx +33 -0
- package/template/client/src/components/ui/command.tsx +208 -0
- package/template/client/src/components/ui/context-menu.tsx +324 -0
- package/template/client/src/components/ui/dialog.tsx +143 -0
- package/template/client/src/components/ui/drawer.tsx +135 -0
- package/template/client/src/components/ui/dropdown-menu.tsx +329 -0
- package/template/client/src/components/ui/empty.tsx +104 -0
- package/template/client/src/components/ui/field.tsx +248 -0
- package/template/client/src/components/ui/form.tsx +167 -0
- package/template/client/src/components/ui/hover-card.tsx +44 -0
- package/template/client/src/components/ui/image.tsx +183 -0
- package/template/client/src/components/ui/input-group.tsx +166 -0
- package/template/client/src/components/ui/input-otp.tsx +77 -0
- package/template/client/src/components/ui/input.tsx +21 -0
- package/template/client/src/components/ui/item.tsx +193 -0
- package/template/client/src/components/ui/kbd.tsx +28 -0
- package/template/client/src/components/ui/label.tsx +24 -0
- package/template/client/src/components/ui/menubar.tsx +348 -0
- package/template/client/src/components/ui/native-select.tsx +48 -0
- package/template/client/src/components/ui/navigation-menu.tsx +168 -0
- package/template/client/src/components/ui/pagination.tsx +127 -0
- package/template/client/src/components/ui/popover.tsx +48 -0
- package/template/client/src/components/ui/progress.tsx +31 -0
- package/template/client/src/components/ui/radio-group.tsx +45 -0
- package/template/client/src/components/ui/resizable.tsx +56 -0
- package/template/client/src/components/ui/scroll-area.tsx +58 -0
- package/template/client/src/components/ui/select.tsx +243 -0
- package/template/client/src/components/ui/separator.tsx +28 -0
- package/template/client/src/components/ui/sheet.tsx +139 -0
- package/template/client/src/components/ui/sidebar.tsx +728 -0
- package/template/client/src/components/ui/skeleton.tsx +13 -0
- package/template/client/src/components/ui/slider.tsx +87 -0
- package/template/client/src/components/ui/sonner.tsx +67 -0
- package/template/client/src/components/ui/spinner.tsx +16 -0
- package/template/client/src/components/ui/switch.tsx +31 -0
- package/template/client/src/components/ui/table.tsx +116 -0
- package/template/client/src/components/ui/tabs.tsx +66 -0
- package/template/client/src/components/ui/textarea.tsx +18 -0
- package/template/client/src/components/ui/toggle-group.tsx +83 -0
- package/template/client/src/components/ui/toggle.tsx +47 -0
- package/template/client/src/components/ui/tooltip.tsx +61 -0
- package/template/client/src/hooks/use-mobile.ts +19 -0
- package/template/client/src/index.css +131 -0
- package/template/client/src/index.tsx +16 -0
- package/template/client/src/pages/NotFoundPage/NotFoundPage.tsx +11 -0
- package/template/components.json +21 -0
- package/template/eslint.config.mjs +34 -0
- package/template/package-lock.json +10533 -0
- package/template/package.json +84 -0
- package/template/scripts/build.sh +45 -0
- package/template/shared/types.ts +1 -0
- package/template/tsconfig.app.json +13 -0
- package/template/tsconfig.json +14 -0
- package/template/tsconfig.node.json +26 -0
- 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,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
|
+
})
|