create-bubbles 0.1.20 → 0.1.22

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 (223) hide show
  1. package/dist/{index.js → index.mjs} +9 -7
  2. package/package.json +5 -4
  3. package/template-nextjs-vinext-eslint/vite.config.ts +1 -1
  4. package/template-vp-monorepo-react-nestjs/.spaces/server//347/231/273/345/275/225/JWT/344/270/216RefreshToken/350/275/256/346/215/242/351/211/264/346/235/203/346/236/266/346/236/204/345/256/236/347/216/260/346/214/207/345/215/227.md +6614 -0
  5. package/template-vp-monorepo-react-nestjs/.vite-hooks/commit-msg +1 -0
  6. package/template-vp-monorepo-react-nestjs/.vite-hooks/pre-commit +2 -1
  7. package/template-vp-monorepo-react-nestjs/.vscode/settings.json +25 -0
  8. package/template-vp-monorepo-react-nestjs/AGENTS.md +16 -0
  9. package/template-vp-monorepo-react-nestjs/README.md +2 -2
  10. package/template-vp-monorepo-react-nestjs/apps/server/.env.development +61 -0
  11. package/template-vp-monorepo-react-nestjs/apps/server/.env.production +20 -0
  12. package/template-vp-monorepo-react-nestjs/apps/server/README.md +3 -0
  13. package/template-vp-monorepo-react-nestjs/apps/server/drizzle.config.ts +15 -0
  14. package/template-vp-monorepo-react-nestjs/apps/server/nest-cli.json +8 -0
  15. package/template-vp-monorepo-react-nestjs/apps/server/package.json +57 -0
  16. package/template-vp-monorepo-react-nestjs/apps/server/src/app.controller.ts +12 -0
  17. package/template-vp-monorepo-react-nestjs/apps/server/src/app.module.ts +58 -0
  18. package/template-vp-monorepo-react-nestjs/apps/server/src/app.service.ts +8 -0
  19. package/template-vp-monorepo-react-nestjs/apps/server/src/common/constants/decorator.ts +2 -0
  20. package/template-vp-monorepo-react-nestjs/apps/server/src/common/constants/response.ts +15 -0
  21. package/template-vp-monorepo-react-nestjs/apps/server/src/common/decorators/bypass.ts +12 -0
  22. package/template-vp-monorepo-react-nestjs/apps/server/src/common/interceptors/transform.ts +34 -0
  23. package/template-vp-monorepo-react-nestjs/apps/server/src/common/model/response.ts +23 -0
  24. package/template-vp-monorepo-react-nestjs/apps/server/src/config/app.config.ts +6 -0
  25. package/template-vp-monorepo-react-nestjs/apps/server/src/config/auth.config.ts +64 -0
  26. package/template-vp-monorepo-react-nestjs/apps/server/src/config/database.config.ts +10 -0
  27. package/template-vp-monorepo-react-nestjs/apps/server/src/config/index.ts +5 -0
  28. package/template-vp-monorepo-react-nestjs/apps/server/src/config/llm.config.ts +7 -0
  29. package/template-vp-monorepo-react-nestjs/apps/server/src/config/redis.config.ts +18 -0
  30. package/template-vp-monorepo-react-nestjs/apps/server/src/database/db.module.ts +32 -0
  31. package/template-vp-monorepo-react-nestjs/apps/server/src/database/schema.ts +14 -0
  32. package/template-vp-monorepo-react-nestjs/apps/server/src/main.ts +34 -0
  33. package/template-vp-monorepo-react-nestjs/apps/server/src/modules/test/db/db.controller.ts +28 -0
  34. package/template-vp-monorepo-react-nestjs/apps/server/src/modules/test/db/db.module.ts +9 -0
  35. package/template-vp-monorepo-react-nestjs/apps/server/src/modules/test/db/db.service.ts +22 -0
  36. package/template-vp-monorepo-react-nestjs/apps/server/src/modules/test/db/dto/create-user.dto.ts +27 -0
  37. package/template-vp-monorepo-react-nestjs/apps/server/src/modules/test/redis/dto/redis-quary.dto.ts +18 -0
  38. package/template-vp-monorepo-react-nestjs/apps/server/src/modules/test/redis/redis.controller.ts +31 -0
  39. package/template-vp-monorepo-react-nestjs/apps/server/src/modules/test/redis/redis.module.ts +9 -0
  40. package/template-vp-monorepo-react-nestjs/apps/server/src/modules/test/redis/redis.service.ts +37 -0
  41. package/template-vp-monorepo-react-nestjs/apps/server/src/utils/server-address.ts +33 -0
  42. package/template-vp-monorepo-react-nestjs/apps/server/tsconfig.build.json +4 -0
  43. package/template-vp-monorepo-react-nestjs/apps/server/tsconfig.json +28 -0
  44. package/template-vp-monorepo-react-nestjs/apps/web/.env +1 -0
  45. package/template-vp-monorepo-react-nestjs/apps/web/.env.dev +1 -0
  46. package/template-vp-monorepo-react-nestjs/apps/web/.env.prod +1 -0
  47. package/template-vp-monorepo-react-nestjs/apps/web/package.json +21 -25
  48. package/template-vp-monorepo-react-nestjs/apps/web/src/App.tsx +5 -4
  49. package/template-vp-monorepo-react-nestjs/apps/web/src/locales/en_US.json +4 -0
  50. package/template-vp-monorepo-react-nestjs/apps/web/src/locales/zh_CN.json +4 -0
  51. package/template-vp-monorepo-react-nestjs/apps/web/src/main.tsx +4 -4
  52. package/template-vp-monorepo-react-nestjs/apps/web/src/pages/home/index.tsx +38 -8
  53. package/template-vp-monorepo-react-nestjs/apps/web/src/router/index.tsx +15 -15
  54. package/template-vp-monorepo-react-nestjs/apps/web/src/utils/env/index.ts +6 -0
  55. package/template-vp-monorepo-react-nestjs/apps/web/src/utils/request/core/index.ts +420 -0
  56. package/template-vp-monorepo-react-nestjs/apps/web/src/utils/request/core/utils.ts +39 -0
  57. package/template-vp-monorepo-react-nestjs/apps/web/src/utils/request/index.ts +61 -0
  58. package/template-vp-monorepo-react-nestjs/apps/web/tsconfig.json +10 -14
  59. package/template-vp-monorepo-react-nestjs/apps/web/vite.config.ts +15 -2
  60. package/template-vp-monorepo-react-nestjs/apps/web-vue/.env.production +2 -0
  61. package/template-vp-monorepo-react-nestjs/apps/web-vue/.vscode/extensions.json +3 -0
  62. package/template-vp-monorepo-react-nestjs/apps/web-vue/AGENTS.md +16 -0
  63. package/template-vp-monorepo-react-nestjs/apps/web-vue/README.md +98 -0
  64. package/template-vp-monorepo-react-nestjs/apps/web-vue/commitlint.config.js +1 -0
  65. package/template-vp-monorepo-react-nestjs/apps/web-vue/eslint.config.js +13 -0
  66. package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/lefthook.yml +1 -1
  67. package/template-vp-monorepo-react-nestjs/apps/web-vue/package.json +67 -0
  68. package/template-vp-monorepo-react-nestjs/apps/web-vue/pnpm-workspace.yaml +16 -0
  69. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/App.vue +12 -0
  70. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/api/index.ts +12 -0
  71. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/assets/image/.gitkeep +0 -0
  72. package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/components/Icon/svg-icon.vue +3 -3
  73. package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/hooks/chart/lib.ts +6 -6
  74. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/hooks/chart/useEcharts.ts +65 -0
  75. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/i18n/instance.ts +8 -0
  76. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/layout/default/header/index.vue +30 -0
  77. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/layout/default/index.vue +138 -0
  78. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/locales/en_US.json +4 -0
  79. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/locales/zh_CN.json +4 -0
  80. package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/main.ts +0 -3
  81. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/router/guard/index.ts +7 -0
  82. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/router/guard/permissionGuard.ts +13 -0
  83. package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/router/index.ts +7 -7
  84. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/router/interface.ts +9 -0
  85. package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/router/modules/index.ts +1 -4
  86. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/store/index.ts +11 -0
  87. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/store/modules/user.ts +17 -0
  88. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/styles/font.scss +0 -0
  89. package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/styles/index.scss +3 -3
  90. package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/types/components.d.ts +8 -0
  91. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/types/vite-env.d.ts +15 -0
  92. package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/utils/env.ts +1 -1
  93. package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/utils/request/index.ts +5 -3
  94. package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/views/example/echart/config.ts +687 -687
  95. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/views/example/echart/index.vue +20 -0
  96. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/views/example/tree-chart.vue +16 -0
  97. package/template-vp-monorepo-react-nestjs/apps/web-vue/src/views/home/index.vue +27 -0
  98. package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/tsconfig.json +2 -9
  99. package/template-vp-monorepo-react-nestjs/apps/web-vue/uno.config.ts +17 -0
  100. package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/vite.config.ts +4 -6
  101. package/template-vp-monorepo-react-nestjs/commitlint.config.js +0 -0
  102. package/template-vp-monorepo-react-nestjs/docker-compose.yml +41 -0
  103. package/template-vp-monorepo-react-nestjs/mise.toml +3 -0
  104. package/template-vp-monorepo-react-nestjs/package.json +16 -11
  105. package/template-vp-monorepo-react-nestjs/packages/i18n/core/package.json +20 -0
  106. package/template-vp-monorepo-react-nestjs/packages/i18n/core/src/format.ts +9 -0
  107. package/template-vp-monorepo-react-nestjs/packages/i18n/core/src/i18n.ts +73 -0
  108. package/template-vp-monorepo-react-nestjs/packages/i18n/core/src/index.ts +24 -0
  109. package/template-vp-monorepo-react-nestjs/packages/i18n/core/src/storage.ts +47 -0
  110. package/template-vp-monorepo-react-nestjs/packages/i18n/core/src/store.ts +48 -0
  111. package/template-vp-monorepo-react-nestjs/packages/i18n/core/src/types.ts +36 -0
  112. package/template-vp-monorepo-react-nestjs/packages/i18n/core/tsconfig.json +15 -0
  113. package/template-vp-monorepo-react-nestjs/packages/i18n/core/vite.config.ts +13 -0
  114. package/template-vp-monorepo-react-nestjs/packages/i18n/react/package.json +28 -0
  115. package/template-vp-monorepo-react-nestjs/packages/i18n/react/src/index.tsx +26 -0
  116. package/template-vp-monorepo-react-nestjs/packages/i18n/react/src/use-store.ts +14 -0
  117. package/template-vp-monorepo-react-nestjs/packages/i18n/react/tsconfig.json +16 -0
  118. package/template-vp-monorepo-react-nestjs/packages/i18n/react/vite.config.ts +16 -0
  119. package/template-vp-monorepo-react-nestjs/packages/i18n/vue/package.json +27 -0
  120. package/template-vp-monorepo-react-nestjs/packages/i18n/vue/src/index.ts +52 -0
  121. package/template-vp-monorepo-react-nestjs/packages/i18n/vue/src/use-store.ts +19 -0
  122. package/template-vp-monorepo-react-nestjs/packages/i18n/vue/tsconfig.json +15 -0
  123. package/template-vp-monorepo-react-nestjs/packages/i18n/vue/vite.config.ts +16 -0
  124. package/template-vp-monorepo-react-nestjs/pnpm-workspace.yaml +97 -9
  125. package/template-vp-monorepo-react-nestjs/vite.config.ts +15 -4
  126. package/template-vue-vp-eslint/.env +6 -0
  127. package/template-vue-vp-eslint/.env.development +2 -0
  128. package/template-vue-vp-eslint/.env.production +2 -0
  129. package/template-vue-vp-eslint/.vscode/extensions.json +3 -0
  130. package/template-vue-vp-eslint/AGENTS.md +16 -0
  131. package/template-vue-vp-eslint/README.md +98 -0
  132. package/template-vue-vp-eslint/commitlint.config.js +1 -0
  133. package/template-vue-vp-eslint/eslint.config.js +13 -0
  134. package/template-vue-vp-eslint/index.html +13 -0
  135. package/template-vue-vp-eslint/lefthook.yml +11 -0
  136. package/template-vue-vp-eslint/package.json +63 -0
  137. package/template-vue-vp-eslint/pnpm-workspace.yaml +3 -0
  138. package/template-vue-vp-eslint/public/vite.svg +1 -0
  139. package/template-vue-vp-eslint/src/App.vue +7 -0
  140. package/template-vue-vp-eslint/src/api/index.ts +12 -0
  141. package/template-vue-vp-eslint/src/assets/icon/home.svg +3 -0
  142. package/template-vue-vp-eslint/src/assets/icon/logo.svg +1 -0
  143. package/template-vue-vp-eslint/src/assets/image/.gitkeep +0 -0
  144. package/template-vue-vp-eslint/src/components/Icon/svg-icon.vue +29 -0
  145. package/template-vue-vp-eslint/src/hooks/chart/lib.ts +57 -0
  146. package/template-vue-vp-eslint/src/hooks/chart/useEcharts.ts +65 -0
  147. package/template-vue-vp-eslint/src/layout/default/header/index.vue +30 -0
  148. package/template-vue-vp-eslint/src/layout/default/index.vue +138 -0
  149. package/template-vue-vp-eslint/src/main.ts +16 -0
  150. package/template-vue-vp-eslint/src/router/guard/index.ts +7 -0
  151. package/{template-vue-vite-eslint → template-vue-vp-eslint}/src/router/guard/permissionGuard.ts +3 -3
  152. package/template-vue-vp-eslint/src/router/index.ts +18 -0
  153. package/template-vue-vp-eslint/src/router/interface.ts +9 -0
  154. package/template-vue-vp-eslint/src/router/modules/index.ts +33 -0
  155. package/template-vue-vp-eslint/src/store/index.ts +11 -0
  156. package/template-vue-vp-eslint/src/store/modules/user.ts +17 -0
  157. package/template-vue-vp-eslint/src/styles/font.scss +0 -0
  158. package/template-vue-vp-eslint/src/styles/index.scss +29 -0
  159. package/template-vue-vp-eslint/src/styles/variables.scss +3 -0
  160. package/template-vue-vp-eslint/src/types/vite-env.d.ts +15 -0
  161. package/template-vue-vp-eslint/src/utils/env.ts +11 -0
  162. package/template-vue-vp-eslint/src/utils/request/core/index.ts +425 -0
  163. package/template-vue-vp-eslint/src/utils/request/core/utils.ts +39 -0
  164. package/template-vue-vp-eslint/src/utils/request/index.ts +44 -0
  165. package/template-vue-vp-eslint/src/views/example/echart/config.ts +1794 -0
  166. package/template-vue-vp-eslint/src/views/example/echart/index.vue +20 -0
  167. package/template-vue-vp-eslint/src/views/example/tree-chart.vue +16 -0
  168. package/template-vue-vp-eslint/src/views/home/index.vue +16 -0
  169. package/template-vue-vp-eslint/src/views/login/index.vue +9 -0
  170. package/template-vue-vp-eslint/tsconfig.json +29 -0
  171. package/template-vue-vp-eslint/uno.config.ts +17 -0
  172. package/template-vue-vp-eslint/vite.config.ts +58 -0
  173. package/template-vp-monorepo-react-nestjs/.oxfmtrc.jsonc +0 -8
  174. package/template-vp-monorepo-react-nestjs/.oxlintrc.jsonc +0 -3
  175. package/template-vp-monorepo-react-nestjs/.specs//351/234/200/346/261/202.md +0 -5
  176. package/template-vp-monorepo-react-nestjs/apps/service/.oxlintrc.jsonc +0 -3
  177. package/template-vp-monorepo-react-nestjs/apps/web/.oxlintrc.jsonc +0 -4
  178. package/template-vp-monorepo-react-nestjs/packages/utils/README.md +0 -23
  179. package/template-vp-monorepo-react-nestjs/packages/utils/package.json +0 -39
  180. package/template-vp-monorepo-react-nestjs/packages/utils/src/index.ts +0 -3
  181. package/template-vp-monorepo-react-nestjs/packages/utils/tests/index.test.ts +0 -6
  182. package/template-vp-monorepo-react-nestjs/packages/utils/tsconfig.json +0 -20
  183. package/template-vp-monorepo-react-nestjs/packages/utils/tsdown.config.ts +0 -9
  184. package/template-vp-monorepo-react-nestjs/packages/utils/vite.config.ts +0 -7
  185. package/template-vue-vite-eslint/.env.production +0 -1
  186. package/template-vue-vite-eslint/README.md +0 -3
  187. package/template-vue-vite-eslint/commitlint.config.js +0 -1
  188. package/template-vue-vite-eslint/eslint.config.js +0 -69
  189. package/template-vue-vite-eslint/package.json +0 -56
  190. package/template-vue-vite-eslint/src/App.vue +0 -19
  191. package/template-vue-vite-eslint/src/api/index.ts +0 -12
  192. package/template-vue-vite-eslint/src/hooks/chart/useEcharts.ts +0 -65
  193. package/template-vue-vite-eslint/src/layout/default/header/index.vue +0 -12
  194. package/template-vue-vite-eslint/src/layout/default/index.vue +0 -55
  195. package/template-vue-vite-eslint/src/router/guard/index.ts +0 -7
  196. package/template-vue-vite-eslint/src/router/interface.ts +0 -9
  197. package/template-vue-vite-eslint/src/router/modules/example.ts +0 -21
  198. package/template-vue-vite-eslint/src/store/index.ts +0 -11
  199. package/template-vue-vite-eslint/src/store/modules/user.ts +0 -20
  200. package/template-vue-vite-eslint/src/types/vite-env.d.ts +0 -15
  201. package/template-vue-vite-eslint/src/views/example/echart/index.vue +0 -22
  202. package/template-vue-vite-eslint/src/views/example/h-full.vue +0 -24
  203. package/template-vue-vite-eslint/src/views/example/tree-chart.vue +0 -94
  204. package/template-vue-vite-eslint/src/views/home/index.vue +0 -25
  205. package/template-vue-vite-eslint/uno.config.ts +0 -21
  206. /package/{template-vue-vite-eslint/src/assets/image/.gitkeep → template-vp-monorepo-react-nestjs/.agents/auth.config.ts} +0 -0
  207. /package/{template-vue-vite-eslint/src/styles/font.scss → template-vp-monorepo-react-nestjs/apps/server/src/config/security.config.ts} +0 -0
  208. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/.env +0 -0
  209. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/.env.development +0 -0
  210. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/index.html +0 -0
  211. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/public/vite.svg +0 -0
  212. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/assets/icon/computer-data.svg +0 -0
  213. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/assets/icon/cpu.svg +0 -0
  214. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/assets/icon/data-search.svg +0 -0
  215. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/assets/icon/home.svg +0 -0
  216. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/assets/icon/knowledge-graph.svg +0 -0
  217. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/assets/icon/logo.svg +0 -0
  218. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/assets/icon/robot.svg +0 -0
  219. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/styles/variables.scss +0 -0
  220. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/types/auto-import.d.ts +0 -0
  221. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/utils/request/core/index.ts +0 -0
  222. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/utils/request/core/utils.ts +0 -0
  223. /package/{template-vue-vite-eslint → template-vp-monorepo-react-nestjs/apps/web-vue}/src/views/login/index.vue +0 -0
