瀏覽代碼

test commit

yourname 2 月之前
父節點
當前提交
ebf9a12e02
共有 9 個文件被更改,包括 358 次插入11 次删除
  1. 66 0
      .gitignore
  2. 4 0
      .husky/pre-commit
  3. 114 1
      README.md
  4. 23 10
      docs/stories/epic-1/story-1-1-项目初始化.md
  5. 46 0
      eslint.config.js
  6. 49 0
      package.json
  7. 17 0
      prettier.config.js
  8. 1 0
      test.js
  9. 38 0
      tsconfig.json

+ 66 - 0
.gitignore

@@ -0,0 +1,66 @@
+# Dependencies
+node_modules/
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+
+# Build outputs
+dist/
+build/
+.nyc_output/
+coverage/
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Environment variables
+.env
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+# Logs
+logs
+*.log
+
+# IDE
+.vscode/
+.idea/
+*.swp
+*.swo
+*~
+
+# OS
+.DS_Store
+Thumbs.db
+
+# Temporary folders
+tmp/
+temp/
+
+# Package lock files (we use npm)
+package-lock.json
+yarn.lock
+pnpm-lock.yaml
+
+# TypeScript
+*.tsbuildinfo
+
+# Database
+*.sqlite
+*.db
+
+# MinIO local storage
+minio-data/
+
+# Docker
+.docker/
+
+# Misc
+.cache/
+.parcel-cache/

+ 4 - 0
.husky/pre-commit

@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+
+npx lint-staged

+ 114 - 1
README.md

@@ -1,2 +1,115 @@
-# blank
+# Shadcn Admin Template
 
+一个基于现代技术栈的全栈管理后台启动模板,采用 Monorepo 架构,包含前端 React 应用和后端 Hono API 服务。
+
+## 🚀 特性
+
+- **Monorepo 架构**: 使用 npm workspaces 管理多包项目
+- **现代化技术栈**: React 19 + TypeScript + Hono + Tailwind CSS
+- **类型安全**: 完整的 TypeScript 严格模式配置
+- **代码质量**: ESLint + Prettier + Husky 代码规范保障
+- **开发体验**: 热重载、类型检查、代码格式化
+- **生产就绪**: Docker 容器化部署配置
+
+## 📦 项目结构
+
+```
+shadcn-admin-template/
+├── packages/
+│   ├── client/          # 前端管理后台 (React + shadcn/ui)
+│   ├── server/          # 后端API服务 (Hono + TypeORM)
+│   └── shared/          # 共享代码和类型定义
+├── docs/                # 项目文档
+├── .vscode/            # 编辑器配置
+├── docker/             # Docker 配置
+└── scripts/            # 部署脚本
+```
+
+## 🛠️ 开发环境要求
+
+- Node.js >= 18.0.0
+- npm >= 8.0.0
+- Git
+
+## ⚡ 快速开始
+
+### 安装依赖
+
+```bash
+npm install
+```
+
+### 开发模式
+
+启动前后端开发服务器:
+
+```bash
+npm run dev
+```
+
+前端应用将在 http://localhost:3000 运行
+后端API将在 http://localhost:3001 运行
+
+### 构建生产版本
+
+```bash
+npm run build
+```
+
+### 代码检查
+
+```bash
+# 代码格式检查
+npm run lint
+
+# 类型检查
+npm run typecheck
+
+# 运行测试
+npm run test
+```
+
+## 📋 可用脚本
+
+- `npm run dev` - 启动开发环境(前后端)
+- `npm run build` - 构建生产版本
+- `npm run test` - 运行测试
+- `npm run lint` - 代码检查
+- `npm run typecheck` - TypeScript 类型检查
+
+## 🔧 开发配置
+
+### Git Hooks
+
+项目配置了 pre-commit hook,自动运行:
+
+- ESLint 代码检查
+- Prettier 代码格式化
+
+### 编辑器配置
+
+推荐使用 VS Code 并安装推荐扩展:
+
+- ESLint
+- Prettier
+- TypeScript Hero
+- Tailwind CSS IntelliSense
+
+## 📚 文档
+
+- [架构设计](./docs/architecture.md) - 详细的技术架构说明
+- [产品需求文档](./docs/prd.md) - 产品功能和需求说明
+- [用户故事](./docs/stories/) - 敏捷开发用户故事
+
+## 🐳 Docker 开发环境
+
+项目包含完整的 Docker 开发环境配置:
+
+```bash
+# 启动开发环境
+docker-compose -f docker-compose.dev.yml up
+```
+
+## 📄 许可证
+
+MIT License

