create-dwy 0.5.1 → 0.6.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 (156) hide show
  1. package/bin/index.js +6 -15
  2. package/package.json +3 -3
  3. package/src/create.js +61 -37
  4. package/src/sync.js +206 -61
  5. package/templates/claude-global/CLAUDE.md +92 -0
  6. package/templates/claude-global/rules/dwy-android-core.md +610 -0
  7. package/templates/claude-global/rules/dwy-api-design.md +110 -0
  8. package/templates/claude-global/rules/dwy-db-migration.md +46 -0
  9. package/templates/claude-global/rules/dwy-flutter-core.md +564 -0
  10. package/templates/claude-global/rules/dwy-flutter-network.md +222 -0
  11. package/templates/claude-global/rules/dwy-flutter-router.md +97 -0
  12. package/templates/claude-global/rules/dwy-flutter-testing.md +94 -0
  13. package/templates/claude-global/rules/dwy-git-commit-convention.md +82 -0
  14. package/templates/claude-global/rules/dwy-git-security.md +53 -0
  15. package/templates/claude-global/rules/dwy-payload-limits.md +178 -0
  16. package/templates/claude-global/rules/{prefer-open-source.md → dwy-prefer-open-source.md} +4 -0
  17. package/templates/claude-global/rules/dwy-project-structure.md +181 -0
  18. package/templates/claude-global/rules/{python-code-style.md → dwy-python-core.md} +292 -358
  19. package/templates/claude-global/rules/dwy-python-fastapi.md +272 -0
  20. package/templates/claude-global/rules/dwy-python-orm.md +61 -0
  21. package/templates/claude-global/rules/{backend-security.md → dwy-python-security.md} +99 -72
  22. package/templates/claude-global/rules/dwy-python-testing.md +53 -0
  23. package/templates/claude-global/rules/{server-security.md → dwy-server-security.md} +1 -2
  24. package/templates/claude-global/rules/dwy-tdd-development.md +70 -0
  25. package/templates/claude-global/rules/dwy-tech-stack.md +60 -0
  26. package/templates/claude-global/rules/dwy-vue-api.md +146 -0
  27. package/templates/claude-global/rules/{vue-code-style.md → dwy-vue-core.md} +338 -152
  28. package/templates/claude-global/rules/dwy-vue-pinia.md +75 -0
  29. package/templates/claude-global/rules/dwy-vue-testing.md +102 -0
  30. package/templates/claude-global/skills/dwy-deploy-audit/SKILL.md +481 -0
  31. package/templates/claude-global/skills/dwy-deploy-audit/references/checks-data.md +117 -0
  32. package/templates/claude-global/skills/dwy-deploy-audit/references/checks-network.md +74 -0
  33. package/templates/claude-global/skills/dwy-deploy-audit/references/checks-runtime.md +184 -0
  34. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_base.sh +39 -0
  35. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_capacity.sh +278 -0
  36. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_db.sh +122 -0
  37. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_docker.sh +249 -0
  38. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_env.sh +64 -0
  39. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_https.sh +60 -0
  40. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_logs.sh +209 -0
  41. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_nginx.sh +92 -0
  42. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_resilience.sh +157 -0
  43. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_secrets.sh +327 -0
  44. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_services.sh +77 -0
  45. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_ssh.sh +56 -0
  46. package/templates/claude-global/skills/dwy-deploy-audit/scripts/run_all.sh +105 -0
  47. package/templates/claude-global/skills/dwy-docker/SKILL.md +187 -0
  48. package/templates/claude-global/skills/dwy-docker/references/ask-templates.md +142 -0
  49. package/templates/claude-global/skills/dwy-docker/references/templates.md +479 -0
  50. package/templates/claude-global/skills/dwy-docker/references/version-rules.md +76 -0
  51. package/templates/claude-global/skills/dwy-docker/scripts/query_dockerhub.py +204 -0
  52. package/templates/claude-global/skills/dwy-docker/scripts/scan_images.sh +185 -0
  53. package/templates/claude-global/skills/dwy-eapi/SKILL.md +433 -0
  54. package/templates/claude-global/skills/dwy-eapi/references/tasks-integration-guide.md +387 -0
  55. package/templates/claude-global/skills/dwy-ekit/SKILL.md +85 -0
  56. package/templates/claude-global/skills/dwy-ekit/references/data.md +135 -0
  57. package/templates/claude-global/skills/dwy-ekit/references/form.md +68 -0
  58. package/templates/claude-global/skills/dwy-ekit/references/request.md +183 -0
  59. package/templates/claude-global/skills/dwy-ekit/references/ui.md +109 -0
  60. package/templates/claude-global/skills/{dwy-frontend-eui → dwy-eui}/SKILL.md +129 -15
  61. package/templates/claude-global/skills/dwy-eui/references/eui-design-guide.md +257 -0
  62. package/templates/claude-global/skills/dwy-eui/references/eui-integration-guide.md +302 -0
  63. package/templates/claude-global/skills/dwy-eui/references/eui-landing-design-guide.md +437 -0
  64. package/templates/claude-global/skills/dwy-fullstack-scaffold/SKILL.md +214 -0
  65. package/templates/claude-global/skills/dwy-mirror-source/SKILL.md +275 -0
  66. package/templates/claude-global/skills/dwy-mirror-source/references/dockerfile-snippets.md +228 -0
  67. package/templates/claude-global/skills/dwy-mirror-source/references/mirror-providers.md +150 -0
  68. package/templates/claude-global/skills/dwy-mirror-source/scripts/__pycache__/check_mirrors.cpython-313.pyc +0 -0
  69. package/templates/claude-global/skills/dwy-mirror-source/scripts/apply_mirrors.py +666 -0
  70. package/templates/claude-global/skills/dwy-mirror-source/scripts/check_mirrors.py +868 -0
  71. package/templates/claude-global/skills/dwy-pentest/SKILL.md +344 -0
  72. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__init__.py +1 -0
  73. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/__init__.cpython-311.pyc +0 -0
  74. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/config.cpython-311.pyc +0 -0
  75. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/executor.cpython-311.pyc +0 -0
  76. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/severity.cpython-311.pyc +0 -0
  77. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/validator.cpython-311.pyc +0 -0
  78. package/templates/claude-global/skills/dwy-pentest/scripts/lib/config.py +109 -0
  79. package/templates/claude-global/skills/dwy-pentest/scripts/lib/executor.py +157 -0
  80. package/templates/claude-global/skills/dwy-pentest/scripts/lib/severity.py +96 -0
  81. package/templates/claude-global/skills/dwy-pentest/scripts/lib/validator.py +113 -0
  82. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_auth.py +289 -0
  83. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_recon.py +217 -0
  84. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_report.py +343 -0
  85. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_scan.py +205 -0
  86. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_ssl.py +208 -0
  87. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_vuln.py +205 -0
  88. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_web.py +330 -0
  89. package/templates/claude-global/skills/dwy-pentest/scripts/pyproject.toml +14 -0
  90. package/templates/claude-global/skills/dwy-pentest/scripts/setup_tools.sh +97 -0
  91. package/templates/claude-global/skills/dwy-pentest/scripts/uv.lock +415 -0
  92. package/templates/claude-global/skills/{dwy-release → dwy-publish}/SKILL.md +42 -18
  93. package/templates/claude-global/skills/dwy-vue-core/SKILL.md +890 -0
  94. package/templates/project/backend/.dwy.hbs +5 -0
  95. package/templates/project/backend/.python-version +1 -0
  96. package/templates/project/backend/CLAUDE.md.hbs +40 -0
  97. package/templates/project/{web/backend → backend}/alembic/script.py.mako +2 -0
  98. package/templates/project/{web/backend → backend}/alembic.ini.hbs +0 -1
  99. package/templates/project/backend/deploy.sh.hbs +18 -0
  100. package/templates/project/{web → backend}/docker-compose.prod.yml.hbs +1 -1
  101. package/templates/project/{web/backend → backend}/pyproject.toml.hbs +4 -5
  102. package/templates/project/{web/backend → backend}/src/app/config.py.hbs +1 -1
  103. package/templates/project/backend/src/app/database.py +10 -0
  104. package/templates/project/backend/src/app/dependencies.py +5 -0
  105. package/templates/project/{web/backend → backend}/src/app/main.py.hbs +3 -3
  106. package/templates/project/backend/src/app/models/base.py +5 -0
  107. package/templates/project/web/CLAUDE.md.hbs +29 -36
  108. package/templates/project/web/{frontend → apps/web}/index.html.hbs +1 -0
  109. package/templates/project/web/{frontend → apps/web}/package.json.hbs +4 -3
  110. package/templates/project/web/apps/web/src/App.vue +9 -0
  111. package/templates/project/web/apps/web/src/api/client.ts +5 -0
  112. package/templates/project/web/apps/web/src/composables/.gitkeep +0 -0
  113. package/templates/project/web/apps/web/src/layouts/DefaultLayout.vue +8 -0
  114. package/templates/project/web/{frontend → apps/web}/src/router/index.ts +1 -1
  115. package/templates/project/web/{frontend → apps/web}/src/stores/auth.ts +4 -2
  116. package/templates/project/web/apps/web/src/style.css +2 -0
  117. package/templates/project/web/apps/web/src/types/router.d.ts +8 -0
  118. package/templates/project/web/apps/web/src/views/HomeView.vue +8 -0
  119. package/templates/project/web/apps/web/tsconfig.app.json +18 -0
  120. package/templates/project/web/apps/web/tsconfig.json +6 -0
  121. package/templates/project/web/{frontend → apps/web}/vite.config.ts.hbs +7 -1
  122. package/templates/project/web/package.json.hbs +16 -0
  123. package/templates/project/web/packages/.gitkeep +0 -0
  124. package/templates/project/web/pnpm-workspace.yaml +3 -0
  125. package/templates/claude-global/hooks/post-sync-claude-global.sh +0 -72
  126. package/templates/claude-global/rules/agent-team-execution.md +0 -138
  127. package/templates/claude-global/rules/agent-team-patterns.md +0 -157
  128. package/templates/claude-global/rules/git-commit-convention.md +0 -106
  129. package/templates/claude-global/rules/git-security.md +0 -144
  130. package/templates/claude-global/skills/dwy-backend-base/SKILL.md +0 -279
  131. package/templates/claude-global/skills/dwy-frontend-core/SKILL.md +0 -181
  132. package/templates/project/web/.claude/commands/deploy.md +0 -4
  133. package/templates/project/web/backend/src/app/models/base.py +0 -5
  134. package/templates/project/web/deploy.sh.hbs +0 -113
  135. package/templates/project/web/frontend/src/App.vue +0 -3
  136. package/templates/project/web/frontend/src/api/client.ts +0 -13
  137. package/templates/project/web/frontend/src/style.css +0 -1
  138. package/templates/project/web/frontend/src/views/HomeView.vue +0 -5
  139. package/templates/project/web/frontend/tsconfig.app.json +0 -14
  140. package/templates/project/web/frontend/tsconfig.json +0 -4
  141. /package/templates/{project/web/backend → claude-global/skills/dwy-pentest/scripts}/.python-version +0 -0
  142. /package/templates/project/{web/backend → backend}/Dockerfile +0 -0
  143. /package/templates/project/{web/backend → backend}/alembic/env.py.hbs +0 -0
  144. /package/templates/{claude-global/skills → project/backend/alembic/versions}/.gitkeep +0 -0
  145. /package/templates/project/{web → backend}/docker-compose.dev.yml.hbs +0 -0
  146. /package/templates/project/{web/backend → backend}/src/app/__init__.py +0 -0
  147. /package/templates/project/{web/backend → backend}/src/app/models/__init__.py +0 -0
  148. /package/templates/project/{web/backend → backend}/src/app/routers/__init__.py +0 -0
  149. /package/templates/project/{web/backend → backend}/src/app/routers/health.py +0 -0
  150. /package/templates/project/{web/backend → backend}/src/app/schemas/__init__.py +0 -0
  151. /package/templates/project/{web/backend → backend}/src/app/services/__init__.py +0 -0
  152. /package/templates/project/{web/backend → backend}/tests/__init__.py +0 -0
  153. /package/templates/project/{web/backend → backend}/tests/conftest.py.hbs +0 -0
  154. /package/templates/project/{web/backend/alembic/versions → mobile}/.gitkeep +0 -0
  155. /package/templates/project/web/{frontend → apps/web}/src/components/.gitkeep +0 -0
  156. /package/templates/project/web/{frontend → apps/web}/src/main.ts +0 -0