@@ -0,0 +1,98 @@
1
+ # template-vp-vue-eslint
2
+
3
+ Vue 3 项目模板,基于 Vite+ 统一工具链,集成 Antdv Next UI 组件库、UnoCSS 原子化样式、ESLint 代码规范。
4
+
5
+ ## 技术栈
6
+
7
+ | 分类 | 技术 | 说明 |
8
+ |------|------|------|
9
+ | 构建工具 | Vite+ (`vp`) | 统一工具链,封装 Vite + Rolldown + Oxlint |
10
+ | 框架 | Vue 3 | Composition API + `<script setup>` |
11
+ | 语言 | TypeScript 6/7 并存 | TS7 编译 + TS6 支持 typescript-eslint/vue-tsc |
12
+ | UI 组件库 | Antdv Next | 自动按需导入 |
13
+ | 状态管理 | Pinia | 含持久化插件 |
14
+ | 路由 | Vue Router 5 | |
15
+ | 请求库 | Alova | 基于 Axios 适配器,双调用实例 |
16
+ | 样式方案 | UnoCSS | Wind4 + Attributify 预设 |
17
+ | 代码规范 | ESLint (@antfu/eslint-config) + OxLint | |
18
+ | Git 钩子 | Lefthook + Commitlint | |
19
+
20
+ ## 快速开始
21
+
22
+ ```bash
23
+ # 安装依赖
24
+ pnpm install
25
+
26
+ # 启动开发服务器
27
+ pnpm dev
28
+
29
+ # 构建生产包
30
+ pnpm build
31
+
32
+ # 代码检查
33
+ pnpm lint
34
+
35
+ # 代码修复
36
+ pnpm lint:fix
37
+ ```
38
+
39
+ ## 目录结构
40
+
41
+ ```
42
+ src/
43
+ ├── api/ # API 接口定义
44
+ ├── assets/ # 静态资源
45
+ │ ├── icon/ # SVG 图标
46
+ │ └── image/ # 图片资源
47
+ ├── components/ # 公共组件
48
+ │ └── Icon/ # SVG 图标组件
49
+ ├── hooks/ # 组合式函数
50
+ ├── layout/ # 布局组件
51
+ │ └── default/ # 默认布局(侧边栏 + 顶部栏)
52
+ ├── router/ # 路由配置
53
+ │ ├── guard/ # 路由守卫
54
+ │ └── modules/ # 路由模块
55
+ ├── store/ # Pinia 状态管理
56
+ │ └── modules/ # 业务 Store
57
+ ├── styles/ # 全局样式
58
+ ├── types/ # 类型声明(自动生成)
59
+ ├── utils/ # 工具函数
60
+ │ └── request/ # Alova 请求封装
61
+ ├── views/ # 页面视图
62
+ ├── App.vue # 根组件
63
+ └── main.ts # 应用入口
64
+ ```
65
+
66
+ ## 环境变量
67
+
68
+ | 文件 | 用途 |
69
+ |------|------|
70
+ | `.env` | 公共环境变量 |
71
+ | `.env.development` | 开发环境 |
72
+ | `.env.production` | 生产环境 |
73
+
74
+ 关键变量:
75
+
76
+ | 变量名 | 说明 |
77
+ |--------|------|
78
+ | `VITE_PORT` | 开发服务器端口 |
79
+ | `VITE_API_URL` | 后端 API 地址 |
80
+ | `VITE_API_AFFIX` | API 路由前缀(用于代理) |
81
+ | `VITE_APP_NAME` | 应用名称 |
82
+
83
+ ## TypeScript 6/7 并存说明
84
+
85
+ TypeScript 7.0 使用 Go 重写了编译器,但暂不提供程序化 API,因此 `typescript-eslint` 和 `vue-tsc` 暂不兼容。
86
+
87
+ 本项目采用微软官方推荐的并存方案:
88
+
89
+ - `typescript` → 指向 `@typescript/typescript6`(供 ESLint、vue-tsc 使用)
90
+ - `@typescript/native` → 指向 TypeScript 7(可手动调用 `npx @typescript/native tsc`)
91
+
92
+ VS Code 中安装 [TypeScript (Native Preview)](https://marketplace.visualstudio.com/items?itemName=TypeScriptTeam.native-preview) 扩展可享受 TS7 的语言服务加速。
93
+
94
+ ## 代码规范
95
+
96
+ - **ESLint**:使用 `@antfu/eslint-config`,单引号、无分号、自动排序 imports
97
+ - **OxLint**:作为 ESLint 的补充,提供更快的 lint 速度
98
+ - **Commitlint**:提交信息需遵循 [Conventional Commits](https://www.conventionalcommits.org/) 规范
@@ -0,0 +1 @@
1
+ export default { extends: ["@commitlint/config-conventional"] };
@@ -0,0 +1,13 @@
1
+ import antfu from '@antfu/eslint-config'
2
+ import oxlint from 'eslint-plugin-oxlint'
3
+
4
+ export default antfu(
5
+ {
6
+ formatters: {
7
+ css: true,
8
+ html: true,
9
+ },
10
+ vue: true,
11
+ unocss: true,
12
+ },
13
+ ).append(...oxlint.configs['flat/recommended'])
@@ -1,7 +1,7 @@
1
1
  pre-commit:
2
2
  commands:
3
3
  check:
4
- glob: '*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc,vue}'
4
+ glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc,vue}"
5
5
  run: pnpm eslint --fix {staged_files}
6
6
  stage_fixed: true
7
7
 
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "web-vue",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vp dev --mode development",
8
+ "build": "vue-tsc -b && vp build",
9
+ "preview": "vp preview",
10
+ "lint": "oxlint && eslint",
11
+ "lint:fix": "oxlint && eslint --fix"
12
+ },
13
+ "dependencies": {
14
+ "@alova/adapter-axios": "catalog:",
15
+ "@antdv-next/icons": "catalog:",
16
+ "@bubblesjs/i18n-vue": "workspace:*",
17
+ "alova": "catalog:",
18
+ "antdv-next": "catalog:",
19
+ "axios": "catalog:",
20
+ "dayjs": "catalog:",
21
+ "echarts": "catalog:",
22
+ "nprogress": "catalog:",
23
+ "pinia": "catalog:",
24
+ "pinia-plugin-persistedstate": "catalog:",
25
+ "radashi": "catalog:",
26
+ "vue": "catalog:",
27
+ "vue-router": "catalog:"
28
+ },
29
+ "devDependencies": {
30
+ "@antdv-next/auto-import-resolver": "catalog:",
31
+ "@antfu/eslint-config": "catalog:",
32
+ "@bubblesjs/i18n-core": "workspace:*",
33
+ "@commitlint/cli": "catalog:",
34
+ "@commitlint/config-conventional": "catalog:",
35
+ "@types/node": "catalog:",
36
+ "@types/nprogress": "catalog:",
37
+ "@typescript/native": "catalog:",
38
+ "@unocss/eslint-plugin": "catalog:",
39
+ "@unocss/preset-attributify": "catalog:",
40
+ "@unocss/preset-wind4": "catalog:",
41
+ "@vitejs/plugin-vue": "catalog:",
42
+ "@vue/tsconfig": "catalog:",
43
+ "eslint": "catalog:",
44
+ "eslint-plugin-format": "catalog:",
45
+ "eslint-plugin-oxlint": "catalog:",
46
+ "fast-glob": "catalog:",
47
+ "lefthook": "catalog:",
48
+ "oxlint": "catalog:",
49
+ "sass": "catalog:",
50
+ "typescript": "catalog:typescript6",
51
+ "unocss": "catalog:",
52
+ "unplugin-auto-import": "catalog:",
53
+ "unplugin-vue-components": "catalog:",
54
+ "vite": "catalog:",
55
+ "vite-plugin-inspect": "catalog:",
56
+ "vite-plugin-svg-icons": "catalog:",
57
+ "vite-plus": "catalog:",
58
+ "vue-tsc": "catalog:"
59
+ },
60
+ "devEngines": {
61
+ "packageManager": {
62
+ "name": "pnpm",
63
+ "version": "11.11.0",
64
+ "onFail": "download"
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,16 @@
1
+ minimumReleaseAgeExclude:
2
+ - eslint@10.7.0
3
+ catalog:
4
+ vite: npm:@voidzero-dev/vite-plus-core@0.2.4
5
+ vite-plus: 0.2.4
6
+ overrides:
7
+ vite: "catalog:"
8
+ peerDependencyRules:
9
+ allowAny:
10
+ - vite
11
+ allowedVersions:
12
+ vite: "*"
13
+ allowBuilds:
14
+ '@parcel/watcher': true
15
+ lefthook: true
16
+ vue-demi: true
@@ -0,0 +1,12 @@
1
+ <script setup lang="ts">
2
+ import I18nProvider from '@bubblesjs/i18n-vue'
3
+ import { leftStore } from '@/i18n/instance'
4
+ </script>
5
+
6
+ <template>
7
+ <I18nProvider :store="leftStore">
8
+ <RouterView />
9
+ </I18nProvider>
10
+ </template>
11
+
12
+ <style scoped></style>
@@ -0,0 +1,12 @@
1
+ import request from "@/utils/request";
2
+
3
+ export const EXPIRE_TIME = 60 * 10 * 1000;
4
+
5
+ export function getTree() {
6
+ return request.Get("/xxx/xx", {
7
+ cacheFor: {
8
+ mode: "restore",
9
+ expire: EXPIRE_TIME,
10
+ },
11
+ });
12
+ }
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  defineProps<{
3
- icon: string
4
- }>()
5
- const attrs = useAttrs()
3
+ icon: string;
4
+ }>();
5
+ const attrs = useAttrs();
6
6
  </script>
7
7
 
8
8
  <template>
@@ -6,7 +6,7 @@ import {
6
6
  PictorialBarChart,
7
7
  PieChart,
8
8
  RadarChart,
9
- } from 'echarts/charts'
9
+ } from "echarts/charts";
10
10
  import {
11
11
  AriaComponent,
12
12
  CalendarComponent,
@@ -22,11 +22,11 @@ import {
22
22
  ToolboxComponent,
23
23
  TooltipComponent,
24
24
  VisualMapComponent,
25
- } from 'echarts/components'
26
- import * as echarts from 'echarts/core'
25
+ } from "echarts/components";
26
+ import * as echarts from "echarts/core";
27
27
  // TODO 如果想换成SVG渲染,就导出SVGRenderer,
