create-aiko 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.
- package/README.md +46 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +7 -0
- package/dist/create.d.ts +1 -0
- package/dist/create.js +174 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/scaffold.d.ts +7 -0
- package/dist/scaffold.js +310 -0
- package/package.json +37 -0
- package/template/README.md +63 -0
- package/template/docs/better-sqlite3-design.md +101 -0
- package/template/docs/shared-vs-shared-auth.md +54 -0
- package/template/package.json +23 -0
- package/template/packages/admin/.env.dev +1 -0
- package/template/packages/admin/.env.prod +4 -0
- package/template/packages/admin/.env.stage +4 -0
- package/template/packages/admin/Dockerfile +37 -0
- package/template/packages/admin/README.MD +27 -0
- package/template/packages/admin/components.json +21 -0
- package/template/packages/admin/eslint.config.js +28 -0
- package/template/packages/admin/index.html +50 -0
- package/template/packages/admin/package.json +100 -0
- package/template/packages/admin/public/vite.svg +1 -0
- package/template/packages/admin/src/App.css +82 -0
- package/template/packages/admin/src/App.tsx +128 -0
- package/template/packages/admin/src/app.config.ts +3 -0
- package/template/packages/admin/src/components/admin-ui/approval-flow.tsx +205 -0
- package/template/packages/admin/src/components/admin-ui/data-table/data-table-pagination.tsx +148 -0
- package/template/packages/admin/src/components/admin-ui/data-table/data-table-sorter.tsx +50 -0
- package/template/packages/admin/src/components/admin-ui/data-table/index.tsx +296 -0
- package/template/packages/admin/src/components/admin-ui/editable-table.tsx +292 -0
- package/template/packages/admin/src/components/admin-ui/form/input-password.tsx +38 -0
- package/template/packages/admin/src/components/admin-ui/form/sign-in-form.tsx +104 -0
- package/template/packages/admin/src/components/admin-ui/layout/error-component.tsx +71 -0
- package/template/packages/admin/src/components/admin-ui/layout/header.tsx +148 -0
- package/template/packages/admin/src/components/admin-ui/layout/language-switcher.tsx +47 -0
- package/template/packages/admin/src/components/admin-ui/layout/layout.tsx +42 -0
- package/template/packages/admin/src/components/admin-ui/layout/loading-overlay.tsx +36 -0
- package/template/packages/admin/src/components/admin-ui/layout/shell-bar.tsx +232 -0
- package/template/packages/admin/src/components/admin-ui/layout/sidebar.tsx +193 -0
- package/template/packages/admin/src/components/admin-ui/layout/user-avatar.tsx +31 -0
- package/template/packages/admin/src/components/admin-ui/list-report.tsx +313 -0
- package/template/packages/admin/src/components/admin-ui/master-detail.tsx +382 -0
- package/template/packages/admin/src/components/admin-ui/notification/toaster.tsx +23 -0
- package/template/packages/admin/src/components/admin-ui/notification/undoable-notification.tsx +84 -0
- package/template/packages/admin/src/components/admin-ui/object-page.tsx +539 -0
- package/template/packages/admin/src/components/admin-ui/process-stepper.tsx +204 -0
- package/template/packages/admin/src/components/admin-ui/theme/theme-provider.tsx +160 -0
- package/template/packages/admin/src/components/admin-ui/theme/theme-select.tsx +129 -0
- package/template/packages/admin/src/components/admin-ui/theme/theme-toggle.tsx +90 -0
- package/template/packages/admin/src/components/admin-ui/timeline.tsx +137 -0
- package/template/packages/admin/src/components/admin-ui/tree-navigator.tsx +243 -0
- package/template/packages/admin/src/components/ui/accordion.tsx +64 -0
- package/template/packages/admin/src/components/ui/alert-dialog.tsx +157 -0
- package/template/packages/admin/src/components/ui/alert.tsx +66 -0
- package/template/packages/admin/src/components/ui/aspect-ratio.tsx +9 -0
- package/template/packages/admin/src/components/ui/avatar.tsx +53 -0
- package/template/packages/admin/src/components/ui/badge.tsx +47 -0
- package/template/packages/admin/src/components/ui/breadcrumb.tsx +111 -0
- package/template/packages/admin/src/components/ui/button.tsx +59 -0
- package/template/packages/admin/src/components/ui/calendar.tsx +74 -0
- package/template/packages/admin/src/components/ui/card.tsx +92 -0
- package/template/packages/admin/src/components/ui/carousel.tsx +237 -0
- package/template/packages/admin/src/components/ui/chart.tsx +351 -0
- package/template/packages/admin/src/components/ui/checkbox.tsx +32 -0
- package/template/packages/admin/src/components/ui/collapsible.tsx +33 -0
- package/template/packages/admin/src/components/ui/command.tsx +182 -0
- package/template/packages/admin/src/components/ui/context-menu.tsx +252 -0
- package/template/packages/admin/src/components/ui/dialog.tsx +141 -0
- package/template/packages/admin/src/components/ui/drawer.tsx +130 -0
- package/template/packages/admin/src/components/ui/dropdown-menu.tsx +255 -0
- package/template/packages/admin/src/components/ui/form.tsx +166 -0
- package/template/packages/admin/src/components/ui/hover-card.tsx +42 -0
- package/template/packages/admin/src/components/ui/input-otp.tsx +77 -0
- package/template/packages/admin/src/components/ui/input.tsx +21 -0
- package/template/packages/admin/src/components/ui/label.tsx +22 -0
- package/template/packages/admin/src/components/ui/menubar.tsx +274 -0
- package/template/packages/admin/src/components/ui/navigation-menu.tsx +168 -0
- package/template/packages/admin/src/components/ui/pagination.tsx +127 -0
- package/template/packages/admin/src/components/ui/popover.tsx +48 -0
- package/template/packages/admin/src/components/ui/progress.tsx +29 -0
- package/template/packages/admin/src/components/ui/radio-group.tsx +45 -0
- package/template/packages/admin/src/components/ui/resizable.tsx +54 -0
- package/template/packages/admin/src/components/ui/scroll-area.tsx +58 -0
- package/template/packages/admin/src/components/ui/select.tsx +183 -0
- package/template/packages/admin/src/components/ui/separator.tsx +26 -0
- package/template/packages/admin/src/components/ui/sheet.tsx +139 -0
- package/template/packages/admin/src/components/ui/sidebar.tsx +740 -0
- package/template/packages/admin/src/components/ui/skeleton.tsx +13 -0
- package/template/packages/admin/src/components/ui/slider.tsx +63 -0
- package/template/packages/admin/src/components/ui/sonner.tsx +23 -0
- package/template/packages/admin/src/components/ui/switch.tsx +31 -0
- package/template/packages/admin/src/components/ui/table.tsx +114 -0
- package/template/packages/admin/src/components/ui/tabs.tsx +66 -0
- package/template/packages/admin/src/components/ui/textarea.tsx +18 -0
- package/template/packages/admin/src/components/ui/toggle-group.tsx +73 -0
- package/template/packages/admin/src/components/ui/toggle.tsx +45 -0
- package/template/packages/admin/src/components/ui/tooltip.tsx +59 -0
- package/template/packages/admin/src/hooks/use-mobile.ts +21 -0
- package/template/packages/admin/src/i18n.ts +20 -0
- package/template/packages/admin/src/index.tsx +18 -0
- package/template/packages/admin/src/layouts/menu-layout.tsx +211 -0
- package/template/packages/admin/src/layouts/tile-layout.tsx +355 -0
- package/template/packages/admin/src/lib/utils.ts +6 -0
- package/template/packages/admin/src/locales/en.json +68 -0
- package/template/packages/admin/src/locales/zh.json +68 -0
- package/template/packages/admin/src/pages/dashboard.tsx +12 -0
- package/template/packages/admin/src/pages/goods-receipt/CreatePage.tsx +302 -0
- package/template/packages/admin/src/pages/goods-receipt/EditPage.tsx +221 -0
- package/template/packages/admin/src/pages/goods-receipt/ListPage.tsx +283 -0
- package/template/packages/admin/src/pages/goods-receipt/ViewPage.tsx +280 -0
- package/template/packages/admin/src/pages/goods-receipt/index.ts +4 -0
- package/template/packages/admin/src/pages/home-page.tsx +244 -0
- package/template/packages/admin/src/pages/login-page.tsx +91 -0
- package/template/packages/admin/src/pages/master-data/cost-centers/index.tsx +461 -0
- package/template/packages/admin/src/pages/master-data/currencies/index.tsx +255 -0
- package/template/packages/admin/src/pages/master-data/materials/ListPage.tsx +271 -0
- package/template/packages/admin/src/pages/master-data/materials/ViewPage.tsx +240 -0
- package/template/packages/admin/src/pages/master-data/materials/index.ts +2 -0
- package/template/packages/admin/src/pages/master-data/plants/ListPage.tsx +279 -0
- package/template/packages/admin/src/pages/master-data/plants/ViewPage.tsx +380 -0
- package/template/packages/admin/src/pages/master-data/plants/index.ts +2 -0
- package/template/packages/admin/src/pages/master-data/purchase-organizations/index.tsx +341 -0
- package/template/packages/admin/src/pages/master-data/units-of-measure/index.tsx +295 -0
- package/template/packages/admin/src/pages/master-data/vendors/ListPage.tsx +266 -0
- package/template/packages/admin/src/pages/master-data/vendors/ViewPage.tsx +274 -0
- package/template/packages/admin/src/pages/master-data/vendors/index.ts +2 -0
- package/template/packages/admin/src/pages/placeholder-page.tsx +13 -0
- package/template/packages/admin/src/pages/purchase-orders/ListPage.tsx +289 -0
- package/template/packages/admin/src/pages/purchase-orders/ViewPage.tsx +343 -0
- package/template/packages/admin/src/pages/purchase-orders/index.ts +2 -0
- package/template/packages/admin/src/pages/purchase-requisitions/CreatePage.tsx +398 -0
- package/template/packages/admin/src/pages/purchase-requisitions/EditPage.tsx +473 -0
- package/template/packages/admin/src/pages/purchase-requisitions/ListPage.tsx +307 -0
- package/template/packages/admin/src/pages/purchase-requisitions/ViewPage.tsx +304 -0
- package/template/packages/admin/src/pages/purchase-requisitions/constants.ts +51 -0
- package/template/packages/admin/src/pages/purchase-requisitions/index.ts +4 -0
- package/template/packages/admin/src/pages/reports/PurchaseOrderReport.tsx +312 -0
- package/template/packages/admin/src/pages/reports/PurchaseRequisitionReport.tsx +303 -0
- package/template/packages/admin/src/pages/reports/index.ts +2 -0
- package/template/packages/admin/src/pages/settings-page.tsx +335 -0
- package/template/packages/admin/src/providers/app-config.tsx +50 -0
- package/template/packages/admin/src/routes/auth.ts +6 -0
- package/template/packages/admin/src/routes/index.ts +85 -0
- package/template/packages/admin/src/routes/menu.ts +176 -0
- package/template/packages/admin/src/routes/modules/goods-receipt.ts +31 -0
- package/template/packages/admin/src/routes/modules/master-data.ts +41 -0
- package/template/packages/admin/src/routes/modules/purchase-orders.ts +27 -0
- package/template/packages/admin/src/routes/modules/purchase-requisitions.ts +39 -0
- package/template/packages/admin/src/routes/modules/reports.ts +33 -0
- package/template/packages/admin/src/routes/modules/settings.ts +19 -0
- package/template/packages/admin/src/routes/withSuspense.tsx +21 -0
- package/template/packages/admin/src/theme/amber.css +27 -0
- package/template/packages/admin/src/theme/blue.css +27 -0
- package/template/packages/admin/src/theme/default.css +75 -0
- package/template/packages/admin/src/theme/fiori.css +180 -0
- package/template/packages/admin/src/theme/green.css +27 -0
- package/template/packages/admin/src/theme/index.css +12 -0
- package/template/packages/admin/src/theme/rose.css +27 -0
- package/template/packages/admin/src/theme/violet.css +27 -0
- package/template/packages/admin/src/vite-env.d.ts +1 -0
- package/template/packages/admin/tsconfig.json +28 -0
- package/template/packages/admin/tsconfig.node.json +21 -0
- package/template/packages/admin/vite.config.ts +26 -0
- package/template/packages/api/.eslintrc.json +6 -0
- package/template/packages/api/.swcrc +17 -0
- package/template/packages/api/app.config.ts +160 -0
- package/template/packages/api/docs/api-document.md +497 -0
- package/template/packages/api/examples/security/README.md +664 -0
- package/template/packages/api/examples/security/complete/.env.example +26 -0
- package/template/packages/api/examples/security/complete/PROJECT_STRUCTURE.md +220 -0
- package/template/packages/api/examples/security/complete/README.md +847 -0
- package/template/packages/api/examples/security/complete/app.config.ts +69 -0
- package/template/packages/api/examples/security/complete/app.ts +63 -0
- package/template/packages/api/examples/security/complete/controller/auth.controller.ts +131 -0
- package/template/packages/api/examples/security/complete/controller/index.ts +4 -0
- package/template/packages/api/examples/security/complete/controller/permission.controller.ts +41 -0
- package/template/packages/api/examples/security/complete/controller/role.controller.ts +53 -0
- package/template/packages/api/examples/security/complete/controller/user.controller.ts +53 -0
- package/template/packages/api/examples/security/complete/dto/change-password.dto.ts +10 -0
- package/template/packages/api/examples/security/complete/dto/create-permission.dto.ts +14 -0
- package/template/packages/api/examples/security/complete/dto/create-role.dto.ts +11 -0
- package/template/packages/api/examples/security/complete/dto/create-user.dto.ts +15 -0
- package/template/packages/api/examples/security/complete/dto/index.ts +7 -0
- package/template/packages/api/examples/security/complete/dto/login.dto.ts +10 -0
- package/template/packages/api/examples/security/complete/dto/oauth-profile.dto.ts +7 -0
- package/template/packages/api/examples/security/complete/dto/register.dto.ts +17 -0
- package/template/packages/api/examples/security/complete/entity/index.ts +6 -0
- package/template/packages/api/examples/security/complete/entity/oauth-account.entity.ts +39 -0
- package/template/packages/api/examples/security/complete/entity/permission.entity.ts +31 -0
- package/template/packages/api/examples/security/complete/entity/role-permission.entity.ts +19 -0
- package/template/packages/api/examples/security/complete/entity/role.entity.ts +25 -0
- package/template/packages/api/examples/security/complete/entity/user-role.entity.ts +19 -0
- package/template/packages/api/examples/security/complete/entity/user.entity.ts +46 -0
- package/template/packages/api/examples/security/complete/init.sql +81 -0
- package/template/packages/api/examples/security/complete/middleware/auth.interceptor.ts +39 -0
- package/template/packages/api/examples/security/complete/middleware/index.ts +2 -0
- package/template/packages/api/examples/security/complete/middleware/permission.interceptor.ts +61 -0
- package/template/packages/api/examples/security/complete/package.json +54 -0
- package/template/packages/api/examples/security/complete/seed.sql +42 -0
- package/template/packages/api/examples/security/complete/service/auth.service.ts +41 -0
- package/template/packages/api/examples/security/complete/service/index.ts +5 -0
- package/template/packages/api/examples/security/complete/service/oauth.service.ts +82 -0
- package/template/packages/api/examples/security/complete/service/permission.service.ts +113 -0
- package/template/packages/api/examples/security/complete/service/role.service.ts +85 -0
- package/template/packages/api/examples/security/complete/service/user.service.ts +132 -0
- package/template/packages/api/examples/security/complete/tests/TEST_REPORT.md +318 -0
- package/template/packages/api/examples/security/complete/tests/generate-report.js +335 -0
- package/template/packages/api/examples/security/complete/tests/helpers/api-helpers.ts +116 -0
- package/template/packages/api/examples/security/complete/tests/helpers/index.ts +2 -0
- package/template/packages/api/examples/security/complete/tests/helpers/test-helpers.ts +129 -0
- package/template/packages/api/examples/security/complete/tests/integration/auth.api.test.ts +429 -0
- package/template/packages/api/examples/security/complete/tests/integration/role.api.test.ts +400 -0
- package/template/packages/api/examples/security/complete/tests/integration/user.api.test.ts +459 -0
- package/template/packages/api/examples/security/complete/tests/jest.config.js +40 -0
- package/template/packages/api/examples/security/complete/tests/run-all-tests.js +135 -0
- package/template/packages/api/examples/security/complete/tests/run-tests.js +109 -0
- package/template/packages/api/examples/security/complete/tests/setup.ts +19 -0
- package/template/packages/api/examples/security/complete/tests/unit/auth.service.test.ts +199 -0
- package/template/packages/api/examples/security/complete/tests/unit/permission.service.test.ts +377 -0
- package/template/packages/api/examples/security/complete/tests/unit/user.service.test.ts +288 -0
- package/template/packages/api/examples/security/complete/tsconfig.json +35 -0
- package/template/packages/api/examples/security/jwt/README.md +424 -0
- package/template/packages/api/examples/security/local/README.md +499 -0
- package/template/packages/api/examples/security/oauth2/README.md +637 -0
- package/template/packages/api/examples/security/permission/README.md +943 -0
- package/template/packages/api/examples/security/session/README.md +753 -0
- package/template/packages/api/package.json +56 -0
- package/template/packages/api/src/controller/auth.controller.ts +127 -0
- package/template/packages/api/src/controller/cache.controller.ts +106 -0
- package/template/packages/api/src/controller/menu.controller.ts +46 -0
- package/template/packages/api/src/controller/mq.controller.ts +35 -0
- package/template/packages/api/src/controller/role.controller.ts +51 -0
- package/template/packages/api/src/controller/upload.controller.ts +85 -0
- package/template/packages/api/src/controller/user.controller.ts +57 -0
- package/template/packages/api/src/dto/auth.dto.ts +30 -0
- package/template/packages/api/src/dto/cache.dto.ts +24 -0
- package/template/packages/api/src/dto/menu.dto.ts +37 -0
- package/template/packages/api/src/dto/mq.dto.ts +16 -0
- package/template/packages/api/src/dto/role.dto.ts +16 -0
- package/template/packages/api/src/dto/user.dto.ts +35 -0
- package/template/packages/api/src/entity/menu.entity.ts +34 -0
- package/template/packages/api/src/entity/role-menu.entity.ts +13 -0
- package/template/packages/api/src/entity/role.entity.ts +22 -0
- package/template/packages/api/src/entity/user-role.entity.ts +13 -0
- package/template/packages/api/src/entity/user.entity.ts +31 -0
- package/template/packages/api/src/mapper/menu.mapper.ts +6 -0
- package/template/packages/api/src/mapper/role-menu.mapper.ts +6 -0
- package/template/packages/api/src/mapper/role.mapper.ts +6 -0
- package/template/packages/api/src/mapper/user-role.mapper.ts +6 -0
- package/template/packages/api/src/mapper/user.mapper.ts +11 -0
- package/template/packages/api/src/scripts/init-db.ts +185 -0
- package/template/packages/api/src/server.ts +76 -0
- package/template/packages/api/src/service/auth.service.ts +106 -0
- package/template/packages/api/src/service/cache.service.ts +80 -0
- package/template/packages/api/src/service/log.request.service.ts +158 -0
- package/template/packages/api/src/service/log.service.ts +123 -0
- package/template/packages/api/src/service/menu.service.ts +94 -0
- package/template/packages/api/src/service/mq.consumer.service.ts +26 -0
- package/template/packages/api/src/service/role.service.ts +88 -0
- package/template/packages/api/src/service/user.service.ts +170 -0
- package/template/packages/api/src/types/sqljs.d.ts +18 -0
- package/template/packages/api/src/utils/auth.utils.js +0 -0
- package/template/packages/api/src/utils/jwt.util.ts +29 -0
- package/template/packages/api/tsconfig.json +17 -0
- package/template/packages/api/tsup.config.ts +9 -0
- package/template/packages/api/uploads/.gitkeep +0 -0
- package/template/packages/core/package.json +31 -0
- package/template/packages/core/src/auth/auth-client-middleware.ts +22 -0
- package/template/packages/core/src/auth/auth-service.ts +65 -0
- package/template/packages/core/src/auth/default-auth-provider.ts +37 -0
- package/template/packages/core/src/auth/index.ts +10 -0
- package/template/packages/core/src/auth/types.ts +38 -0
- package/template/packages/core/src/authorization/authorization-client-middleware.ts +38 -0
- package/template/packages/core/src/authorization/authorization-config.ts +13 -0
- package/template/packages/core/src/authorization/authorization-provider.tsx +116 -0
- package/template/packages/core/src/authorization/default-authorization-provider.ts +26 -0
- package/template/packages/core/src/authorization/index.ts +15 -0
- package/template/packages/core/src/authorization/types.ts +42 -0
- package/template/packages/core/src/index.ts +3 -0
- package/template/packages/core/src/utils/promise-result-cache.ts +18 -0
- package/template/packages/core/tsconfig.json +19 -0
- package/template/packages/mobile/README.md +55 -0
- package/template/packages/mobile/index.html +13 -0
- package/template/packages/mobile/package.json +30 -0
- package/template/packages/mobile/postcss.config.mjs +7 -0
- package/template/packages/mobile/src/App.tsx +5 -0
- package/template/packages/mobile/src/app/globals.css +1 -0
- package/template/packages/mobile/src/components/LoginForm.tsx +76 -0
- package/template/packages/mobile/src/hooks/index.ts +5 -0
- package/template/packages/mobile/src/lib/utils.ts +7 -0
- package/template/packages/mobile/src/main.tsx +13 -0
- package/template/packages/mobile/src/pages/HomePage.tsx +35 -0
- package/template/packages/mobile/src/pages/LoginPage.tsx +35 -0
- package/template/packages/mobile/src/pages/index.ts +2 -0
- package/template/packages/mobile/src/routes/ProtectedRoute.tsx +29 -0
- package/template/packages/mobile/src/routes/index.tsx +24 -0
- package/template/packages/mobile/src/routes/routes.ts +11 -0
- package/template/packages/mobile/src/types/index.ts +5 -0
- package/template/packages/mobile/src/vite-env.d.ts +1 -0
- package/template/packages/mobile/tsconfig.json +23 -0
- package/template/packages/mobile/tsconfig.node.json +11 -0
- package/template/packages/mobile/vite.config.ts +19 -0
- package/template/packages/shared/package.json +20 -0
- package/template/packages/shared/src/constants.ts +8 -0
- package/template/packages/shared/src/index.ts +5 -0
- package/template/packages/shared/tsconfig.json +13 -0
- package/template/packages/shared-auth/package.json +29 -0
- package/template/packages/shared-auth/src/AuthContext.tsx +177 -0
- package/template/packages/shared-auth/src/AuthProviderWrapper.tsx +29 -0
- package/template/packages/shared-auth/src/index.ts +10 -0
- package/template/packages/shared-auth/tsconfig.json +14 -0
- package/template/pnpm-lock.yaml +16349 -0
- package/template/pnpm-workspace.yaml +3 -0
- package/template/scripts/postinstall.cjs +42 -0
- package/template/scripts/rebuild-sqlite.cjs +23 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# 脚手架中 better-sqlite3 设计说明
|
|
2
|
+
|
|
3
|
+
本文档梳理 **scaffold** 与 **aiko-boot-create** 的职责,并确定在脚手架中 better-sqlite3 的定位与设计。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 一、scaffold 与 aiko-boot-create 职责梳理
|
|
8
|
+
|
|
9
|
+
### 1. scaffold(模板目录)
|
|
10
|
+
|
|
11
|
+
- **位置**:`ai-frist-framework/scaffold/`
|
|
12
|
+
- **角色**:作为 **项目模板**,被 aiko-boot-create 复制到用户指定目录,生成新项目。
|
|
13
|
+
- **内容**:
|
|
14
|
+
- **packages/api**:后端 API(aiko-boot + starter-orm),默认 SQLite(`./data/app.db`)
|
|
15
|
+
- **packages/admin**、**packages/mobile**:前端应用
|
|
16
|
+
- **packages/shared**、**packages/shared-auth**(可选):公共常量与鉴权
|
|
17
|
+
- **数据库相关**:
|
|
18
|
+
- `packages/api/app.config.ts`:配置 `database: { type: 'sqlite', filename: './data/app.db' }`
|
|
19
|
+
- `packages/api/src/scripts/init-db.ts`:初始化数据库(建表、种子数据)
|
|
20
|
+
- API 运行时通过 `@ai-partner-x/aiko-boot-starter-orm` 使用 **better-sqlite3** 连接同一文件
|
|
21
|
+
|
|
22
|
+
### 2. aiko-boot-create(CLI)
|
|
23
|
+
|
|
24
|
+
- **位置**:`ai-frist-framework/packages/aiko-boot-create/`
|
|
25
|
+
- **角色**:从 `scaffold` 复制模板到目标目录,并做 **scope 替换**、**依赖覆盖**、**可选功能** 等后处理。
|
|
26
|
+
- **主要能力**:
|
|
27
|
+
- 交互/非交互:项目名、目标目录、是否带「基础系统」(登录、shared-auth、用户表等)
|
|
28
|
+
- **withBaseSystem = true**:完整复制 scaffold,包含 auth 相关代码;init-db 建 `sys_user` 并插种子
|
|
29
|
+
- **withBaseSystem = false(bare)**:不复制 shared-auth 及 auth 相关文件,并写入「无用户表」版的 `init-db.ts`(仍用 sql.js)
|
|
30
|
+
- **与 SQLite 的关系**:CLI 只负责复制/生成文件,不直接依赖 better-sqlite3;生成的 init-db 脚本统一使用 **sql.js**,避免在「生成阶段」依赖原生模块。
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 二、better-sqlite3 在脚手架中的双轨设计
|
|
35
|
+
|
|
36
|
+
当前设计是 **初始化** 与 **运行时** 分离,兼顾「开箱即跑」和「性能/能力」:
|
|
37
|
+
|
|
38
|
+
| 场景 | 技术选型 | 原因 |
|
|
39
|
+
|----------------|-----------------|------|
|
|
40
|
+
| **init-db 脚本** | **sql.js**(纯 JS) | 无需 node-gyp,任意环境执行 `pnpm init-db` 即可生成 `data/app.db`,不依赖 better-sqlite3 编译 |
|
|
41
|
+
| **API 运行时** | **better-sqlite3**(原生) | 由 `aiko-boot-starter-orm` 在运行时 `import('better-sqlite3')`,连接同一 `./data/app.db`,性能与能力更好 |
|
|
42
|
+
|
|
43
|
+
因此:
|
|
44
|
+
|
|
45
|
+
- **scaffold** 的 `packages/api` 需要同时声明:
|
|
46
|
+
- **dependencies**:`better-sqlite3`(运行时由 starter-orm 使用)
|
|
47
|
+
- **devDependencies**:`sql.js`(仅 init-db 脚本使用)
|
|
48
|
+
- **init-db.ts** 只使用 sql.js,不引用 better-sqlite3;生成的文件与 API 运行时使用的 `./data/app.db` 路径、格式一致(SQLite 兼容)。
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 三、better-sqlite3 在脚手架中的具体设计
|
|
53
|
+
|
|
54
|
+
### 3.1 依赖与脚本(scaffold/packages/api)
|
|
55
|
+
|
|
56
|
+
- **package.json**:
|
|
57
|
+
- `dependencies`:`better-sqlite3@^12.6.2`(与 aiko-boot-starter-orm 一致)
|
|
58
|
+
- `devDependencies`:`sql.js`、`@types/better-sqlite3`
|
|
59
|
+
- **scripts**:
|
|
60
|
+
- `init-db`:执行 `src/scripts/init-db.ts`(仅用 sql.js,不触发 better-sqlite3 编译)
|
|
61
|
+
|
|
62
|
+
### 3.2 配置与路径
|
|
63
|
+
|
|
64
|
+
- **app.config.ts**:`database: { type: 'sqlite', filename: './data/app.db' }`(相对 api 包根目录)
|
|
65
|
+
- **init-db.ts**:写入路径与配置一致(如 `packages/api/data/app.db`),保证首次 `pnpm init-db` 后,API 启动即可读同一库。
|
|
66
|
+
|
|
67
|
+
### 3.3 原生模块编译(rebuild:sqlite)
|
|
68
|
+
|
|
69
|
+
- **better-sqlite3** 为原生模块,在部分环境(如新 Node 版本、不同架构)下可能需重新编译。
|
|
70
|
+
- **建议**:在 **scaffold 根目录** `package.json` 中增加脚本,使「生成后的项目」在根目录即可执行,无需依赖框架仓库根目录:
|
|
71
|
+
- 脚本示例:`"rebuild:sqlite": "cd node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3 && npm run build-release"`
|
|
72
|
+
- 版本号需与 `packages/api` 的 `better-sqlite3` 一致。若 pnpm 安装后路径带 hash(如 `better-sqlite3@12.6.2_xxx`),请按实际 `.pnpm` 目录名调整路径后再执行。
|
|
73
|
+
- **文档**:在 scaffold 的 README 中说明:首次或换环境后若 API 报 better-sqlite3 bindings 相关错误,可在**项目根**执行 `pnpm run rebuild:sqlite`(或按文档在 api 包内执行相应命令)。
|
|
74
|
+
|
|
75
|
+
### 3.4 aiko-boot-create 的配合
|
|
76
|
+
|
|
77
|
+
- **withBaseSystem**:复制完整 scaffold,包含 api 的 better-sqlite3 依赖与 init-db(sql.js + sys_user);生成后提示 `pnpm init-db` 与可选的 `pnpm run rebuild:sqlite`。
|
|
78
|
+
- **bare**:仍复制 api 包(含 better-sqlite3 依赖、app.config 的 sqlite、init-db 脚本),但 init-db 为「无用户表」版;若后续用户不用 SQLite,可自行改配置与依赖。
|
|
79
|
+
- CLI 生成的项目**根** package.json 来自 scaffold 根,因此若在 scaffold 根增加 `rebuild:sqlite`,生成项目即可自带该脚本。
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 四、设计小结
|
|
84
|
+
|
|
85
|
+
| 项目 | 内容 |
|
|
86
|
+
|------------|------|
|
|
87
|
+
| **init-db** | 仅用 **sql.js**,不依赖 better-sqlite3 编译;withBaseSystem 时建 sys_user + 种子,bare 时不建用户表。 |
|
|
88
|
+
| **API 运行时** | 使用 **better-sqlite3**(通过 starter-orm 动态 import),连接 `./data/app.db`。 |
|
|
89
|
+
| **依赖** | api 包:better-sqlite3(dependencies),sql.js(devDependencies)。 |
|
|
90
|
+
| **rebuild** | scaffold 根 package.json 提供 `rebuild:sqlite`,生成项目在根目录即可重编 better-sqlite3。 |
|
|
91
|
+
| **文档** | README 中说明 init-db 与 rebuild:sqlite 的适用场景与执行顺序。 |
|
|
92
|
+
|
|
93
|
+
这样既保证「克隆即用、init-db 无障碍」,又保证运行时使用 better-sqlite3 的性能与能力,并在需要时通过统一脚本解决原生模块编译问题。
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 五、与 pnpm overrides 的配合(类似 test-mobile)
|
|
98
|
+
|
|
99
|
+
- **pnpm.overrides**:不由模板写死,由 **aiko-boot-create** 在生成项目时根据「目标目录 → 框架根目录」的相对路径动态写入,效果与 test-mobile 中手写的 `file:../ai-frist-framework/packages/...` 一致。
|
|
100
|
+
- **pnpm.onlyBuiltDependencies**:在 scaffold 根 `package.json` 中配置 `["better-sqlite3"]`,仅编译该原生依赖,加快 install。
|
|
101
|
+
- **postinstall**:在 scaffold 中配置 `pnpm rebuild better-sqlite3`,生成项目在 `pnpm install` 后自动重编 better-sqlite3,避免首次运行 API 时报 bindings 错误。
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# shared 与 shared-auth 边界及 CLI 可选装配
|
|
2
|
+
|
|
3
|
+
## 1. 职责边界
|
|
4
|
+
|
|
5
|
+
| 包 | 职责 | 内容 |
|
|
6
|
+
|----|------|------|
|
|
7
|
+
| **@scaffold/shared** | 与运行环境、UI、鉴权均无关的公共常量与工具 | `DEFAULT_API_BASE_URL`、`API_BASE_URL_KEY`、`AUTH_STORAGE_KEY`(仅 key 名,无鉴权逻辑) |
|
|
8
|
+
| **@scaffold/shared-auth** | 鉴权相关的前端逻辑(不含具体表单 UI) | `AuthProvider`、`useAuth`、`AuthProviderWrapper`、类型与持久化 |
|
|
9
|
+
|
|
10
|
+
- **shared**:始终存在,CLI 生成「不需要系统功能」时仅去掉与 auth 相关的导出(如 `AUTH_STORAGE_KEY`),其余不变。
|
|
11
|
+
- **shared-auth**:仅在选择「需要系统功能(登录)」时生成;admin/mobile 仅在此时依赖该包。
|
|
12
|
+
|
|
13
|
+
## 2. 是否将 shared-auth 合并到 shared?
|
|
14
|
+
|
|
15
|
+
**结论:不合并,保持 shared-auth 独立包。**
|
|
16
|
+
|
|
17
|
+
原因:
|
|
18
|
+
|
|
19
|
+
1. **CLI 可选装配**
|
|
20
|
+
- 选「不需要系统功能」时,**不生成**整个 `packages/shared-auth` 目录即可。
|
|
21
|
+
- admin/mobile 的 `package.json` 中不声明 `@scaffold/shared-auth`,不引用 `AuthProviderWrapper`、`LoginForm`、`useAuth`。
|
|
22
|
+
- 若合并进 shared,则需要在同一包内维护「带 auth / 不带 auth」两套模板或条件导出,CLI 与包内结构都更复杂。
|
|
23
|
+
|
|
24
|
+
2. **依赖与体积**
|
|
25
|
+
- shared 仅含常量,无 React、无 API 客户端,可被任意端(含非前端)引用。
|
|
26
|
+
- shared-auth 依赖 `react`、`@scaffold/api`、`@scaffold/shared`。合并后 shared 会带上这些依赖,不利于「仅要常量」的场景。
|
|
27
|
+
|
|
28
|
+
3. **边界清晰**
|
|
29
|
+
- 「要登录」→ 依赖 shared + shared-auth;「不要登录」→ 只依赖 shared。
|
|
30
|
+
- 包级开关,便于文档、CLI 模板和后续扩展(如多套 auth 实现)。
|
|
31
|
+
|
|
32
|
+
因此:**CLI 对 auth 可选装配时,应通过「是否生成 shared-auth 包」来控制,不将 shared-auth 合并到 shared。**
|
|
33
|
+
|
|
34
|
+
## 3. 已从 admin/mobile 提取到 shared-auth 的内容
|
|
35
|
+
|
|
36
|
+
仅 **AuthProviderWrapper** 放在 shared-auth,admin 与 mobile 在根节点引用即可;**LoginForm 不共享**,各端在各自包内维护(admin 与 mobile 可使用不同 UI/交互)。
|
|
37
|
+
|
|
38
|
+
| 内容 | 说明 |
|
|
39
|
+
|------|------|
|
|
40
|
+
| **AuthProviderWrapper** | 根节点 Provider,内部读取 `VITE_API_URL` 或 `DEFAULT_API_BASE_URL`,传入 `AuthProvider`。 |
|
|
41
|
+
|
|
42
|
+
- admin:`main.tsx` 使用 `AuthProviderWrapper`,`App.tsx` 使用本地的 `LoginForm`(如 `src/components/LoginForm.tsx`)。
|
|
43
|
+
- mobile:`main.tsx` 使用 `AuthProviderWrapper`,`LoginPage` 使用本地的 `LoginForm`(如 `src/components/LoginForm.tsx`)。
|
|
44
|
+
|
|
45
|
+
## 4. 无需放入 shared 的 app 专属内容
|
|
46
|
+
|
|
47
|
+
- **路由路径常量**(如 mobile 的 `ROUTES.LOGIN`、`ROUTES.HOME`):各应用路由不同,保留在各自 `routes/routes.ts` 即可。
|
|
48
|
+
- **页面与布局**:各端 UI 与路由结构不同,保留在各自 `pages/`、`components/`。
|
|
49
|
+
- **lib/utils、types**:仅当出现多端完全一致的实现再考虑提到 shared;当前可保留在各端。
|
|
50
|
+
|
|
51
|
+
## 5. CLI 行为小结
|
|
52
|
+
|
|
53
|
+
- **需要系统功能(登录)**:生成 `shared-auth`;shared 导出含 `AUTH_STORAGE_KEY`;admin/mobile 依赖 shared-auth,使用 `AuthProviderWrapper`、`LoginForm`、`useAuth`。
|
|
54
|
+
- **不需要系统功能**:不生成 `shared-auth`;shared 使用不包含 `AUTH_STORAGE_KEY` 的模板;admin/mobile 不依赖 shared-auth,不包含登录相关文件与引用。
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "scaffold-monorepo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "A clean scaffold template for api, admin, mobile, shared, and shared-auth packages.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18.0.0",
|
|
9
|
+
"pnpm": ">=9.0.0"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "pnpm --parallel dev:api dev:admin dev:mobile",
|
|
13
|
+
"dev:api": "pnpm --filter @scaffold/api dev",
|
|
14
|
+
"dev:admin": "pnpm --filter @scaffold/admin dev",
|
|
15
|
+
"dev:mobile": "pnpm --filter @scaffold/mobile dev",
|
|
16
|
+
"build": "pnpm -r --if-present build",
|
|
17
|
+
"lint": "pnpm -r --if-present lint",
|
|
18
|
+
"init-db": "pnpm --filter @scaffold/api init-db",
|
|
19
|
+
"rebuild:sqlite": "node ./scripts/rebuild-sqlite.cjs",
|
|
20
|
+
"clean": "pnpm -r --if-present clean"
|
|
21
|
+
},
|
|
22
|
+
"packageManager": "pnpm@10.27.0"
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VITE_APP_LOGIN=/login
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# This Dockerfile uses `serve` npm package to serve the static files with node process.
|
|
2
|
+
# You can find the Dockerfile for nginx in the following link:
|
|
3
|
+
# https://github.com/refinedev/dockerfiles/blob/main/vite/Dockerfile.nginx
|
|
4
|
+
FROM refinedev/node:18 AS base
|
|
5
|
+
|
|
6
|
+
FROM base as deps
|
|
7
|
+
|
|
8
|
+
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
|
|
9
|
+
|
|
10
|
+
RUN \
|
|
11
|
+
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
|
12
|
+
elif [ -f package-lock.json ]; then npm ci; \
|
|
13
|
+
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
|
|
14
|
+
else echo "Lockfile not found." && exit 1; \
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
FROM base as builder
|
|
18
|
+
|
|
19
|
+
ENV NODE_ENV production
|
|
20
|
+
|
|
21
|
+
COPY --from=deps /app/refine/node_modules ./node_modules
|
|
22
|
+
|
|
23
|
+
COPY . .
|
|
24
|
+
|
|
25
|
+
RUN npm run build
|
|
26
|
+
|
|
27
|
+
FROM base as runner
|
|
28
|
+
|
|
29
|
+
ENV NODE_ENV production
|
|
30
|
+
|
|
31
|
+
RUN npm install -g serve
|
|
32
|
+
|
|
33
|
+
COPY --from=builder /app/refine/dist ./
|
|
34
|
+
|
|
35
|
+
USER refine
|
|
36
|
+
|
|
37
|
+
CMD ["serve"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# admin
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility ✨
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Available Scripts
|
|
9
|
+
|
|
10
|
+
### Running the development server.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm dev
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Building for production.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm build
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Running the production server.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm start
|
|
26
|
+
```
|
|
27
|
+
|
|
@@ -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/App.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,28 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
3
|
+
import reactRefresh from "eslint-plugin-react-refresh";
|
|
4
|
+
import globals from "globals";
|
|
5
|
+
import tseslint from "typescript-eslint";
|
|
6
|
+
|
|
7
|
+
export default tseslint.config(
|
|
8
|
+
{ ignores: ["dist"] },
|
|
9
|
+
{
|
|
10
|
+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
11
|
+
files: ["**/*.{ts,tsx}"],
|
|
12
|
+
languageOptions: {
|
|
13
|
+
ecmaVersion: 2020,
|
|
14
|
+
globals: globals.browser,
|
|
15
|
+
},
|
|
16
|
+
plugins: {
|
|
17
|
+
"react-hooks": reactHooks,
|
|
18
|
+
"react-refresh": reactRefresh,
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
...reactHooks.configs.recommended.rules,
|
|
22
|
+
"react-refresh/only-export-components": [
|
|
23
|
+
"warn",
|
|
24
|
+
{ allowConstantExport: true },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<meta name="description" content="Admin application" />
|
|
8
|
+
<title>Admin</title>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<script>
|
|
12
|
+
(function () {
|
|
13
|
+
var key = "app-theme";
|
|
14
|
+
try {
|
|
15
|
+
var raw = localStorage.getItem(key);
|
|
16
|
+
if (raw) {
|
|
17
|
+
var doc = document.documentElement;
|
|
18
|
+
if (["light", "dark", "system"].indexOf(raw) !== -1) {
|
|
19
|
+
var appearance = raw === "system"
|
|
20
|
+
? (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light")
|
|
21
|
+
: raw;
|
|
22
|
+
doc.classList.add(appearance);
|
|
23
|
+
} else {
|
|
24
|
+
var parsed = JSON.parse(raw);
|
|
25
|
+
var appearance = parsed.appearance === "system"
|
|
26
|
+
? (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light")
|
|
27
|
+
: (parsed.appearance || "light");
|
|
28
|
+
var palette = parsed.palette || "fiori";
|
|
29
|
+
doc.classList.add(appearance);
|
|
30
|
+
doc.setAttribute("data-palette", palette);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
} catch (e) {}
|
|
34
|
+
})();
|
|
35
|
+
</script>
|
|
36
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
37
|
+
<div id="root"></div>
|
|
38
|
+
<script type="module" src="/src/index.tsx"></script>
|
|
39
|
+
<!--
|
|
40
|
+
This HTML file is a template.
|
|
41
|
+
If you open it directly in the browser, you will see an empty page.
|
|
42
|
+
|
|
43
|
+
You can add webfonts, meta tags, or analytics to this file.
|
|
44
|
+
The build step will place the bundled scripts into the <body> tag.
|
|
45
|
+
|
|
46
|
+
To begin the development, run `npm dev` or `yarn start`.
|
|
47
|
+
To create a production bundle, use `npm run build` or `yarn build`.
|
|
48
|
+
-->
|
|
49
|
+
</body>
|
|
50
|
+
</html>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@scaffold/admin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc && vite build --mode prod",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@scaffold/api": "workspace:*",
|
|
13
|
+
"@scaffold/core": "workspace:*",
|
|
14
|
+
"@hookform/resolvers": "^5.0.1",
|
|
15
|
+
"@radix-ui/react-accordion": "^1.2.8",
|
|
16
|
+
"@radix-ui/react-alert-dialog": "^1.1.11",
|
|
17
|
+
"@radix-ui/react-aspect-ratio": "^1.1.4",
|
|
18
|
+
"@radix-ui/react-avatar": "^1.1.7",
|
|
19
|
+
"@radix-ui/react-checkbox": "^1.2.3",
|
|
20
|
+
"@radix-ui/react-collapsible": "^1.1.8",
|
|
21
|
+
"@radix-ui/react-context-menu": "^2.2.12",
|
|
22
|
+
"@radix-ui/react-dialog": "^1.1.11",
|
|
23
|
+
"@radix-ui/react-dropdown-menu": "^2.1.12",
|
|
24
|
+
"@radix-ui/react-hover-card": "^1.1.11",
|
|
25
|
+
"@radix-ui/react-label": "^2.1.4",
|
|
26
|
+
"@radix-ui/react-menubar": "^1.1.12",
|
|
27
|
+
"@radix-ui/react-navigation-menu": "^1.2.10",
|
|
28
|
+
"@radix-ui/react-popover": "^1.1.11",
|
|
29
|
+
"@radix-ui/react-progress": "^1.1.4",
|
|
30
|
+
"@radix-ui/react-radio-group": "^1.3.4",
|
|
31
|
+
"@radix-ui/react-scroll-area": "^1.2.6",
|
|
32
|
+
"@radix-ui/react-select": "^2.2.2",
|
|
33
|
+
"@radix-ui/react-separator": "^1.1.4",
|
|
34
|
+
"@radix-ui/react-slider": "^1.3.2",
|
|
35
|
+
"@radix-ui/react-slot": "^1.2.0",
|
|
36
|
+
"@radix-ui/react-switch": "^1.2.2",
|
|
37
|
+
"@radix-ui/react-tabs": "^1.1.9",
|
|
38
|
+
"@radix-ui/react-toggle": "^1.1.6",
|
|
39
|
+
"@radix-ui/react-toggle-group": "^1.1.7",
|
|
40
|
+
"@radix-ui/react-tooltip": "^1.2.4",
|
|
41
|
+
"@tailwindcss/vite": "^4.1.8",
|
|
42
|
+
"@tanstack/react-table": "^8.2.6",
|
|
43
|
+
"class-variance-authority": "^0.7.1",
|
|
44
|
+
"clsx": "^2.1.1",
|
|
45
|
+
"cmdk": "^1.1.1",
|
|
46
|
+
"date-fns": "^4.1.0",
|
|
47
|
+
"dayjs": "^1.10.7",
|
|
48
|
+
"embla-carousel-react": "^8.6.0",
|
|
49
|
+
"i18next": "^24.2.0",
|
|
50
|
+
"input-otp": "^1.4.2",
|
|
51
|
+
"lucide-react": "^0.487.0",
|
|
52
|
+
"next-themes": "^0.4.6",
|
|
53
|
+
"postcss": "^8.5.3",
|
|
54
|
+
"react": "19.1.0",
|
|
55
|
+
"react-day-picker": "8.10.1",
|
|
56
|
+
"react-dom": "19.1.0",
|
|
57
|
+
"react-hook-form": "^7.57.0",
|
|
58
|
+
"react-i18next": "^15.1.0",
|
|
59
|
+
"react-resizable-panels": "^2.1.8",
|
|
60
|
+
"react-router": "^7.0.2",
|
|
61
|
+
"recharts": "^2.15.3",
|
|
62
|
+
"shadcn": "^2.4.1",
|
|
63
|
+
"sonner": "^2.0.3",
|
|
64
|
+
"swr": "^2.4.1",
|
|
65
|
+
"tailwind-merge": "^3.2.0",
|
|
66
|
+
"tw-animate-css": "^1.2.5",
|
|
67
|
+
"vaul": "^1.1.2",
|
|
68
|
+
"zod": "^3.24.3"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@eslint/js": "^9.25.0",
|
|
72
|
+
"@tailwindcss/postcss": "^4.1.4",
|
|
73
|
+
"@types/node": "^20",
|
|
74
|
+
"@types/react": "^19.1.0",
|
|
75
|
+
"@types/react-dom": "^19.1.0",
|
|
76
|
+
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
77
|
+
"@typescript-eslint/parser": "^5.57.1",
|
|
78
|
+
"@vitejs/plugin-react": "^4.4.1",
|
|
79
|
+
"eslint": "^9.25.0",
|
|
80
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
81
|
+
"eslint-plugin-react-refresh": "^0.4.19",
|
|
82
|
+
"globals": "^16.0.0",
|
|
83
|
+
"tailwindcss": "^4.1.4",
|
|
84
|
+
"typescript": "^5.8.3",
|
|
85
|
+
"typescript-eslint": "^8.30.1",
|
|
86
|
+
"vite": "^6.3.5"
|
|
87
|
+
},
|
|
88
|
+
"browserslist": {
|
|
89
|
+
"production": [
|
|
90
|
+
">0.2%",
|
|
91
|
+
"not dead",
|
|
92
|
+
"not op_mini all"
|
|
93
|
+
],
|
|
94
|
+
"development": [
|
|
95
|
+
"last 1 chrome version",
|
|
96
|
+
"last 1 firefox version",
|
|
97
|
+
"last 1 safari version"
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "tw-animate-css";
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:is(.dark *));
|
|
5
|
+
|
|
6
|
+
@theme inline {
|
|
7
|
+
/* 紧凑布局:基准间距与圆角(可调 --compact-spacing、--radius 控制整体松紧) */
|
|
8
|
+
--spacing: var(--compact-spacing, 0.2rem);
|
|
9
|
+
--color-background: var(--background);
|
|
10
|
+
--color-foreground: var(--foreground);
|
|
11
|
+
--font-sans: var(--font-geist-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) - 2px);
|
|
43
|
+
--radius-md: calc(var(--radius) - 1px);
|
|
44
|
+
--radius-lg: var(--radius);
|
|
45
|
+
--radius-xl: calc(var(--radius) + 2px);
|
|
46
|
+
|
|
47
|
+
--font-sans: "Inter", sans-serif;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:root {
|
|
51
|
+
/* 基准圆角(紧凑:0.25rem,默认可改为 0.325rem) */
|
|
52
|
+
--radius: 0.3rem;
|
|
53
|
+
/* 基准间距单位,Tailwind 间距 = 该值 × 数字(0.2rem 比默认 0.25rem 约小 20%) */
|
|
54
|
+
--compact-spacing: 0.25rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Theme palettes (src/theme/*.css) */
|
|
58
|
+
@import "./theme/index.css";
|
|
59
|
+
|
|
60
|
+
/* 确保 light/dark 下根节点与 body 使用主题背景色,修复 dark 模式背景不正确 */
|
|
61
|
+
html.light,
|
|
62
|
+
html.dark {
|
|
63
|
+
background-color: var(--background);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@layer base {
|
|
67
|
+
|
|
68
|
+
/* 紧凑:基准字号 14px,使所有 rem 比例缩小(1rem=14px),可改为 15px/16px 放宽 */
|
|
69
|
+
html {
|
|
70
|
+
font-size: 16px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
* {
|
|
74
|
+
@apply border-border outline-ring/50 antialiased;
|
|
75
|
+
font-family: var(--font-sans);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
body {
|
|
79
|
+
@apply bg-background text-foreground;
|
|
80
|
+
min-height: 100vh;
|
|
81
|
+
}
|
|
82
|
+
}
|