create-hazejs 0.0.0-stage → 0.1.2

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 (187) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +17 -2
  3. package/bin/create-hazejs.mjs +2 -0
  4. package/dist/index.d.mts +1 -0
  5. package/dist/index.mjs +74 -0
  6. package/dist/scaffold.d.mts +29 -0
  7. package/dist/scaffold.mjs +76 -0
  8. package/package.json +77 -3
  9. package/templates/api/.env +4 -0
  10. package/templates/api/.env.test +1 -0
  11. package/templates/api/README.md +383 -0
  12. package/templates/api/_gitignore +9 -0
  13. package/templates/api/app/controller/AuthController.ts +45 -0
  14. package/templates/api/app/controller/GreetingController.ts +23 -0
  15. package/templates/api/app/controller/UserController.ts +38 -0
  16. package/templates/api/app/event/UserRegistered.ts +6 -0
  17. package/templates/api/app/exception/Handler.ts +13 -0
  18. package/templates/api/app/job/SendWelcomeEmail.ts +19 -0
  19. package/templates/api/app/listener/BroadcastRegistration.ts +7 -0
  20. package/templates/api/app/listener/QueueWelcomeEmail.ts +6 -0
  21. package/templates/api/app/mail/WelcomeMail.ts +17 -0
  22. package/templates/api/app/model/User.ts +11 -0
  23. package/templates/api/app/policy/UserPolicy.ts +14 -0
  24. package/templates/api/app/provider/AppProvider.ts +9 -0
  25. package/templates/api/app/provider/DatabaseProvider.ts +4 -0
  26. package/templates/api/app/response/Formatter.ts +17 -0
  27. package/templates/api/app/service/GreetingService.ts +6 -0
  28. package/templates/api/app/validate/auth.ts +20 -0
  29. package/templates/api/app/validate/greeting.ts +5 -0
  30. package/templates/api/app/validate/user.ts +12 -0
  31. package/templates/api/config/app.ts +7 -0
  32. package/templates/api/config/auth.ts +23 -0
  33. package/templates/api/config/cache.ts +23 -0
  34. package/templates/api/config/cors.ts +11 -0
  35. package/templates/api/config/database.ts +17 -0
  36. package/templates/api/config/filesystem.ts +32 -0
  37. package/templates/api/config/mail.ts +31 -0
  38. package/templates/api/config/middleware.ts +10 -0
  39. package/templates/api/config/queue.ts +21 -0
  40. package/templates/api/config/throttle.ts +12 -0
  41. package/templates/api/config/websocket.ts +12 -0
  42. package/templates/api/database/migrations/0000_create_users.sql +9 -0
  43. package/templates/api/database/migrations/0001_add_user_password.sql +1 -0
  44. package/templates/api/database/migrations/0002_add_user_role.sql +1 -0
  45. package/templates/api/database/migrations/meta/0000_snapshot.json +71 -0
  46. package/templates/api/database/migrations/meta/0001_snapshot.json +78 -0
  47. package/templates/api/database/migrations/meta/0002_snapshot.json +86 -0
  48. package/templates/api/database/migrations/meta/_journal.json +27 -0
  49. package/templates/api/database/schema/users.ts +17 -0
  50. package/templates/api/database/seeders/01-users.ts +15 -0
  51. package/templates/api/haze.config.ts +5 -0
  52. package/templates/api/package.json +38 -0
  53. package/templates/api/route/api.ts +22 -0
  54. package/templates/api/route/ws.ts +18 -0
  55. package/templates/api/schedule/app.ts +11 -0
  56. package/templates/api/tests/auth.test.ts +77 -0
  57. package/templates/api/tests/greeting.test.ts +29 -0
  58. package/templates/api/tests/user.test.ts +58 -0
  59. package/templates/api/tsconfig.json +34 -0
  60. package/templates/api/vitest.config.ts +4 -0
  61. package/templates/react/.env +8 -0
  62. package/templates/react/.env.test +1 -0
  63. package/templates/react/README.md +374 -0
  64. package/templates/react/_gitignore +9 -0
  65. package/templates/react/haze.config.ts +8 -0
  66. package/templates/react/index.html +12 -0
  67. package/templates/react/package.json +46 -0
  68. package/templates/react/server/app/controller/AuthController.ts +45 -0
  69. package/templates/react/server/app/controller/GreetingController.ts +23 -0
  70. package/templates/react/server/app/controller/UserController.ts +38 -0
  71. package/templates/react/server/app/event/UserRegistered.ts +6 -0
  72. package/templates/react/server/app/exception/Handler.ts +13 -0
  73. package/templates/react/server/app/job/SendWelcomeEmail.ts +19 -0
  74. package/templates/react/server/app/listener/BroadcastRegistration.ts +7 -0
  75. package/templates/react/server/app/listener/QueueWelcomeEmail.ts +6 -0
  76. package/templates/react/server/app/mail/WelcomeMail.ts +17 -0
  77. package/templates/react/server/app/model/User.ts +11 -0
  78. package/templates/react/server/app/policy/UserPolicy.ts +14 -0
  79. package/templates/react/server/app/provider/AppProvider.ts +9 -0
  80. package/templates/react/server/app/provider/DatabaseProvider.ts +4 -0
  81. package/templates/react/server/app/provider/SocketProvider.ts +4 -0
  82. package/templates/react/server/app/response/Formatter.ts +17 -0
  83. package/templates/react/server/app/service/GreetingService.ts +6 -0
  84. package/templates/react/server/app/socket/chat.ts +17 -0
  85. package/templates/react/server/app/validate/auth.ts +20 -0
  86. package/templates/react/server/app/validate/greeting.ts +5 -0
  87. package/templates/react/server/app/validate/user.ts +12 -0
  88. package/templates/react/server/config/app.ts +7 -0
  89. package/templates/react/server/config/auth.ts +23 -0
  90. package/templates/react/server/config/cache.ts +23 -0
  91. package/templates/react/server/config/database.ts +17 -0
  92. package/templates/react/server/config/filesystem.ts +32 -0
  93. package/templates/react/server/config/mail.ts +31 -0
  94. package/templates/react/server/config/middleware.ts +11 -0
  95. package/templates/react/server/config/queue.ts +21 -0
  96. package/templates/react/server/config/socketio.ts +13 -0
  97. package/templates/react/server/config/throttle.ts +12 -0
  98. package/templates/react/server/config/websocket.ts +12 -0
  99. package/templates/react/server/database/migrations/0000_create_users.sql +9 -0
  100. package/templates/react/server/database/migrations/0001_add_user_password.sql +1 -0
  101. package/templates/react/server/database/migrations/0002_add_user_role.sql +1 -0
  102. package/templates/react/server/database/migrations/meta/0000_snapshot.json +71 -0
  103. package/templates/react/server/database/migrations/meta/0001_snapshot.json +78 -0
  104. package/templates/react/server/database/migrations/meta/0002_snapshot.json +86 -0
  105. package/templates/react/server/database/migrations/meta/_journal.json +27 -0
  106. package/templates/react/server/database/schema/users.ts +17 -0
  107. package/templates/react/server/database/seeders/01-users.ts +15 -0
  108. package/templates/react/server/route/api.ts +24 -0
  109. package/templates/react/server/route/ws.ts +18 -0
  110. package/templates/react/server/schedule/app.ts +11 -0
  111. package/templates/react/src/App.css +22 -0
  112. package/templates/react/src/App.tsx +72 -0
  113. package/templates/react/src/api.ts +48 -0
  114. package/templates/react/src/main.tsx +9 -0
  115. package/templates/react/src/socket.ts +5 -0
  116. package/templates/react/src/vite-env.d.ts +5 -0
  117. package/templates/react/tests/auth.test.ts +77 -0
  118. package/templates/react/tests/greeting.test.ts +29 -0
  119. package/templates/react/tests/user.test.ts +58 -0
  120. package/templates/react/tsconfig.app.json +22 -0
  121. package/templates/react/tsconfig.json +7 -0
  122. package/templates/react/tsconfig.server.json +34 -0
  123. package/templates/react/vite.config.ts +18 -0
  124. package/templates/react/vitest.config.ts +8 -0
  125. package/templates/vue/.env +8 -0
  126. package/templates/vue/.env.test +1 -0
  127. package/templates/vue/README.md +374 -0
  128. package/templates/vue/_gitignore +9 -0
  129. package/templates/vue/haze.config.ts +8 -0
  130. package/templates/vue/index.html +12 -0
  131. package/templates/vue/package.json +44 -0
  132. package/templates/vue/server/app/controller/AuthController.ts +45 -0
  133. package/templates/vue/server/app/controller/GreetingController.ts +23 -0
  134. package/templates/vue/server/app/controller/UserController.ts +38 -0
  135. package/templates/vue/server/app/event/UserRegistered.ts +6 -0
  136. package/templates/vue/server/app/exception/Handler.ts +13 -0
  137. package/templates/vue/server/app/job/SendWelcomeEmail.ts +19 -0
  138. package/templates/vue/server/app/listener/BroadcastRegistration.ts +7 -0
  139. package/templates/vue/server/app/listener/QueueWelcomeEmail.ts +6 -0
  140. package/templates/vue/server/app/mail/WelcomeMail.ts +17 -0
  141. package/templates/vue/server/app/model/User.ts +11 -0
  142. package/templates/vue/server/app/policy/UserPolicy.ts +14 -0
  143. package/templates/vue/server/app/provider/AppProvider.ts +9 -0
  144. package/templates/vue/server/app/provider/DatabaseProvider.ts +4 -0
  145. package/templates/vue/server/app/provider/SocketProvider.ts +4 -0
  146. package/templates/vue/server/app/response/Formatter.ts +17 -0
  147. package/templates/vue/server/app/service/GreetingService.ts +6 -0
  148. package/templates/vue/server/app/socket/chat.ts +17 -0
  149. package/templates/vue/server/app/validate/auth.ts +20 -0
  150. package/templates/vue/server/app/validate/greeting.ts +5 -0
  151. package/templates/vue/server/app/validate/user.ts +12 -0
  152. package/templates/vue/server/config/app.ts +7 -0
  153. package/templates/vue/server/config/auth.ts +23 -0
  154. package/templates/vue/server/config/cache.ts +23 -0
  155. package/templates/vue/server/config/database.ts +17 -0
  156. package/templates/vue/server/config/filesystem.ts +32 -0
  157. package/templates/vue/server/config/mail.ts +31 -0
  158. package/templates/vue/server/config/middleware.ts +11 -0
  159. package/templates/vue/server/config/queue.ts +21 -0
  160. package/templates/vue/server/config/socketio.ts +13 -0
  161. package/templates/vue/server/config/throttle.ts +12 -0
  162. package/templates/vue/server/config/websocket.ts +12 -0
  163. package/templates/vue/server/database/migrations/0000_create_users.sql +9 -0
  164. package/templates/vue/server/database/migrations/0001_add_user_password.sql +1 -0
  165. package/templates/vue/server/database/migrations/0002_add_user_role.sql +1 -0
  166. package/templates/vue/server/database/migrations/meta/0000_snapshot.json +71 -0
  167. package/templates/vue/server/database/migrations/meta/0001_snapshot.json +78 -0
  168. package/templates/vue/server/database/migrations/meta/0002_snapshot.json +86 -0
  169. package/templates/vue/server/database/migrations/meta/_journal.json +27 -0
  170. package/templates/vue/server/database/schema/users.ts +17 -0
  171. package/templates/vue/server/database/seeders/01-users.ts +15 -0
  172. package/templates/vue/server/route/api.ts +24 -0
  173. package/templates/vue/server/route/ws.ts +18 -0
  174. package/templates/vue/server/schedule/app.ts +11 -0
  175. package/templates/vue/src/App.vue +92 -0
  176. package/templates/vue/src/api.ts +48 -0
  177. package/templates/vue/src/env.d.ts +5 -0
  178. package/templates/vue/src/main.ts +4 -0
  179. package/templates/vue/src/socket.ts +5 -0
  180. package/templates/vue/tests/auth.test.ts +77 -0
  181. package/templates/vue/tests/greeting.test.ts +29 -0
  182. package/templates/vue/tests/user.test.ts +58 -0
  183. package/templates/vue/tsconfig.app.json +22 -0
  184. package/templates/vue/tsconfig.json +7 -0
  185. package/templates/vue/tsconfig.server.json +34 -0
  186. package/templates/vue/vite.config.ts +18 -0
  187. package/templates/vue/vitest.config.ts +8 -0