28
28
  // 并且放到 echarts.use 里,注释掉 CanvasRenderer
29
- import { /* SVGRenderer */ CanvasRenderer } from 'echarts/renderers'
29
+ import { /* SVGRenderer */ CanvasRenderer } from "echarts/renderers";
30
30
 
31
31
  echarts.use([
32
32
  LegendComponent,
@@ -52,6 +52,6 @@ echarts.use([
52
52
  TimelineComponent,
53
53
  CalendarComponent,
54
54
  GraphicComponent,
55
- ])
55
+ ]);
56
56
 
57
- export default echarts
57
+ export default echarts;
@@ -0,0 +1,65 @@
1
+ import type { EChartsOption } from "echarts";
2
+
3
+ import type { ShallowRef } from "vue";
4
+
5
+ import { debounce } from "radashi";
6
+
7
+ import echarts from "./lib";
8
+
9
+ type setOptionsType = (options: EChartsOption, clear?: boolean) => void;
10
+
11
+ export function useECharts(
12
+ elRef: Ref<HTMLDivElement> | Readonly<ShallowRef<HTMLDivElement | null>>,
13
+ ) {
14
+ let chartInstance: echarts.ECharts | null = null;
15
+ let resizeObserver: ResizeObserver | undefined;
16
+
17
+ const resize = () => {
18
+ chartInstance?.resize();
19
+ };
20
+
21
+ const initCharts = () => {
22
+ if (!elRef) return;
23
+ const el = unref(elRef);
24
+ if (!el) return;
25
+
26
+ resizeObserver = new ResizeObserver(
27
+ debounce(
28
+ {
29
+ delay: 100,
30
+ },
31
+ resize,
32
+ ),
33
+ );
34
+ resizeObserver.observe(el);
35
+
36
+ chartInstance = echarts.init(el);
37
+ };
38
+
39
+ const setOptions: setOptionsType = (options, clear = true) => {
40
+ if (!chartInstance) {
41
+ initCharts();
42
+ if (!chartInstance) return;
43
+ }
44
+ clear && chartInstance?.clear();
45
+ chartInstance?.setOption(options);
46
+ };
47
+
48
+ const getInstance: () => echarts.ECharts | null = () => {
49
+ if (!chartInstance) initCharts();
50
+ return chartInstance;
51
+ };
52
+
53
+ onUnmounted(() => {
54
+ chartInstance?.dispose();
55
+ resizeObserver?.disconnect();
56
+ resizeObserver = undefined;
57
+ });
58
+
59
+ return {
60
+ setOptions,
61
+ resize,
62
+ echarts,
63
+ getInstance,
64
+ };
65
+ }
@@ -0,0 +1,8 @@
1
+ import { createJsonStorage, i18n } from '@bubblesjs/i18n-core'
2
+
3
+ export const leftStore = await i18n.init({
4
+ locale: 'zh_CN',
5
+ loaderMessage: async (locale?: string) => (await import(`@/locales/${locale}.json`))?.default,
6
+ storageKey: 'i18n-home-left',
7
+ storage: createJsonStorage(localStorage),
8
+ })
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ import { useUserStoreWithOut } from '@/store/modules/user'
3
+
4
+ const userStore = useUserStoreWithOut()
5
+ const router = useRouter()
6
+
7
+ function handleMenuClick({ key }: { key: string }) {
8
+ if (key === 'logout') {
9
+ userStore.$reset()
10
+ router.push('/login')
11
+ }
12
+ }
13
+
14
+ const dropdownItems = [
15
+ { key: 'logout', label: '退出登录' },
16
+ ]
17
+ </script>
18
+
19
+ <template>
20
+ <div class="flex gap-3 items-center">
21
+ <ADropdown :menu="{ items: dropdownItems, onClick: handleMenuClick }">
22
+ <div class="flex-center gap-2 cursor-pointer">
23
+ <AAvatar :size="32" :src="userStore.avatar">
24
+ {{ userStore.name?.charAt(0).toUpperCase() }}
25
+ </AAvatar>
26
+ <span class="text-sm">{{ userStore.name }}</span>
27
+ </div>
28
+ </ADropdown>
29
+ </div>
30
+ </template>
@@ -0,0 +1,138 @@
1
+ <script lang="ts" setup>
2
+ import type { MenuRouteRecordRawType } from '@/router/interface'
3
+
4
+ import SvgIcon from '@/components/Icon/svg-icon.vue'
5
+
6
+ import { menuRoutes } from '@/router/modules'
7
+
8
+ import Header from './header/index.vue'
9
+
10
+ const route = useRoute()
11
+ const router = useRouter()
12
+
13
+ const collapsed = ref(false)
14
+
15
+ const selectedKeys = computed(() => {
16
+ const matched = route.matched.map(item => item.name)
17
+ return matched.filter(Boolean) as string[]
18
+ })
19
+
20
+ const openKeys = ref<string[]>([])
21
+
22
+ watchEffect(() => {
23
+ const matched = route.matched.map(item => item.name).filter(Boolean) as string[]
24
+ if (matched.length > 1) {
25
+ openKeys.value = [matched[0]]
26
+ }
27
+ })
28
+
29
+ function handleMenuClick({ key }: { key: string }) {
30
+ router.push({ name: key })
31
+ }
32
+
33
+ function renderIcon(icon?: string) {
34
+ if (!icon)
35
+ return null
36
+ const isSvgIcon = icon.startsWith('svg-')
37
+ if (isSvgIcon) {
38
+ return h(SvgIcon, {
39
+ icon: icon.replace('svg-', ''),
40
+ style: { fontSize: '18px' },
41
+ })
42
+ }
43
+ return null
44
+ }
45
+
46
+ function getMenuItems(routes: MenuRouteRecordRawType[]) {
47
+ return routes
48
+ .filter(item => !item.meta?.hideInMenu)
49
+ .map((item) => {
50
+ const hasChildren = item.children && item.children.length > 0
51
+ if (hasChildren) {
52
+ return {
53
+ key: item.name as string,
54
+ label: item.meta?.title ?? item.name,
55
+ icon: renderIcon(item.meta?.icon),
56
+ children: getMenuItems(item.children as MenuRouteRecordRawType[]),
57
+ }
58
+ }
59
+ return {
60
+ key: item.name as string,
61
+ label: item.meta?.title ?? item.name,
62
+ icon: renderIcon(item.meta?.icon),
63
+ }
64
+ })
65
+ }
66
+
67
+ const menuItems = computed(() => getMenuItems(menuRoutes))
68
+ </script>
69
+
70
+ <template>
71
+ <ALayout class="h-screen">
72
+ <ALayoutSider
73
+ v-model:collapsed="collapsed"
74
+ :trigger="null"
75
+ collapsible
76
+ :width="220"
77
+ class="layout-sider"
78
+ >
79
+ <div class="logo flex-center gap-2 h-[var(--header-height)]">
80
+ <SvgIcon icon="logo" class="text-2xl" />
81
+ <span v-show="!collapsed" class="text-lg text-white font-bold">
82
+ Vue Template
83
+ </span>
84
+ </div>
85
+ <AMenu
86
+ v-model:selected-keys="selectedKeys"
87
+ v-model:open-keys="openKeys"
88
+ :items="menuItems"
89
+ theme="dark"
90
+ mode="inline"
91
+ @click="handleMenuClick"
92
+ />
93
+ </ALayoutSider>
94
+
95
+ <ALayout>
96
+ <ALayoutHeader class="layout-header px-4 flex items-center justify-between">
97
+ <div class="flex gap-3 items-center">
98
+ <AButton
99
+ type="text"
100
+ class="flex-center"
101
+ @click="collapsed = !collapsed"
102
+ >
103
+ <SvgIcon
104
+ :icon="collapsed ? 'menu-unfold' : 'menu-fold'"
105
+ style="font-size: 18px"
106
+ />
107
+ </AButton>
108
+ </div>
109
+ <Header />
110
+ </ALayoutHeader>
111
+
112
+ <ALayoutContent class="layout-content p-4 overflow-auto">
113
+ <RouterView />
114
+ </ALayoutContent>
115
+ </ALayout>
116
+ </ALayout>
117
+ </template>
118
+
119
+ <style lang="scss" scoped>
120
+ .layout-sider {
121
+ position: sticky;
122
+ top: 0;
123
+ height: 100vh;
124
+ overflow: auto;
125
+ }
126
+
127
+ .layout-header {
128
+ height: var(--header-height);
129
+ background: #fff;
130
+ border-bottom: 1px solid #f0f0f0;
131
+ padding: 0;
132
+ }
133
+
134
+ .layout-content {
135
+ min-height: calc(100vh - var(--header-height));
136
+ background: #f5f5f5;
137
+ }
138
+ </style>
@@ -0,0 +1,4 @@
1
+ {
2
+ "保存": "Save",
3
+ "你好1": "Hello"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "保存": "保存",
3
+ "你好1": "你好"
4
+ }
@@ -1,11 +1,8 @@
1
1
  import { createApp } from 'vue'