+ 23 - 10
docs/stories/epic-1/story-1-1-项目初始化.md

@@ -6,13 +6,26 @@
 
 ## 验收标准
 
-- [ ] 创建packages目录结构(client, server, shared)
-- [ ] 配置根目录package.json文件
-- [ ] 设置TypeScript严格模式配置
-- [ ] 创建基础的.gitignore文件
-- [ ] 配置开发环境启动脚本
-- [ ] 设置代码规范配置文件(ESLint, Prettier)
-- [ ] 创建项目文档目录结构
-- [ ] 配置编辑器设置文件(.vscode/)
-- [ ] 设置Git hooks预提交检查
-- [ ] 创建README基础项目说明文档
+- [x] 创建packages目录结构(client, server, shared)
+- [x] 配置根目录package.json文件
+- [x] 设置TypeScript严格模式配置
+- [x] 创建基础的.gitignore文件
+- [x] 配置开发环境启动脚本
+- [x] 设置代码规范配置文件(ESLint, Prettier)
+- [x] 创建项目文档目录结构
+- [x] 配置编辑器设置文件(.vscode/)
+- [x] 设置Git hooks预提交检查
+- [x] 创建README基础项目说明文档
+
+## 开发笔记
+
+项目初始化已完成,包含以下配置:
+
+- **Monorepo结构**: 创建了 packages/client, packages/server, packages/shared 目录结构
+- **构建配置**: 配置了完整的 TypeScript 严格模式,支持路径别名 (@/_, @shared/_)
+- **代码质量**: 设置了 ESLint + Prettier 代码规范,配置了 pre-commit Git hooks 自动检查
+- **开发体验**: 配置了 VS Code 编辑器设置和推荐扩展
+- **文档完善**: 创建了完整的 README 文档和文档目录结构
+- **脚本配置**: 配置了开发、构建、测试、代码检查等完整脚本命令
+
+所有配置遵循架构文档中的编码标准,项目已具备完整的开发基础环境。

+ 46 - 0
eslint.config.js

@@ -0,0 +1,46 @@
+import js from '@eslint/js';
+import globals from 'globals';
+import reactHooks from 'eslint-plugin-react-hooks';
+import reactRefresh from 'eslint-plugin-react-refresh';
+import tseslint from 'typescript-eslint';
+
+/** @type {import('eslint').Linter.Config[]} */
+export default [
+  {
+    ignores: ['**/node_modules/', '**/dist/', '**/build/', '**/coverage/'],
+  },
+  js.configs.recommended,
+  ...tseslint.configs.recommended,
+  {
+    files: ['**/*.{js,jsx,ts,tsx}'],
+    languageOptions: {
+      ecmaVersion: 2022,
+      globals: {
+        ...globals.browser,
+        ...globals.node,
+      },
+      parserOptions: {
+        ecmaVersion: 'latest',
+        sourceType: 'module',
+        ecmaFeatures: {
+          jsx: true,
+        },
+      },
+    },
+    plugins: {
+      'react-hooks': reactHooks,
+      'react-refresh': reactRefresh,
+    },
+    rules: {
+      ...reactHooks.configs.recommended.rules,
+      'react-refresh/only-export-components': [
+        'warn',
+        { allowConstantExport: true },
+      ],
+      '@typescript-eslint/no-unused-vars': 'error',
+      '@typescript-eslint/no-explicit-any': 'warn',
+      'prefer-const': 'error',
+      'no-var': 'error',
+    },
+  },
+];