@@ -1,181 +0,0 @@
1
- ---
2
- name: dwy-frontend-core
3
- description: "@danweiyuan/core 前端工具库速查。触发条件:需要 HTTP 请求封装、localStorage、表单校验、日期格式化、Vue composable 工具时。"
4
- ---
5
-
6
- # @danweiyuan/core 工具库速查
7
-
8
- Vue 3 项目通用工具库,包含 5 个模块:request、storage、validators、date、hooks。
9
-
10
- ## 安装
11
-
12
- ```bash
13
- pnpm add @danweiyuan/core
14
- # peerDependencies: axios ^1.0.0, vue ^3.4.0
15
- ```
16
-
17
- ```ts
18
- import { createRequest, useStorage, isPhone, formatDate, useDebounce } from '@danweiyuan/core'
19
- ```
20
-
21
- ## 查阅源码
22
-
23
- 每个模块源码在 `frontend/core/src/{module}/index.ts`,函数简短可直接阅读。
24
-
25
- ---
26
-
27
- ## request — Axios 插件化封装
28
-
29
- ```ts
30
- import { createRequest, tokenPlugin, headerPlugin, unwrapPlugin, refreshTokenPlugin } from '@danweiyuan/core'
31
- ```
32
-
33
- ### createRequest(options?)
34
-
35
- 创建带插件系统的 Axios 实例。插件按顺序执行请求/响应拦截。
36
-
37
- ```ts
38
- const http = createRequest({
39
- baseURL: '/api', // 默认 '/api'
40
- timeout: 30000, // 默认 30000
41
- plugins: [
42
- tokenPlugin({ getToken: () => localStorage.getItem('token') }),
43
- unwrapPlugin(),
44
- ],
45
- })
46
- ```
47
-
48
- ### 内置插件
49
-
50
- | 插件 | 用途 | 参数 |
51
- |------|------|------|
52
- | tokenPlugin | 自动注入 Bearer token | `{ getToken: () => string \| null }` |
53
- | headerPlugin | 注入自定义请求头 | `{ name: string, getValue: () => string \| null }` |
54
- | unwrapPlugin | 解包 `{ code, data, message }` 响应,code !== 200 时 reject | 无参数 |
55
- | refreshTokenPlugin | 401 自动刷新 token 并重试 | `{ getRefreshToken, refreshFn, onRefreshFail, isLoginUrl? }` |
56
-
57
- ### RequestPlugin 接口
58
-
59
- ```ts
60
- interface RequestPlugin {
61
- onRequest?: (config: InternalAxiosRequestConfig) => config | Promise<config>
62
- onResponse?: (response: AxiosResponse) => response | Promise<response>
63
- onResponseError?: (error: AxiosError) => any
64
- }
65
- ```
66
-
67
- ### refreshTokenPlugin 详解
68
-
69
- ```ts
70
- refreshTokenPlugin({
71
- getRefreshToken: () => localStorage.getItem('refreshToken'),
72
- refreshFn: async (refreshToken) => {
73
- // 调用刷新接口,返回新 access token
74
- const { data } = await http.post('/auth/refresh', { refreshToken })
75
- localStorage.setItem('token', data.token)
76
- return data.token
77
- },
78
- onRefreshFail: () => {
79
- // 刷新失败,跳转登录
80
- localStorage.clear()
81
- window.location.href = '/login'
82
- },
83
- isLoginUrl: (url) => url.includes('/auth/login'), // 可选,默认检测 /auth/login
84
- })
85
- ```
86
-
87
- ---
88
-
89
- ## storage — localStorage 封装
90
-
91
- ```ts
92
- import { useStorage, storage } from '@danweiyuan/core'
93
- ```
94
-
95
- ### useStorage(key, defaultValue) — 响应式
96
-
97
- 返回 Vue `Ref<T>`,自动 JSON 序列化,深度 watch 自动同步。设为 null/undefined 时自动 removeItem。
98
-
99
- ```ts
100
- const token = useStorage<string>('token', '')
101
- const config = useStorage<{ theme: string }>('config', { theme: 'light' })
102
- ```
103
-
104
- ### storage — 静态工具对象
105
-
106
- | 方法 | 签名 | 说明 |
107
- |------|------|------|
108
- | get | `get<T>(key, defaultValue?): T \| undefined` | JSON 解析失败时返回原始字符串 |
109
- | set | `set(key, value): void` | JSON.stringify 后存储 |
110
- | remove | `remove(key): void` | 删除指定 key |
111
- | clear | `clear(): void` | 清空全部 |
112
-
113
- ---
114
-
115
- ## validators — 校验函数
116
-
117
- ```ts
118
- import { isPhone, isEmail, isIdCard, isUrl, isRequired, minLength, maxLength } from '@danweiyuan/core'
119
- ```
120
-
121
- | 函数 | 签名 | 规则 |
122
- |------|------|------|
123
- | isPhone | `(value: string) => boolean` | 中国手机号 1[3-9]开头 11 位 |
124
- | isEmail | `(value: string) => boolean` | 基础邮箱格式 |
125
- | isIdCard | `(value: string) => boolean` | 18 位身份证(末位可为 X/x) |
126
- | isUrl | `(value: string) => boolean` | 使用 `new URL()` 校验 |
127
- | isRequired | `(value: any) => boolean` | 非 null/undefined/空字符串/空数组。0 和 false 视为有效 |
128
- | minLength | `(value: string, min: number) => boolean` | 最小长度 |
129
- | maxLength | `(value: string, max: number) => boolean` | 最大长度 |
130
-
131
- ---
132
-
133
- ## date — 日期格式化
134
-
135
- ```ts
136
- import { formatDate, formatDateTime, formatTime, formatRelativeTime } from '@danweiyuan/core'
137
- ```
138
-
139
- 所有函数接收 `string | number | Date` 类型输入。
140
-
141
- | 函数 | 输出格式 | 示例 |
142
- |------|---------|------|
143
- | formatDate | `YYYY-MM-DD` | `2025-03-15` |
144
- | formatDateTime | `YYYY-MM-DD HH:mm:ss` | `2025-03-15 14:30:00` |
145
- | formatTime | `HH:mm` | `14:30` |
146
- | formatRelativeTime | 中文相对时间 | `刚刚` / `5 分钟前` / `3 小时前` / `7 天前` / 超过 30 天返回 `toLocaleDateString('zh-CN')` |
147
-
148
- ---
149
-
150
- ## hooks — Vue Composables
151
-
152
- ```ts
153
- import { useDebounce, useClickOutside, useEventListener } from '@danweiyuan/core'
154
- ```
155
-
156
- ### useDebounce(value, delay?)
157
-
158
- ```ts
159
- const search = ref('')
160
- const debouncedSearch = useDebounce(search, 300) // 默认 300ms
161
- ```
162
-
163
- 返回防抖后的 `Ref<T>`,仅在源值停止变化 delay 毫秒后更新。
164
-
165
- ### useClickOutside(target, handler)
166
-
167
- ```ts
168
- const popoverRef = ref<HTMLElement | null>(null)
169
- useClickOutside(popoverRef, () => { isOpen.value = false })
170
- ```
171
-
172
- 点击 target 元素外部时触发 handler。自动在 onMounted/onBeforeUnmount 绑定/解绑。
173
-
174
- ### useEventListener(target, event, handler, options?)
175
-
176
- ```ts
177
- useEventListener(window, 'resize', onResize)
178
- useEventListener(elementRef, 'scroll', onScroll, { passive: true })
179
- ```
180
-
181
- target 可以是 `EventTarget` 或 `Ref<EventTarget>`。自动在 onMounted/onBeforeUnmount 绑定/解绑。
@@ -1,4 +0,0 @@
1
- ---
2
- description: Deploy the project
3
- ---
4
- Run `./deploy.sh` with the appropriate flag based on user intent.
@@ -1,5 +0,0 @@
1
- """ORM model base — re-exports from danweiyuan_base."""
2
-
3
- from danweiyuan_base.database import Base, TimestampMixin
4
-
5
- __all__ = ["Base", "TimestampMixin"]
@@ -1,113 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
-
4
- PROJECT_NAME="{{projectName}}"
5
- SSH_ALIAS="{{sshAlias}}"
6
- REMOTE_DIR="/opt/{{projectName}}"
7
- BACKEND_PORT={{backendPort}}
8
- HEALTH_CHECK_PATH="/api/health"
9
-
10
- RED='\033[0;31m'
11
- GREEN='\033[0;32m'
12
- YELLOW='\033[1;33m'
13
- NC='\033[0m'
14
-
15
- log() { echo -e "${GREEN}[DEPLOY]${NC} $1"; }
16
- warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
17
- err() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; }
18
-
19
- push_code() {
20
- log "推送代码到 Gitee..."
21
- git push origin master || err "git push 失败"
22
- }
23
-
24
- pull_remote() {
25
- log "远程拉取代码..."
26
- ssh $SSH_ALIAS "cd $REMOTE_DIR && git pull origin master" || err "远程 git pull 失败"
27
- }
28
-
29
- build_frontend() {
30
- log "构建前端..."
31
- cd frontend && pnpm build || err "前端构建失败"
32
- cd ..
33
- }
34
-
35
- upload_frontend() {
36
- log "上传前端构建产物..."
37
- tar czf /tmp/frontend-dist.tar.gz -C frontend dist/
38
- scp /tmp/frontend-dist.tar.gz $SSH_ALIAS:$REMOTE_DIR/ || err "上传失败"
39
- ssh $SSH_ALIAS "cd $REMOTE_DIR && mkdir -p frontend && tar xzf frontend-dist.tar.gz -C frontend/ && rm frontend-dist.tar.gz"
40
- rm /tmp/frontend-dist.tar.gz
41
- }
42
-
43
- run_migrations() {
44
- log "执行数据库迁移..."
45
- ssh $SSH_ALIAS "cd $REMOTE_DIR && docker compose -f docker-compose.prod.yml run --rm backend alembic upgrade head" || err "迁移失败"
46
- }
47
-
48
- restart_backend() {
49
- log "重建后端容器..."
50
- ssh $SSH_ALIAS "cd $REMOTE_DIR && docker compose -f docker-compose.prod.yml up -d --build backend"
51
- }
52
-
53
- verify() {
54
- log "验证部署..."
55
- sleep 3
56
-
57
- HEALTH=$(ssh $SSH_ALIAS "curl -s http://localhost${HEALTH_CHECK_PATH}" 2>/dev/null)
58
- if echo "$HEALTH" | grep -q '"ok"'; then
59
- log "API 健康检查: ✅"
60
- else
61
- err "API 健康检查失败: $HEALTH"
62
- fi
63
-
64
- GIT_CODE=$(ssh $SSH_ALIAS "curl -s -o /dev/null -w '%{http_code}' http://localhost/.git/config" 2>/dev/null)
65
- ENV_CODE=$(ssh $SSH_ALIAS "curl -s -o /dev/null -w '%{http_code}' http://localhost/.env" 2>/dev/null)
66
- if [ "$GIT_CODE" = "404" ] && [ "$ENV_CODE" = "404" ]; then
67
- log "安全检查: ✅ (.git/.env 已屏蔽)"
68
- else
69
- warn "安全检查: .git=$GIT_CODE .env=$ENV_CODE"
70
- fi
71
-
72
- log "部署完成!"
73
- }
74
-
75
- case "${1:-all}" in
76
- --backend)
77
- log "=== 仅部署后端 ==="
78
- push_code
79
- pull_remote
80
- run_migrations
81
- restart_backend
82
- verify
83
- ;;
84
- --frontend)
85
- log "=== 仅部署前端 ==="
86
- build_frontend
87
- upload_frontend
88
- verify
89
- ;;
90
- --restart)
91
- log "=== 仅重启容器 ==="
92
- ssh $SSH_ALIAS "cd $REMOTE_DIR && docker compose -f docker-compose.prod.yml up -d --force-recreate"
93
- verify
94
- ;;
95
- --check)
96
- log "=== 安全检查 ==="
97
- verify
98
- ;;
99
- all|"")
100
- log "=== 全量部署 ==="
101
- push_code
102
- pull_remote
103
- build_frontend
104
- upload_frontend
105
- run_migrations
106
- restart_backend
107
- verify
108
- ;;
109
- *)
110
- echo "用法: ./deploy.sh [--backend|--frontend|--restart|--check]"
111
- exit 1
112
- ;;
113
- esac
@@ -1,3 +0,0 @@
1
- <template>
2
- <router-view />
3
- </template>
@@ -1,13 +0,0 @@
1
- import axios from 'axios'
2
-
3
- const client = axios.create({ baseURL: '/api' })
4
-
5
- client.interceptors.request.use((config) => {
6
- const token = localStorage.getItem('token')
7
- if (token) {
8
- config.headers.Authorization = `Bearer ${token}`
9
- }
10
- return config
11
- })
12
-
13
- export default client
@@ -1 +0,0 @@
1
- @import "tailwindcss";
@@ -1,5 +0,0 @@
1
- <template>
2
- <div class="min-h-screen flex items-center justify-center">
3
- <h1 class="text-3xl font-bold">Welcome</h1>
4
- </div>
5
- </template>
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
- "strict": true,
8
- "jsx": "preserve",
9
- "noEmit": true,
10
- "paths": { "@/*": ["./src/*"] },
11
- "baseUrl": "."
12
- },
13
- "include": ["src/**/*.ts", "src/**/*.vue"]
14
- }
@@ -1,4 +0,0 @@
1
- {
2
- "files": [],
3
- "references": [{ "path": "./tsconfig.app.json" }]
4
- }