2
-
3
2
  import App from './App.vue'
4
3
  import { setupRouter } from './router'
5
4
  import { setupStore } from './store'
6
-
7
5
  import 'virtual:svg-icons-register'
8
-
9
6
  import '@/styles/index.scss'
10
7
  import 'virtual:uno.css'
11
8
 
@@ -0,0 +1,7 @@
1
+ import type { Router } from "vue-router";
2
+
3
+ import { createPermissionGuard } from "./permissionGuard";
4
+
5
+ export function setupGuard(router: Router) {
6
+ createPermissionGuard(router);
7
+ }
@@ -0,0 +1,13 @@
1
+ import type { Router } from "vue-router";
2
+
3
+ import NProgress from "nprogress";
4
+
5
+ export function createPermissionGuard(router: Router) {
6
+ router.beforeEach((_to, _from, next) => {
7
+ NProgress.start();
8
+ next();
9
+ });
10
+ router.afterEach((_to, _from) => {
11
+ NProgress.done();
12
+ });
13
+ }
@@ -1,18 +1,18 @@
1
- import type { App } from 'vue'
1
+ import type { App } from "vue";
2
2
 
3
- import { createRouter, createWebHistory } from 'vue-router'
3
+ import { createRouter, createWebHistory } from "vue-router";
4
4
 