+ 49 - 0
package.json

@@ -0,0 +1,49 @@
+{
+  "name": "shadcn-admin-template",
+  "version": "1.0.0",
+  "description": "Shadcn管理后台全栈启动模板",
+  "private": true,
+  "type": "module",
+  "workspaces": [
+    "packages/*"
+  ],
+  "scripts": {
+    "dev": "concurrently \"npm run dev:client\" \"npm run dev:server\"",
+    "dev:client": "cd packages/client && npm run dev",
+    "dev:server": "cd packages/server && npm run dev",
+    "build": "npm run build:client && npm run build:server",
+    "build:client": "cd packages/client && npm run build",
+    "build:server": "cd packages/server && npm run build",
+    "test": "npm run test:client && npm run test:server",
+    "test:client": "cd packages/client && npm run test",
+    "test:server": "cd packages/server && npm run test",
+    "lint": "npm run lint:client && npm run lint:server",
+    "lint:client": "cd packages/client && npm run lint",
+    "lint:server": "cd packages/server && npm run lint",
+    "typecheck": "npm run typecheck:client && npm run typecheck:server",
+    "typecheck:client": "cd packages/client && npm run typecheck",
+    "typecheck:server": "cd packages/server && npm run typecheck",
+    "prepare": "husky"
+  },
+  "devDependencies": {
+    "concurrently": "^8.2.2",
+    "eslint": "^9.35.0",
+    "husky": "^9.1.7",
+    "lint-staged": "^15.5.2",
+    "prettier": "^3.6.2"
+  },
+  "lint-staged": {
+    "*.{js,jsx,ts,tsx}": [
+      "eslint --fix",
+      "prettier --write"
+    ],
+    "*.{json,md,yml,yaml}": [
+      "prettier --write"
+    ]
+  },
+  "engines": {
+    "node": ">=18.0.0",
+    "npm": ">=8.0.0"
+  },
+  "packageManager": "npm@10.5.0"
+}

+ 17 - 0
prettier.config.js

@@ -0,0 +1,17 @@
+/** @type {import('prettier').Config} */
+const config = {
+  semi: true,
+  singleQuote: true,
+  tabWidth: 2,
+  trailingComma: 'es5',
+  printWidth: 80,
+  useTabs: false,
+  endOfLine: 'lf',
+  bracketSpacing: true,
+  arrowParens: 'avoid',
+  proseWrap: 'preserve',
+  htmlWhitespaceSensitivity: 'css',
+  quoteProps: 'as-needed',
+};
+
+export default config;

+ 1 - 0
test.js

@@ -0,0 +1 @@
+console.log('test');

+ 38 - 0
tsconfig.json

@@ -0,0 +1,38 @@
+{
+  "compilerOptions": {
+    "target": "ES2022",
+    "lib": ["ES2022", "DOM", "DOM.Iterable"],
+    "allowJs": true,
+    "skipLibCheck": true,
+    "strict": true,
+    "forceConsistentCasingInFileNames": true,
+    "noEmit": true,
+    "esModuleInterop": true,
+    "module": "ESNext",
+    "moduleResolution": "bundler",
+    "resolveJsonModule": true,
+    "isolatedModules": true,
+    "incremental": true,
+    "declaration": true,
+    "declarationMap": true,
+    "sourceMap": true,
+    "removeComments": false,
+    "noUnusedLocals": true,
+    "noUnusedParameters": true,
+    "noImplicitReturns": true,
+    "noFallthroughCasesInSwitch": true,
+    "baseUrl": ".",
+    "paths": {
+      "@/*": ["./packages/client/src/*"],
+      "@shared/*": ["./packages/shared/*"]
+    }
+  },
+  "exclude": [
+    "node_modules",
+    "dist",
+    "build",
+    "coverage",
+    "*.config.js",
+    "*.config.ts"
+  ]
+}