@lark-apaas/coding-template-react-standard-webapp 0.1.0-alpha.20260827082008
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 +25 -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 +35 -0
- package/template/README.md +105 -0
- package/template/_gitignore +64 -0
- package/template/_npmrc +1 -0
- package/template/components.json +21 -0
- package/template/eslint.config.mjs +27 -0
- package/template/index.html +13 -0
- package/template/miaoda.json +11 -0
- package/template/package-lock.json +7685 -0
- package/template/package.json +89 -0
- package/template/public/favicon.svg +1 -0
- package/template/public/icons.svg +24 -0
- package/template/src/app.tsx +15 -0
- package/template/src/components/ErrorFallback.tsx +19 -0
- package/template/src/components/Layout.tsx +7 -0
- package/template/src/components/ui/accordion.tsx +66 -0
- package/template/src/components/ui/alert-dialog.tsx +157 -0
- package/template/src/components/ui/alert.tsx +71 -0
- package/template/src/components/ui/aspect-ratio.tsx +11 -0
- package/template/src/components/ui/avatar.tsx +53 -0
- package/template/src/components/ui/badge.tsx +42 -0
- package/template/src/components/ui/breadcrumb.tsx +109 -0
- package/template/src/components/ui/button-group.tsx +83 -0
- package/template/src/components/ui/button.tsx +69 -0
- package/template/src/components/ui/calendar.tsx +213 -0
- package/template/src/components/ui/card.tsx +82 -0
- package/template/src/components/ui/carousel.tsx +241 -0
- package/template/src/components/ui/chart.tsx +357 -0
- package/template/src/components/ui/checkbox.tsx +32 -0
- package/template/src/components/ui/collapsible.tsx +33 -0
- package/template/src/components/ui/command.tsx +208 -0
- package/template/src/components/ui/context-menu.tsx +324 -0
- package/template/src/components/ui/dialog.tsx +143 -0
- package/template/src/components/ui/drawer.tsx +135 -0
- package/template/src/components/ui/dropdown-menu.tsx +329 -0
- package/template/src/components/ui/empty.tsx +104 -0
- package/template/src/components/ui/field.tsx +248 -0
- package/template/src/components/ui/form.tsx +167 -0
- package/template/src/components/ui/hover-card.tsx +44 -0
- package/template/src/components/ui/image.tsx +183 -0
- package/template/src/components/ui/input-group.tsx +166 -0
- package/template/src/components/ui/input-otp.tsx +77 -0
- package/template/src/components/ui/input.tsx +21 -0
- package/template/src/components/ui/item.tsx +193 -0
- package/template/src/components/ui/kbd.tsx +28 -0
- package/template/src/components/ui/label.tsx +24 -0
- package/template/src/components/ui/menubar.tsx +348 -0
- package/template/src/components/ui/native-select.tsx +48 -0
- package/template/src/components/ui/navigation-menu.tsx +168 -0
- package/template/src/components/ui/pagination.tsx +127 -0
- package/template/src/components/ui/popover.tsx +48 -0
- package/template/src/components/ui/progress.tsx +31 -0
- package/template/src/components/ui/radio-group.tsx +45 -0
- package/template/src/components/ui/resizable.tsx +56 -0
- package/template/src/components/ui/scroll-area.tsx +58 -0
- package/template/src/components/ui/select.tsx +243 -0
- package/template/src/components/ui/separator.tsx +28 -0
- package/template/src/components/ui/sheet.tsx +139 -0
- package/template/src/components/ui/sidebar.tsx +727 -0
- package/template/src/components/ui/skeleton.tsx +13 -0
- package/template/src/components/ui/slider.tsx +87 -0
- package/template/src/components/ui/sonner.tsx +67 -0
- package/template/src/components/ui/spinner.tsx +16 -0
- package/template/src/components/ui/switch.tsx +31 -0
- package/template/src/components/ui/table.tsx +116 -0
- package/template/src/components/ui/tabs.tsx +66 -0
- package/template/src/components/ui/textarea.tsx +18 -0
- package/template/src/components/ui/toggle-group.tsx +83 -0
- package/template/src/components/ui/toggle.tsx +47 -0
- package/template/src/components/ui/tooltip.tsx +61 -0
- package/template/src/hooks/use-mobile.ts +20 -0
- package/template/src/index.css +4 -0
- package/template/src/index.tsx +17 -0
- package/template/src/lib/utils.ts +6 -0
- package/template/src/pages/ExamplePage/ExamplePage.tsx +37 -0
- package/template/src/pages/HomePage/HomePage.tsx +10 -0
- package/template/src/pages/NotFoundPage/NotFoundPage.tsx +11 -0
- package/template/src/tailwind-theme.css +258 -0
- package/template/src/typography.css +41 -0
- package/template/src/vite-env.d.ts +5 -0
- package/template/tsconfig.app.json +29 -0
- package/template/tsconfig.json +10 -0
- package/template/tsconfig.node.json +26 -0
- package/template/vite.config.ts +97 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Lark Technologies Pte. Ltd. and/or its affiliates
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted,provided that the above copyright notice and this permission notice appear in all copies.
|
|
6
|
+
|
|
7
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
8
|
+
IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
|
|
9
|
+
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
|
10
|
+
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
|
11
|
+
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
12
|
+
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
|
13
|
+
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @lark-apaas/coding-template-react-standard-webapp
|
|
2
|
+
|
|
3
|
+
React standard webapp template for [miaoda coding](https://code.byted.org/apaas/miaoda-coding) — 面向本地开发的纯前端模板(无平台 SDK 依赖),产物可托管部署到妙搭平台。
|
|
4
|
+
|
|
5
|
+
**Tech stack:** vite · react · typescript · tailwind · shadcn-ui
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
This package is consumed by [miaoda-cli](https://code.byted.org/apaas/miaoda-cli). It is not intended to be installed as a runtime dependency — the CLI fetches the tarball, renders `template/` into a user project, then discards the package reference.
|
|
10
|
+
|
|
11
|
+
## 与 vite-react 模板的区别
|
|
12
|
+
|
|
13
|
+
基于 `vite-react` 母版裁剪,面向本地开发场景:
|
|
14
|
+
|
|
15
|
+
- 无任何 `@lark-apaas/*` 运行时/构建依赖(client-toolkit-lite、coding-preset-vite-react、coding-presets-react 均已移除)
|
|
16
|
+
- 部署协议(dist/output 分层 + routes.json)以内联插件实现在 `template/vite.config.ts` 单文件中,可作为 custom 技术栈的协议参考实现
|
|
17
|
+
- 常规 scripts:`dev` / `build` / `typecheck` / `lint`,无 wrapper 脚本,跨平台
|
|
18
|
+
- 本地 `npm run dev` 零环境变量预览;托管构建仅消费 `MIAODA_CLIENT_BASE_PATH` / `MIAODA_RESOURCE_CDN_PREFIX`
|
|
19
|
+
|
|
20
|
+
## Contents
|
|
21
|
+
|
|
22
|
+
| Path | Purpose |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `template/` | Files copied to the user project at init time |
|
|
25
|
+
| `hooks/` | Lifecycle hooks (no-op for v0.1) |
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lark-apaas/coding-template-react-standard-webapp",
|
|
3
|
+
"version": "0.1.0-alpha.20260827082008",
|
|
4
|
+
"description": "React standard webapp template for miaoda local development (vite + react, no platform SDK)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"template",
|
|
8
|
+
"hooks"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"validate-manifest": "node ../../../scripts/validate-template.mjs .",
|
|
12
|
+
"smoke": "node ../../../scripts/smoke-template.mjs .",
|
|
13
|
+
"prepublishOnly": "pnpm validate-manifest"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"registry": "https://registry.npmjs.org/"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"miaoda",
|
|
21
|
+
"coding-template",
|
|
22
|
+
"react",
|
|
23
|
+
"webapp"
|
|
24
|
+
],
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"miaodaTemplate": {
|
|
27
|
+
"schemaVersion": 1,
|
|
28
|
+
"archType": 2,
|
|
29
|
+
"hooks": {
|
|
30
|
+
"beforeRender": "hooks/before-render.mjs",
|
|
31
|
+
"afterRender": "hooks/after-render.mjs",
|
|
32
|
+
"afterInstall": "hooks/after-install.mjs"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# 项目技术规范
|
|
2
|
+
|
|
3
|
+
## 技术栈
|
|
4
|
+
|
|
5
|
+
- 前端: React 19 + TypeScript
|
|
6
|
+
- 样式: Tailwind CSS v4
|
|
7
|
+
- UI 组件: shadcn/ui `import { Button } from "@/components/ui/button";`
|
|
8
|
+
- 图标: lucide-react `import { SearchIcon } from "lucide-react";`
|
|
9
|
+
- 图表: echarts-for-react `import ReactECharts from "echarts-for-react";`
|
|
10
|
+
- 动画: framer-motion `import { motion } from "framer-motion";`
|
|
11
|
+
- 路由: react-router-dom `import { Link, useNavigate } from "react-router-dom";`
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 目录结构
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
src/
|
|
19
|
+
├── index.tsx # 入口(勿修改)
|
|
20
|
+
├── app.tsx # 路由配置(仅在 <Routes> 内增删 <Route>)
|
|
21
|
+
├── index.css # 全局样式 + 主题变量
|
|
22
|
+
├── components/ # 基础 UI 组件(禁止存放业务组件)
|
|
23
|
+
│ ├── layout.tsx # 全局布局容器(含 <Outlet />)
|
|
24
|
+
│ └── ui/ # shadcn/ui 内置组件(勿修改)
|
|
25
|
+
├── pages/ # 页面模块(每个页面一个目录)
|
|
26
|
+
│ ├── <PageName>/ # 页面目录示例
|
|
27
|
+
│ │ ├── PageName.tsx # 页面入口文件与目录同名
|
|
28
|
+
│ │ └── components/ # 页面专属组件
|
|
29
|
+
│ └── NotFoundPage/
|
|
30
|
+
│ └── NotFoundPage.tsx
|
|
31
|
+
├── hooks/ # 自定义 Hooks
|
|
32
|
+
└── lib/ # 工具函数(cn() 等)
|
|
33
|
+
|
|
34
|
+
public/ # 静态资源(dev server 原样服务;构建后随 dist/output 同源部署)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 模板初始状态
|
|
40
|
+
|
|
41
|
+
- `app.tsx` 首页路由指向 `pages/HomePage`(占位欢迎页)
|
|
42
|
+
- 开发时将 `HomePage` 替换为业务首页,或在 `pages/` 下创建新页面并调整 `index` 路由
|
|
43
|
+
- `layout.tsx` 为空壳容器(仅 `<Outlet />`),需根据需求实现导航和布局
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 禁止修改的文件
|
|
48
|
+
|
|
49
|
+
| 文件 | 原因 |
|
|
50
|
+
|------|------|
|
|
51
|
+
| `src/index.tsx` | Provider 层级 + 样式引入,由模板管理 |
|
|
52
|
+
| `src/components/ui/*` | shadcn/ui 内置组件,版本锁定 |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 文件放置规则
|
|
57
|
+
|
|
58
|
+
| 内容类型 | 放置位置 |
|
|
59
|
+
|---------|---------|
|
|
60
|
+
| 新页面 | `src/pages/<PageName>/PageName.tsx` |
|
|
61
|
+
| 页面专属组件 | `src/pages/<PageName>/components/` |
|
|
62
|
+
| 自定义 Hooks | `src/hooks/` |
|
|
63
|
+
| 工具函数 | `src/lib/` |
|
|
64
|
+
| 静态数据文件 | `public/data/` |
|
|
65
|
+
| 静态图片 | `public/images/` |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 导入路径
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// @/ 别名 → src/
|
|
73
|
+
import { cn } from "@/lib/utils";
|
|
74
|
+
import { useIsMobile } from "@/hooks/use-mobile";
|
|
75
|
+
|
|
76
|
+
// public/ 下的静态资源通过 URL 引用(dev 与线上同源)
|
|
77
|
+
// <img src="/images/hero.png" /> fetch("/data/config.json")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 路由配置
|
|
83
|
+
|
|
84
|
+
- 新增页面需在 `src/app.tsx` 的 `<Routes>` 内注册 `<Route>`
|
|
85
|
+
- `BrowserRouter` 已在 `index.tsx` 中配置,`app.tsx` 中**禁止**再包裹 Router
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 主题变量
|
|
90
|
+
|
|
91
|
+
主题色定义在 `src/index.css`,通过 `:root` CSS 变量 + `@theme inline` 注册到 Tailwind。
|
|
92
|
+
|
|
93
|
+
| 用途 | Tailwind 类 | CSS 变量 |
|
|
94
|
+
|------|------------|----------|
|
|
95
|
+
| 页面背景 | `bg-background` | `--background` |
|
|
96
|
+
| 主文本 | `text-foreground` | `--foreground` |
|
|
97
|
+
| 卡片背景 | `bg-card` | `--card` |
|
|
98
|
+
| 次要文本 | `text-muted-foreground` | `--muted-foreground` |
|
|
99
|
+
| 主色 | `bg-primary` / `text-primary` | `--primary` |
|
|
100
|
+
| 强调色 | `bg-accent` | `--accent` |
|
|
101
|
+
| 边框 | `border-border` | `--border` |
|
|
102
|
+
| 危险色 | `text-destructive` | `--destructive` |
|
|
103
|
+
| 图表色 | `bg-chart-1` ~ `bg-chart-5` | `--chart-1` ~ `--chart-5` |
|
|
104
|
+
|
|
105
|
+
HSL 格式使用**空格分隔**:`--primary: hsl(150 60% 40%);`
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
*/node_modules/
|
|
4
|
+
|
|
5
|
+
# Production builds
|
|
6
|
+
dist/
|
|
7
|
+
*/dist/
|
|
8
|
+
build/
|
|
9
|
+
*/build/
|
|
10
|
+
|
|
11
|
+
# Environment files
|
|
12
|
+
.env.local
|
|
13
|
+
|
|
14
|
+
# Logs
|
|
15
|
+
npm-debug.log*
|
|
16
|
+
yarn-debug.log*
|
|
17
|
+
yarn-error.log*
|
|
18
|
+
lerna-debug.log*
|
|
19
|
+
/logs/
|
|
20
|
+
|
|
21
|
+
# Runtime data
|
|
22
|
+
pids
|
|
23
|
+
*.pid
|
|
24
|
+
*.seed
|
|
25
|
+
*.pid.lock
|
|
26
|
+
|
|
27
|
+
# Coverage directory used by tools like istanbul
|
|
28
|
+
coverage/
|
|
29
|
+
*.lcov
|
|
30
|
+
|
|
31
|
+
# IDE files
|
|
32
|
+
.vscode/
|
|
33
|
+
.idea/
|
|
34
|
+
*.swp
|
|
35
|
+
*.swo
|
|
36
|
+
*~
|
|
37
|
+
|
|
38
|
+
# OS generated files
|
|
39
|
+
.DS_Store
|
|
40
|
+
.DS_Store?
|
|
41
|
+
._*
|
|
42
|
+
.Spotlight-V100
|
|
43
|
+
.Trashes
|
|
44
|
+
ehthumbs.db
|
|
45
|
+
Thumbs.db
|
|
46
|
+
|
|
47
|
+
# Temporary folders
|
|
48
|
+
tmp/
|
|
49
|
+
temp/
|
|
50
|
+
.playwright-cli/
|
|
51
|
+
|
|
52
|
+
# Lock files (keep package-lock.json for consistent installs)
|
|
53
|
+
yarn.lock
|
|
54
|
+
pnpm-lock.yaml
|
|
55
|
+
|
|
56
|
+
# Cache files
|
|
57
|
+
.eslintcache
|
|
58
|
+
*.tsbuildinfo
|
|
59
|
+
|
|
60
|
+
# swc wasm
|
|
61
|
+
.swc
|
|
62
|
+
|
|
63
|
+
# Agent files
|
|
64
|
+
.agent/
|
package/template/_npmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
registry=https://registry.npmmirror.com/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/index.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"aliases": {
|
|
14
|
+
"components": "@/components",
|
|
15
|
+
"utils": "@/lib/utils",
|
|
16
|
+
"ui": "@/components/ui",
|
|
17
|
+
"lib": "@/lib",
|
|
18
|
+
"hooks": "@/hooks"
|
|
19
|
+
},
|
|
20
|
+
"iconLibrary": "lucide"
|
|
21
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
import tseslint from 'typescript-eslint';
|
|
4
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
5
|
+
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
6
|
+
import { globalIgnores } from 'eslint/config';
|
|
7
|
+
|
|
8
|
+
export default tseslint.config(globalIgnores(['dist', '**/components/ui/**']), {
|
|
9
|
+
files: ['src/**/*.{ts,tsx}'],
|
|
10
|
+
extends: [
|
|
11
|
+
js.configs.recommended,
|
|
12
|
+
...tseslint.configs.recommended,
|
|
13
|
+
reactHooks.configs.flat.recommended,
|
|
14
|
+
reactRefresh.configs.vite,
|
|
15
|
+
],
|
|
16
|
+
languageOptions: {
|
|
17
|
+
ecmaVersion: 2023,
|
|
18
|
+
globals: globals.browser,
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
22
|
+
'@typescript-eslint/no-unused-vars': [
|
|
23
|
+
'warn',
|
|
24
|
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>应用标题</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/index.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|