@@ -0,0 +1,34 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.server.tsbuildinfo",
5
+ "target": "ES2023",
6
+ "lib": [
7
+ "ES2023"
8
+ ],
9
+ "moduleDetection": "force",
10
+ "module": "ESNext",
11
+ "moduleResolution": "Bundler",
12
+ "paths": {
13
+ "~/*": [
14
+ "./server/*"
15
+ ]
16
+ },
17
+ "types": [
18
+ "node",
19
+ "vite/client",
20
+ "@hazejs/vite/client"
21
+ ],
22
+ "strict": true,
23
+ "noEmit": true,
24
+ "isolatedModules": true,
25
+ "verbatimModuleSyntax": true,
26
+ "skipLibCheck": true
27
+ },
28
+ "include": [
29
+ "server/**/*.ts",
30
+ "tests/**/*.ts",
31
+ "*.config.ts",
32
+ ".haze/types/**/*.d.ts"
33
+ ]
34
+ }
@@ -0,0 +1,18 @@
1
+ import { fileURLToPath, URL } from 'node:url'
2
+ import { haze } from '@hazejs/vite'
3
+ import vue from '@vitejs/plugin-vue'
4
+ import { defineConfig } from 'vite'
5
+
6
+ export default defineConfig({
7
+ plugins: [
8
+ vue(),
9
+ // 开发时把 /api/** 交给 server/ 下的后端(同端口、热替换);
10
+ // vite build 一次产出 dist/client 与 dist/server
11
+ haze(),
12
+ ],
13
+ resolve: {
14
+ alias: {
15
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
16
+ },
17
+ },
18
+ })
@@ -0,0 +1,8 @@
1
+ import { defineHazeTestConfig } from '@hazejs/testing/config'
2
+ import { defineConfig } from 'vitest/config'
3
+
4
+ export default defineConfig(defineHazeTestConfig({
5
+ test: {
6
+ include: ['tests/**/*.test.ts'],
7
+ },
8
+ }))