5
- import { setupGuard } from './guard'
6
- import { routes } from './modules'
5
+ import { setupGuard } from "./guard";
6
+ import { routes } from "./modules";
7
7
 
8
8
  export const router = createRouter({
9
9
  history: createWebHistory(import.meta.env.PUBLIC_PATH),
10
10
  routes,
11
11
  strict: true,
12
12
  scrollBehavior: () => ({ left: 0, top: 0 }),
13
- })
13
+ });
14
14
 
15
15
  export function setupRouter(app: App) {
16
- setupGuard(router)
17
- app.use(router)
16
+ setupGuard(router);
17
+ app.use(router);
18
18
  }
@@ -0,0 +1,9 @@
1
+ import type { RouteRecordRaw } from "vue-router";
2
+
3
+ export type MenuRouteRecordRawType = RouteRecordRaw & {
4
+ meta?: {
5
+ title?: string;
6
+ icon?: string;
7
+ hideInMenu?: boolean;
8
+ };
9
+ };
@@ -2,9 +2,7 @@ import type { RouteRecordRaw } from 'vue-router'
2
2
 
3
3
  import type { MenuRouteRecordRawType } from '../interface'
4
4
 
5
- import { ExampleRoutes } from './example'
6
-
7
- export const menuRoutes: MenuRouteRecordRawType [] = [
5
+ export const menuRoutes: MenuRouteRecordRawType[] = [
8
6
  {
9
7
  path: '/home',
10
8
  name: 'Home',
@@ -26,7 +24,6 @@ export const routes: RouteRecordRaw[] = [
26
24
  ...menuRoutes,
27
25
  ],
28
26
  },
29
- ...ExampleRoutes,
30
27
  {
31
28
  path: '/login',
32
29
  name: 'login',
@@ -0,0 +1,11 @@
1
+ import type { App } from "vue";
2
+
3
+ import { createPinia } from "pinia";
4
+ import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
5
+
6
+ export const store = createPinia();
7
+ store.use(piniaPluginPersistedstate);
8
+
9
+ export function setupStore(app: App) {
10
+ app.use(store);
11
+ }
@@ -0,0 +1,17 @@
1
+ import { defineStore } from "pinia";
2
+
3
+ import { store } from "..";
4
+
5
+ export const useUserStore = defineStore("user", {
6
+ state: () => {
7
+ return {
8
+ name: "admin",
9
+ token: "admin",
10
+ avatar: "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif",
11
+ };
12
+ },
13
+ });
14
+
15
+ export function useUserStoreWithOut() {
16
+ return useUserStore(store);
17
+ }