@coze-arch/cli 0.0.1-beta.5 → 0.0.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 (324) hide show
  1. package/README.md +1 -0
  2. package/lib/__templates__/expo/.coze +7 -2
  3. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +46 -0
  4. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +229 -0
  5. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +47 -0
  6. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +34 -0
  7. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
  8. package/lib/__templates__/expo/README.md +68 -7
  9. package/lib/__templates__/expo/_gitignore +1 -1
  10. package/lib/__templates__/{react-rsbuild → expo}/_npmrc +4 -5
  11. package/lib/__templates__/expo/client/app/+not-found.tsx +15 -64
  12. package/lib/__templates__/expo/client/app/_layout.tsx +15 -12
  13. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  14. package/lib/__templates__/expo/client/app.config.ts +76 -0
  15. package/lib/__templates__/expo/client/components/Screen.tsx +22 -38
  16. package/lib/__templates__/expo/client/components/ThemedText.tsx +33 -0
  17. package/lib/__templates__/expo/client/components/ThemedView.tsx +37 -0
  18. package/lib/__templates__/expo/client/constants/theme.ts +117 -58
  19. package/lib/__templates__/expo/client/contexts/AuthContext.tsx +14 -107
  20. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  21. package/lib/__templates__/expo/{eslint.config.mjs → client/eslint.config.mjs} +40 -10
  22. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
  23. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  24. package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
  25. package/lib/__templates__/expo/client/metro.config.js +124 -0
  26. package/lib/__templates__/expo/client/package.json +95 -0
  27. package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
  28. package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
  29. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +47 -22
  30. package/lib/__templates__/expo/client/tsconfig.json +24 -0
  31. package/lib/__templates__/expo/client/utils/index.ts +23 -2
  32. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  33. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  34. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  35. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  36. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/index.js +9 -0
  37. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/rule.js +112 -0
  38. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/tech.md +94 -0
  39. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  40. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  41. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  42. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  43. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/index.js +9 -0
  44. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/rule.js +120 -0
  45. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/tech.md +58 -0
  46. package/lib/__templates__/expo/package.json +16 -91
  47. package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
  48. package/lib/__templates__/expo/pnpm-lock.yaml +1805 -3126
  49. package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
  50. package/lib/__templates__/expo/server/build.js +21 -0
  51. package/lib/__templates__/expo/server/package.json +34 -0
  52. package/lib/__templates__/expo/server/src/index.ts +20 -0
  53. package/lib/__templates__/expo/server/tsconfig.json +24 -0
  54. package/lib/__templates__/expo/template.config.js +58 -1
  55. package/lib/__templates__/expo/tsconfig.json +1 -24
  56. package/lib/__templates__/native-static/.coze +11 -0
  57. package/lib/__templates__/native-static/index.html +33 -0
  58. package/lib/__templates__/native-static/styles/main.css +136 -0
  59. package/lib/__templates__/native-static/template.config.js +22 -0
  60. package/lib/__templates__/nextjs/.babelrc +15 -0
  61. package/lib/__templates__/nextjs/.coze +4 -3
  62. package/lib/__templates__/nextjs/README.md +346 -19
  63. package/lib/__templates__/nextjs/_npmrc +2 -1
  64. package/lib/__templates__/nextjs/components.json +21 -0
  65. package/lib/__templates__/nextjs/eslint.config.mjs +5 -0
  66. package/lib/__templates__/nextjs/next.config.ts +11 -0
  67. package/lib/__templates__/nextjs/package.json +63 -2
  68. package/lib/__templates__/nextjs/pnpm-lock.yaml +10053 -1710
  69. package/lib/__templates__/nextjs/scripts/build.sh +4 -1
  70. package/lib/__templates__/nextjs/scripts/dev.sh +15 -27
  71. package/lib/__templates__/{react-rsbuild/scripts/build.sh → nextjs/scripts/prepare.sh} +0 -5
  72. package/lib/__templates__/nextjs/scripts/start.sh +7 -1
  73. package/lib/__templates__/nextjs/src/app/globals.css +124 -13
  74. package/lib/__templates__/nextjs/src/app/layout.tsx +56 -16
  75. package/lib/__templates__/nextjs/src/app/page.tsx +18 -49
  76. package/lib/__templates__/nextjs/src/app/robots.ts +11 -0
  77. package/lib/__templates__/nextjs/src/components/ui/accordion.tsx +66 -0
  78. package/lib/__templates__/nextjs/src/components/ui/alert-dialog.tsx +157 -0
  79. package/lib/__templates__/nextjs/src/components/ui/alert.tsx +66 -0
  80. package/lib/__templates__/nextjs/src/components/ui/aspect-ratio.tsx +11 -0
  81. package/lib/__templates__/nextjs/src/components/ui/avatar.tsx +53 -0
  82. package/lib/__templates__/nextjs/src/components/ui/badge.tsx +46 -0
  83. package/lib/__templates__/nextjs/src/components/ui/breadcrumb.tsx +109 -0
  84. package/lib/__templates__/nextjs/src/components/ui/button-group.tsx +83 -0
  85. package/lib/__templates__/nextjs/src/components/ui/button.tsx +62 -0
  86. package/lib/__templates__/nextjs/src/components/ui/calendar.tsx +220 -0
  87. package/lib/__templates__/nextjs/src/components/ui/card.tsx +92 -0
  88. package/lib/__templates__/nextjs/src/components/ui/carousel.tsx +241 -0
  89. package/lib/__templates__/nextjs/src/components/ui/chart.tsx +357 -0
  90. package/lib/__templates__/nextjs/src/components/ui/checkbox.tsx +32 -0
  91. package/lib/__templates__/nextjs/src/components/ui/collapsible.tsx +33 -0
  92. package/lib/__templates__/nextjs/src/components/ui/command.tsx +184 -0
  93. package/lib/__templates__/nextjs/src/components/ui/context-menu.tsx +252 -0
  94. package/lib/__templates__/nextjs/src/components/ui/dialog.tsx +143 -0
  95. package/lib/__templates__/nextjs/src/components/ui/drawer.tsx +135 -0
  96. package/lib/__templates__/nextjs/src/components/ui/dropdown-menu.tsx +257 -0
  97. package/lib/__templates__/nextjs/src/components/ui/empty.tsx +104 -0
  98. package/lib/__templates__/nextjs/src/components/ui/field.tsx +248 -0
  99. package/lib/__templates__/nextjs/src/components/ui/form.tsx +167 -0
  100. package/lib/__templates__/nextjs/src/components/ui/hover-card.tsx +44 -0
  101. package/lib/__templates__/nextjs/src/components/ui/input-group.tsx +170 -0
  102. package/lib/__templates__/nextjs/src/components/ui/input-otp.tsx +77 -0
  103. package/lib/__templates__/nextjs/src/components/ui/input.tsx +21 -0
  104. package/lib/__templates__/nextjs/src/components/ui/item.tsx +193 -0
  105. package/lib/__templates__/nextjs/src/components/ui/kbd.tsx +28 -0
  106. package/lib/__templates__/nextjs/src/components/ui/label.tsx +24 -0
  107. package/lib/__templates__/nextjs/src/components/ui/menubar.tsx +276 -0
  108. package/lib/__templates__/nextjs/src/components/ui/navigation-menu.tsx +168 -0
  109. package/lib/__templates__/nextjs/src/components/ui/pagination.tsx +127 -0
  110. package/lib/__templates__/nextjs/src/components/ui/popover.tsx +48 -0
  111. package/lib/__templates__/nextjs/src/components/ui/progress.tsx +31 -0
  112. package/lib/__templates__/nextjs/src/components/ui/radio-group.tsx +45 -0
  113. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +63 -0
  114. package/lib/__templates__/nextjs/src/components/ui/scroll-area.tsx +58 -0
  115. package/lib/__templates__/nextjs/src/components/ui/select.tsx +190 -0
  116. package/lib/__templates__/nextjs/src/components/ui/separator.tsx +28 -0
  117. package/lib/__templates__/nextjs/src/components/ui/sheet.tsx +139 -0
  118. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +724 -0
  119. package/lib/__templates__/nextjs/src/components/ui/skeleton.tsx +13 -0
  120. package/lib/__templates__/nextjs/src/components/ui/slider.tsx +63 -0
  121. package/lib/__templates__/nextjs/src/components/ui/sonner.tsx +40 -0
  122. package/lib/__templates__/nextjs/src/components/ui/spinner.tsx +16 -0
  123. package/lib/__templates__/nextjs/src/components/ui/switch.tsx +31 -0
  124. package/lib/__templates__/nextjs/src/components/ui/table.tsx +116 -0
  125. package/lib/__templates__/nextjs/src/components/ui/tabs.tsx +66 -0
  126. package/lib/__templates__/nextjs/src/components/ui/textarea.tsx +18 -0
  127. package/lib/__templates__/nextjs/src/components/ui/toggle-group.tsx +83 -0
  128. package/lib/__templates__/nextjs/src/components/ui/toggle.tsx +47 -0
  129. package/lib/__templates__/nextjs/src/components/ui/tooltip.tsx +61 -0
  130. package/lib/__templates__/nextjs/src/hooks/use-mobile.ts +19 -0
  131. package/lib/__templates__/nextjs/src/lib/utils.ts +6 -0
  132. package/lib/__templates__/nextjs/src/server.ts +35 -0
  133. package/lib/__templates__/nextjs/template.config.js +70 -5
  134. package/lib/__templates__/nextjs/tsconfig.json +1 -1
  135. package/lib/__templates__/nuxt-vue/.coze +12 -0
  136. package/lib/__templates__/nuxt-vue/README.md +73 -0
  137. package/lib/__templates__/nuxt-vue/_gitignore +24 -0
  138. package/lib/__templates__/{rsbuild → nuxt-vue}/_npmrc +2 -1
  139. package/lib/__templates__/nuxt-vue/app/app.vue +6 -0
  140. package/lib/__templates__/nuxt-vue/app/pages/index.vue +23 -0
  141. package/lib/__templates__/{rsbuild/src/index.css → nuxt-vue/assets/css/main.css} +7 -4
  142. package/lib/__templates__/nuxt-vue/nuxt.config.ts +116 -0
  143. package/lib/__templates__/nuxt-vue/package.json +35 -0
  144. package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8759 -0
  145. package/lib/__templates__/nuxt-vue/postcss.config.mjs +8 -0
  146. package/lib/__templates__/nuxt-vue/public/favicon.ico +0 -0
  147. package/lib/__templates__/nuxt-vue/public/robots.txt +2 -0
  148. package/lib/__templates__/{rsbuild → nuxt-vue}/scripts/build.sh +2 -2
  149. package/lib/__templates__/nuxt-vue/scripts/dev.sh +39 -0
  150. package/lib/__templates__/nuxt-vue/scripts/prepare.sh +14 -0
  151. package/lib/__templates__/nuxt-vue/scripts/start.sh +21 -0
  152. package/lib/__templates__/nuxt-vue/server/api/hello.ts +10 -0
  153. package/lib/__templates__/nuxt-vue/server/middleware/logger.ts +10 -0
  154. package/lib/__templates__/nuxt-vue/server/routes/health.ts +10 -0
  155. package/lib/__templates__/nuxt-vue/tailwind.config.js +13 -0
  156. package/lib/__templates__/nuxt-vue/template.config.js +87 -0
  157. package/lib/__templates__/nuxt-vue/tsconfig.json +18 -0
  158. package/lib/__templates__/taro/.coze +14 -0
  159. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
  160. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
  161. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
  162. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
  163. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
  164. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -0
  165. package/lib/__templates__/taro/README.md +763 -0
  166. package/lib/__templates__/taro/_gitignore +40 -0
  167. package/lib/__templates__/taro/_npmrc +18 -0
  168. package/lib/__templates__/taro/babel.config.js +12 -0
  169. package/lib/__templates__/taro/config/dev.ts +9 -0
  170. package/lib/__templates__/taro/config/index.ts +238 -0
  171. package/lib/__templates__/taro/config/prod.ts +34 -0
  172. package/lib/__templates__/taro/eslint.config.mjs +135 -0
  173. package/lib/__templates__/taro/key/private.appid.key +0 -0
  174. package/lib/__templates__/taro/package.json +112 -0
  175. package/lib/__templates__/taro/patches/@tarojs__plugin-mini-ci@4.1.9.patch +30 -0
  176. package/lib/__templates__/taro/pnpm-lock.yaml +23412 -0
  177. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  178. package/lib/__templates__/taro/project.config.json +15 -0
  179. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  180. package/lib/__templates__/taro/server/package.json +40 -0
  181. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  182. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  183. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  184. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  185. package/lib/__templates__/taro/server/src/main.ts +49 -0
  186. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  187. package/lib/__templates__/taro/src/app.config.ts +11 -0
  188. package/lib/__templates__/taro/src/app.css +156 -0
  189. package/lib/__templates__/taro/src/app.tsx +9 -0
  190. package/lib/__templates__/taro/src/components/ui/accordion.tsx +159 -0
  191. package/lib/__templates__/taro/src/components/ui/alert-dialog.tsx +260 -0
  192. package/lib/__templates__/taro/src/components/ui/alert.tsx +60 -0
  193. package/lib/__templates__/taro/src/components/ui/aspect-ratio.tsx +36 -0
  194. package/lib/__templates__/taro/src/components/ui/avatar.tsx +84 -0
  195. package/lib/__templates__/taro/src/components/ui/badge.tsx +37 -0
  196. package/lib/__templates__/taro/src/components/ui/breadcrumb.tsx +117 -0
  197. package/lib/__templates__/taro/src/components/ui/button-group.tsx +83 -0
  198. package/lib/__templates__/taro/src/components/ui/button.tsx +67 -0
  199. package/lib/__templates__/taro/src/components/ui/calendar.tsx +394 -0
  200. package/lib/__templates__/taro/src/components/ui/card.tsx +108 -0
  201. package/lib/__templates__/taro/src/components/ui/carousel.tsx +228 -0
  202. package/lib/__templates__/taro/src/components/ui/checkbox.tsx +58 -0
  203. package/lib/__templates__/taro/src/components/ui/code-block.tsx +169 -0
  204. package/lib/__templates__/taro/src/components/ui/collapsible.tsx +71 -0
  205. package/lib/__templates__/taro/src/components/ui/command.tsx +385 -0
  206. package/lib/__templates__/taro/src/components/ui/context-menu.tsx +614 -0
  207. package/lib/__templates__/taro/src/components/ui/dialog.tsx +256 -0
  208. package/lib/__templates__/taro/src/components/ui/drawer.tsx +192 -0
  209. package/lib/__templates__/taro/src/components/ui/dropdown-menu.tsx +561 -0
  210. package/lib/__templates__/taro/src/components/ui/field.tsx +228 -0
  211. package/lib/__templates__/taro/src/components/ui/hover-card.tsx +282 -0
  212. package/lib/__templates__/taro/src/components/ui/input-group.tsx +197 -0
  213. package/lib/__templates__/taro/src/components/ui/input-otp.tsx +136 -0
  214. package/lib/__templates__/taro/src/components/ui/input.tsx +56 -0
  215. package/lib/__templates__/taro/src/components/ui/label.tsx +24 -0
  216. package/lib/__templates__/taro/src/components/ui/menubar.tsx +595 -0
  217. package/lib/__templates__/taro/src/components/ui/navigation-menu.tsx +264 -0
  218. package/lib/__templates__/taro/src/components/ui/pagination.tsx +118 -0
  219. package/lib/__templates__/taro/src/components/ui/popover.tsx +291 -0
  220. package/lib/__templates__/taro/src/components/ui/portal.tsx +19 -0
  221. package/lib/__templates__/taro/src/components/ui/progress.tsx +28 -0
  222. package/lib/__templates__/taro/src/components/ui/radio-group.tsx +64 -0
  223. package/lib/__templates__/taro/src/components/ui/resizable.tsx +346 -0
  224. package/lib/__templates__/taro/src/components/ui/scroll-area.tsx +34 -0
  225. package/lib/__templates__/taro/src/components/ui/select.tsx +438 -0
  226. package/lib/__templates__/taro/src/components/ui/separator.tsx +30 -0
  227. package/lib/__templates__/taro/src/components/ui/sheet.tsx +262 -0
  228. package/lib/__templates__/taro/src/components/ui/skeleton.tsx +17 -0
  229. package/lib/__templates__/taro/src/components/ui/slider.tsx +203 -0
  230. package/lib/__templates__/taro/src/components/ui/sonner.tsx +1 -0
  231. package/lib/__templates__/taro/src/components/ui/switch.tsx +55 -0
  232. package/lib/__templates__/taro/src/components/ui/table.tsx +142 -0
  233. package/lib/__templates__/taro/src/components/ui/tabs.tsx +114 -0
  234. package/lib/__templates__/taro/src/components/ui/textarea.tsx +54 -0
  235. package/lib/__templates__/taro/src/components/ui/toast.tsx +517 -0
  236. package/lib/__templates__/taro/src/components/ui/toggle-group.tsx +120 -0
  237. package/lib/__templates__/taro/src/components/ui/toggle.tsx +77 -0
  238. package/lib/__templates__/taro/src/components/ui/tooltip.tsx +455 -0
  239. package/lib/__templates__/taro/src/index.html +39 -0
  240. package/lib/__templates__/taro/src/lib/hooks/use-keyboard-offset.ts +37 -0
  241. package/lib/__templates__/taro/src/lib/measure.ts +115 -0
  242. package/lib/__templates__/taro/src/lib/platform.ts +12 -0
  243. package/lib/__templates__/taro/src/lib/utils.ts +6 -0
  244. package/lib/__templates__/taro/src/network.ts +39 -0
  245. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  246. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  247. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  248. package/lib/__templates__/taro/src/presets/dev-debug.ts +23 -0
  249. package/lib/__templates__/taro/src/presets/h5-container.tsx +15 -0
  250. package/lib/__templates__/taro/src/presets/h5-navbar.tsx +238 -0
  251. package/lib/__templates__/taro/src/presets/h5-styles.ts +220 -0
  252. package/lib/__templates__/taro/src/presets/index.tsx +18 -0
  253. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  254. package/lib/__templates__/taro/template.config.js +68 -0
  255. package/lib/__templates__/taro/tsconfig.json +29 -0
  256. package/lib/__templates__/taro/types/global.d.ts +32 -0
  257. package/lib/__templates__/templates.json +126 -64
  258. package/lib/__templates__/vite/.coze +4 -3
  259. package/lib/__templates__/vite/README.md +383 -26
  260. package/lib/__templates__/vite/_gitignore +1 -0
  261. package/lib/__templates__/vite/_npmrc +2 -1
  262. package/lib/__templates__/vite/eslint.config.mjs +14 -0
  263. package/lib/__templates__/vite/package.json +23 -3
  264. package/lib/__templates__/vite/pnpm-lock.yaml +2509 -293
  265. package/lib/__templates__/vite/scripts/build.sh +4 -1
  266. package/lib/__templates__/vite/scripts/dev.sh +16 -28
  267. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  268. package/lib/__templates__/vite/scripts/start.sh +9 -3
  269. package/lib/__templates__/vite/server/routes/index.ts +31 -0
  270. package/lib/__templates__/vite/server/server.ts +65 -0
  271. package/lib/__templates__/vite/server/vite.ts +67 -0
  272. package/lib/__templates__/vite/src/main.ts +17 -48
  273. package/lib/__templates__/vite/template.config.js +82 -10
  274. package/lib/__templates__/vite/tsconfig.json +4 -3
  275. package/lib/__templates__/vite/vite.config.ts +8 -3
  276. package/lib/cli.js +1544 -488
  277. package/package.json +18 -7
  278. package/lib/__templates__/expo/.cozeproj/scripts/deploy_build.sh +0 -109
  279. package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +0 -257
  280. package/lib/__templates__/expo/app.json +0 -63
  281. package/lib/__templates__/expo/babel.config.js +0 -9
  282. package/lib/__templates__/expo/client/app/(tabs)/_layout.tsx +0 -43
  283. package/lib/__templates__/expo/client/app/(tabs)/home.tsx +0 -1
  284. package/lib/__templates__/expo/client/app/(tabs)/index.tsx +0 -7
  285. package/lib/__templates__/expo/client/hooks/useColorScheme.ts +0 -1
  286. package/lib/__templates__/expo/client/index.js +0 -11
  287. package/lib/__templates__/expo/client/screens/home/index.tsx +0 -54
  288. package/lib/__templates__/expo/client/screens/home/styles.ts +0 -332
  289. package/lib/__templates__/expo/metro.config.js +0 -53
  290. package/lib/__templates__/expo/src/index.ts +0 -12
  291. package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
  292. package/lib/__templates__/react-rsbuild/.coze +0 -11
  293. package/lib/__templates__/react-rsbuild/.vscode/settings.json +0 -121
  294. package/lib/__templates__/react-rsbuild/README.md +0 -61
  295. package/lib/__templates__/react-rsbuild/_gitignore +0 -97
  296. package/lib/__templates__/react-rsbuild/package.json +0 -31
  297. package/lib/__templates__/react-rsbuild/pnpm-lock.yaml +0 -997
  298. package/lib/__templates__/react-rsbuild/rsbuild.config.ts +0 -13
  299. package/lib/__templates__/react-rsbuild/scripts/dev.sh +0 -51
  300. package/lib/__templates__/react-rsbuild/scripts/start.sh +0 -15
  301. package/lib/__templates__/react-rsbuild/src/App.tsx +0 -60
  302. package/lib/__templates__/react-rsbuild/src/index.css +0 -21
  303. package/lib/__templates__/react-rsbuild/src/index.html +0 -12
  304. package/lib/__templates__/react-rsbuild/src/index.tsx +0 -16
  305. package/lib/__templates__/react-rsbuild/tailwind.config.js +0 -9
  306. package/lib/__templates__/react-rsbuild/template.config.js +0 -54
  307. package/lib/__templates__/react-rsbuild/tsconfig.json +0 -17
  308. package/lib/__templates__/rsbuild/.coze +0 -11
  309. package/lib/__templates__/rsbuild/.vscode/settings.json +0 -7
  310. package/lib/__templates__/rsbuild/README.md +0 -61
  311. package/lib/__templates__/rsbuild/_gitignore +0 -97
  312. package/lib/__templates__/rsbuild/package.json +0 -24
  313. package/lib/__templates__/rsbuild/pnpm-lock.yaml +0 -888
  314. package/lib/__templates__/rsbuild/rsbuild.config.ts +0 -12
  315. package/lib/__templates__/rsbuild/scripts/dev.sh +0 -51
  316. package/lib/__templates__/rsbuild/scripts/start.sh +0 -15
  317. package/lib/__templates__/rsbuild/src/index.html +0 -12
  318. package/lib/__templates__/rsbuild/src/index.ts +0 -5
  319. package/lib/__templates__/rsbuild/src/main.ts +0 -65
  320. package/lib/__templates__/rsbuild/tailwind.config.js +0 -9
  321. package/lib/__templates__/rsbuild/template.config.js +0 -54
  322. package/lib/__templates__/rsbuild/tsconfig.json +0 -16
  323. package/lib/__templates__/vite/.vscode/settings.json +0 -7
  324. /package/lib/__templates__/expo/{eslint-formatter-simple.mjs → client/eslint-formatter-simple.mjs} +0 -0
@@ -8,7 +8,10 @@ cd "${COZE_WORKSPACE_PATH}"
8
8
  echo "Installing dependencies..."
9
9
  pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
10
10
 
11
- echo "Building the project..."
11
+ echo "Building frontend with Vite..."
12
12
  npx vite build
13
13
 
14
+ echo "Bundling server with tsup..."
15
+ npx tsup server/server.ts --format cjs --platform node --target node20 --outDir dist-server --no-splitting --no-minify --external vite
16
+
14
17
  echo "Build completed successfully!"
@@ -1,51 +1,39 @@
1
1
  #!/bin/bash
2
2
  set -Eeuo pipefail
3
3
 
4
+ <% if (process.env.NODE_ENV === 'test') { %>
5
+ # 测试环境:支持环境变量覆盖端口
6
+ PORT="${PORT:-<%= port %>}"
7
+ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
8
+ DEPLOY_RUN_PORT="${DEPLOY_RUN_PORT:-${PORT}}"
9
+ <% } else { %>
4
10
  PORT=<%= port %>
5
11
  COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
12
+ DEPLOY_RUN_PORT=<%= port %>
13
+ <% } %>
6
14
 
7
15
  cd "${COZE_WORKSPACE_PATH}"
8
16
 
9
17
  kill_port_if_listening() {
10
18
  local pids
11
-
12
- # Check if lsof is available (macOS/BSD) or ss (Linux)
13
- if command -v lsof >/dev/null 2>&1; then
14
- # macOS/BSD using lsof
15
- pids=$(lsof -ti:${PORT} 2>/dev/null || true)
16
- elif command -v ss >/dev/null 2>&1; then
17
- # Linux using ss
18
- pids=$(ss -H -lntp 2>/dev/null | awk -v port="${PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
19
- else
20
- echo "Warning: neither lsof nor ss found, cannot check port ${PORT}"
21
- return
22
- fi
23
-
19
+ pids=$(ss -H -lntp 2>/dev/null | awk -v port="${DEPLOY_RUN_PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
24
20
  if [[ -z "${pids}" ]]; then
25
- echo "Port ${PORT} is free."
21
+ echo "Port ${DEPLOY_RUN_PORT} is free."
26
22
  return
27
23
  fi
28
-
29
- echo "Port ${PORT} in use by PIDs: ${pids} (SIGKILL)"
24
+ echo "Port ${DEPLOY_RUN_PORT} in use by PIDs: ${pids} (SIGKILL)"
30
25
  echo "${pids}" | xargs -I {} kill -9 {}
31
26
  sleep 1
32
-
33
- # Verify port is cleared
34
- if command -v lsof >/dev/null 2>&1; then
35
- pids=$(lsof -ti:${PORT} 2>/dev/null || true)
36
- elif command -v ss >/dev/null 2>&1; then
37
- pids=$(ss -H -lntp 2>/dev/null | awk -v port="${PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
38
- fi
39
-
27
+ pids=$(ss -H -lntp 2>/dev/null | awk -v port="${DEPLOY_RUN_PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
40
28
  if [[ -n "${pids}" ]]; then
41
- echo "Warning: port ${PORT} still busy after SIGKILL, PIDs: ${pids}"
29
+ echo "Warning: port ${DEPLOY_RUN_PORT} still busy after SIGKILL, PIDs: ${pids}"
42
30
  else
43
- echo "Port ${PORT} cleared."
31
+ echo "Port ${DEPLOY_RUN_PORT} cleared."
44
32
  fi
45
33
  }
46
34
 
47
35
  echo "Clearing port ${PORT} before start."
48
36
  kill_port_if_listening
49
- echo "Starting HTTP service on port ${PORT} for dev..."
37
+ echo "Starting express + Vite dev server on port ${PORT}..."
50
38
 
51
- npx vite --port $PORT
39
+ PORT=$PORT npx tsx watch server/server.ts
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+ set -Eeuo pipefail
3
+
4
+ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
5
+
6
+ cd "${COZE_WORKSPACE_PATH}"
7
+
8
+ echo "Installing dependencies..."
9
+ pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
@@ -2,14 +2,20 @@
2
2
  set -Eeuo pipefail
3
3
 
4
4
  COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
5
+ <% if (process.env.NODE_ENV === 'test') { %>
6
+ # 测试环境:支持环境变量覆盖端口
7
+ PORT="${PORT:-<%= port %>}"
8
+ DEPLOY_RUN_PORT="${DEPLOY_RUN_PORT:-${PORT}}"
9
+ <% } else { %>
5
10
  PORT=<%= port %>
6
11
  DEPLOY_RUN_PORT="${DEPLOY_RUN_PORT:-$PORT}"
12
+ <% } %>
7
13
 
8
14
  start_service() {
9
15
  cd "${COZE_WORKSPACE_PATH}"
10
- echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for deploy..."
11
- npx vite preview --port $DEPLOY_RUN_PORT
16
+ echo "Starting express production server on port ${DEPLOY_RUN_PORT}..."
17
+ PORT=$DEPLOY_RUN_PORT node dist-server/server.js
12
18
  }
13
19
 
14
- echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for deploy..."
20
+ echo "Starting express production server on port ${DEPLOY_RUN_PORT}..."
15
21
  start_service
@@ -0,0 +1,31 @@
1
+ import { Router } from 'express';
2
+
3
+ const router = Router();
4
+
5
+ // API 路由示例
6
+ router.get('/api/hello', (req, res) => {
7
+ res.json({
8
+ message: 'Hello from Express + Vite!',
9
+ timestamp: new Date().toISOString(),
10
+ });
11
+ });
12
+
13
+ router.post('/api/data', (req, res) => {
14
+ const requestData = req.body;
15
+ res.json({
16
+ success: true,
17
+ data: requestData,
18
+ receivedAt: new Date().toISOString(),
19
+ });
20
+ });
21
+
22
+ // 健康检查接口
23
+ router.get('/api/health', (req, res) => {
24
+ res.json({
25
+ status: 'ok',
26
+ env: process.env.COZE_PROJECT_ENV,
27
+ timestamp: new Date().toISOString(),
28
+ });
29
+ });
30
+
31
+ export default router;
@@ -0,0 +1,65 @@
1
+ // ABOUTME: Express server with Vite integration
2
+ // ABOUTME: Handles API routes and serves frontend in dev/prod modes
3
+
4
+ import { createServer, type Server } from 'http';
5
+ import express from 'express';
6
+ import router from './routes/index';
7
+ import { setupVite } from './vite';
8
+
9
+ const isDev = process.env.COZE_PROJECT_ENV !== 'PROD';
10
+ const port = parseInt(process.env.PORT || '<%= port %>', 10);
11
+ const hostname = process.env.HOSTNAME || 'localhost';
12
+ const app = express();
13
+ // 使用 http.createServer 包装 Express app,以便支持 WebSocket 等协议升级
14
+ const server = createServer(app);
15
+
16
+ async function startServer(): Promise<Server> {
17
+ // 请求日志(仅开发环境)
18
+ if (isDev) {
19
+ app.use((req, res, next) => {
20
+ const start = Date.now();
21
+ res.on('finish', () => {
22
+ const ms = Date.now() - start;
23
+ console.log(`${req.method} ${req.url} - ${ms}ms`);
24
+ });
25
+ next();
26
+ });
27
+ }
28
+
29
+ // 添加请求体解析
30
+ app.use(express.json());
31
+ app.use(express.urlencoded({ extended: true }));
32
+
33
+ // 注册 API 路由
34
+ app.use(router);
35
+
36
+ // 集成 Vite(开发模式)或静态文件服务(生产模式)
37
+ await setupVite(app);
38
+
39
+ // 全局错误处理
40
+ app.use((err: Error, req: express.Request, res: express.Response) => {
41
+ console.error('Server error:', err);
42
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
+ const status = 'status' in err ? (err as any).status || 500 : 500;
44
+ res.status(status).json({
45
+ error: err.message || 'Internal server error',
46
+ });
47
+ });
48
+
49
+ server.once('error', err => {
50
+ console.error('Server error:', err);
51
+ process.exit(1);
52
+ });
53
+
54
+ server.listen(port, () => {
55
+ console.log(`\n✨ Server running at http://${hostname}:${port}`);
56
+ console.log(`📝 Environment: ${isDev ? 'development' : 'production'}\n`);
57
+ });
58
+
59
+ return server;
60
+ }
61
+
62
+ startServer().catch(err => {
63
+ console.error('Failed to start server:', err);
64
+ process.exit(1);
65
+ });
@@ -0,0 +1,67 @@
1
+ // ABOUTME: Vite integration for Express server
2
+ // ABOUTME: Handles dev middleware and production static file serving
3
+
4
+ import type { Application, Request, Response } from 'express';
5
+ import express from 'express';
6
+ import path from 'path';
7
+ import fs from 'fs';
8
+ import { createServer as createViteServer } from 'vite';
9
+ import viteConfig from '../vite.config';
10
+
11
+ const isDev = process.env.COZE_PROJECT_ENV !== 'PROD';
12
+
13
+ /**
14
+ * 集成 Vite 开发服务器(中间件模式)
15
+ */
16
+ export async function setupViteMiddleware(app: Application) {
17
+ const vite = await createViteServer({
18
+ ...viteConfig,
19
+ server: {
20
+ ...viteConfig.server,
21
+ middlewareMode: true,
22
+ },
23
+ appType: 'spa',
24
+ });
25
+
26
+ // 使用 Vite middleware
27
+ app.use(vite.middlewares);
28
+
29
+ console.log('🚀 Vite dev server initialized');
30
+ }
31
+
32
+ /**
33
+ * 设置生产环境静态文件服务
34
+ */
35
+ export function setupStaticServer(app: Application) {
36
+ const distPath = path.resolve(process.cwd(), 'dist');
37
+
38
+ if (!fs.existsSync(distPath)) {
39
+ console.error('❌ dist folder not found. Please run "pnpm build" first.');
40
+ process.exit(1);
41
+ }
42
+
43
+ // 1. 服务静态文件(如果存在对应文件则直接返回)
44
+ app.use(express.static(distPath));
45
+
46
+ // 2. SPA fallback - 所有未处理的请求返回 index.html
47
+ // 到达这里的请求说明:
48
+ // - 不是 API 请求(已被前面注册的路由处理)
49
+ // - 不是静态文件(express.static 未找到对应文件)
50
+ // - 需要返回 index.html 让前端路由处理
51
+ app.use((_req: Request, res: Response) => {
52
+ res.sendFile(path.join(distPath, 'index.html'));
53
+ });
54
+
55
+ console.log('📦 Serving static files from dist/');
56
+ }
57
+
58
+ /**
59
+ * 根据环境设置 Vite
60
+ */
61
+ export async function setupVite(app: Application) {
62
+ if (isDev) {
63
+ await setupViteMiddleware(app);
64
+ } else {
65
+ setupStaticServer(app);
66
+ }
67
+ }
@@ -7,57 +7,26 @@ export function initApp(): void {
7
7
  }
8
8
 
9
9
  app.innerHTML = `
10
- <div class="flex min-h-screen items-center justify-center bg-white text-black transition-colors duration-300 dark:bg-black dark:text-white">
11
- <!-- 主容器 -->
12
- <main class="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between px-16 py-32 sm:items-start">
13
- <!-- 头部:Logo 和 产品名称 -->
14
- <div class="flex items-center gap-3">
10
+ <div class="flex h-full items-center justify-center bg-background text-foreground transition-colors duration-300 dark:bg-background dark:text-foreground overflow-hidden min-h-screen">
11
+ <main class="flex w-full h-full max-w-3xl flex-col items-center justify-center px-16 py-32 sm:items-center">
12
+ <div class="flex flex-col items-center justify-between gap-4">
15
13
  <img
16
- class="dark:invert"
17
- src="https://lf3-static.bytednsdoc.com/obj/eden-cn/hkpzboz/coze_logo.png"
14
+ src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/icon/coze-coding.gif"
18
15
  alt="扣子编程 Logo"
19
- width="40"
20
- height="40"
21
- style="width: 40px; height: 40px; object-fit: contain;"
16
+ width={156}
17
+ height={130}
18
+ style="width: 156px; height: 130px; object-fit: contain;"
22
19
  />
23
- <span class="text-xl font-bold tracking-tight text-black dark:text-zinc-50">
24
- 扣子编程
25
- </span>
26
- </div>
27
-
28
- <!-- 中间内容区:主标题和副标题 -->
29
- <div class="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
30
- <h1 class="max-w-xl text-4xl font-semibold leading-tight tracking-tight text-black dark:text-zinc-50">
31
- 扣子编程,你的 AI 开发伙伴已就位
32
- </h1>
33
- <p class="max-w-2xl text-lg leading-8 text-zinc-600 dark:text-zinc-400">
34
- 当前是空白入口文件,项目正在开发中,请稍候...
35
- <br />
36
- 开发完成后界面将自动更新。如未自动更新成功,可以手动点击右上角刷新或重启按钮查看效果。
37
- </p>
38
- </div>
39
-
40
- <!-- 底部按钮区 -->
41
- <div class="flex w-full flex-col gap-4 text-base font-medium sm:w-auto sm:flex-row">
42
- <!-- 按钮 1:前往首页 -->
43
- <a
44
- class="flex h-12 w-full min-w-[160px] items-center justify-center gap-2 rounded-full bg-black px-8 text-white transition-colors hover:bg-zinc-800 dark:bg-white dark:text-black dark:hover:bg-zinc-200 md:w-auto"
45
- href="https://code.coze.cn/"
46
- target="_blank"
47
- rel="noopener noreferrer"
48
- >
49
- 前往首页
50
- </a>
51
-
52
- <!-- 按钮 2:查看文档 -->
53
- <a
54
- class="flex h-12 w-full min-w-[160px] items-center justify-center rounded-full border border-solid border-black/[.08] px-8 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-auto"
55
- href="https://docs.coze.cn/"
56
- target="_blank"
57
- rel="noopener noreferrer"
58
- >
59
- 查看文档
60
- </a>
20
+ <div>
21
+ <div class="flex flex-col items-center gap-2 text-center sm:items-center sm:text-center">
22
+ <h1 class="max-w-xl text-base font-semibold leading-tight tracking-tight text-foreground dark:text-foreground">
23
+ 应用开发中
24
+ </h1>
25
+ <p class="max-w-2xl text-sm-14 leading-8 text-muted-foreground dark:text-muted-foreground">
26
+ 请稍后,页面即将呈现
27
+ </p>
28
+ </div>
29
+ </div>
61
30
  </div>
62
31
  </main>
63
32
  </div>
@@ -1,4 +1,8 @@
1
1
 
2
+ import { spawn } from 'child_process';
3
+ import { resolve, join, basename } from 'path';
4
+ import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
5
+
2
6
 
3
7
 
4
8
 
@@ -19,36 +23,104 @@ export const paramsSchema = {
19
23
  },
20
24
  port: {
21
25
  type: 'number',
22
- default: 3000,
26
+ default: 5000,
23
27
  minimum: 1024,
24
28
  maximum: 65535,
25
29
  description: 'Development server port',
26
30
  },
31
+ hmrPort: {
32
+ type: 'number',
33
+ default: 6000,
34
+ minimum: 1024,
35
+ maximum: 65535,
36
+ description: 'Development HMR server port',
37
+ },
27
38
  },
28
39
  required: [],
29
40
  additionalProperties: false,
30
41
  };
31
42
 
43
+ const description = `Vite(简单项目):\`coze init \${COZE_WORKSPACE_PATH} --template vite\`
44
+ - 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。`;
45
+
32
46
  const config = {
47
+ description: description,
33
48
  paramsSchema,
34
49
 
35
50
  defaultParams: {
36
- port: 3000,
37
- appName: 'app',
51
+ port: 5000,
52
+ hmrPort: 6000,
53
+ appName: 'projects',
38
54
  },
39
55
 
40
56
  onBeforeRender: async context => {
41
- console.log(`Creating Vanilla TypeScript + Vite project: ${context.appName}`);
57
+ console.log(
58
+ `Creating Vanilla TypeScript + Vite project: ${context.appName}`,
59
+ );
42
60
  return context;
43
61
  },
44
62
 
45
- onAfterRender: async (context, outputPath) => {
63
+ onAfterRender: async (_context, outputPath) => {
46
64
  console.log(`\nProject created at: ${outputPath}`);
47
- console.log(`\nConfiguration:`);
48
- console.log(` - TypeScript: enabled`);
49
- console.log(` - Framework: None (Vanilla JS/TS)`);
50
- console.log(` - Build Tool: Vite`);
51
- console.log(` - Port: ${context.port}`);
65
+ console.log('\nConfiguration:');
66
+ console.log(' - Framework: vite');
67
+ console.log(' - TypeScript: enabled');
68
+ console.log(' - App Router: enabled');
69
+ console.log(` - Port: ${_context.port}`);
70
+ },
71
+
72
+ onComplete: async (_context, outputPath) => {
73
+ // Skip pnpm update in test environment to avoid monorepo workspace issues
74
+ if (process.env.NODE_ENV === 'test') {
75
+ console.log('⊘ Skipping dependency update in test environment');
76
+ return;
77
+ }
78
+
79
+ const cmd = 'pnpm';
80
+ const args = ['update', 'coze-coding-dev-sdk@^0.7.0'];
81
+ console.log(
82
+ `\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
83
+ );
84
+
85
+ try {
86
+ const projectRoot = resolve(outputPath);
87
+
88
+ // Determine log directory
89
+ const logDir = process.env.COZE_LOG_DIR || resolve(__dirname, '../.log');
90
+ mkdirSync(logDir, { recursive: true });
91
+
92
+ // Use project name in log file to avoid conflicts
93
+ const projectName = basename(projectRoot);
94
+ const logFile = join(logDir, `${projectName}-init.log`);
95
+
96
+ // Write log header
97
+ const timestamp = new Date().toISOString();
98
+ appendFileSync(
99
+ logFile,
100
+ `\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
101
+ );
102
+
103
+ // Open log file for appending
104
+ const logFd = openSync(logFile, 'a');
105
+
106
+ // Spawn in detached mode
107
+ const child = spawn(cmd, args, {
108
+ cwd: projectRoot,
109
+ detached: true,
110
+ stdio: ['ignore', logFd, logFd],
111
+ });
112
+
113
+ child.unref();
114
+ closeSync(logFd);
115
+
116
+ console.log(
117
+ '✓ coze-coding-dev-sdk update triggered (running in background)',
118
+ );
119
+ console.log(` Log file: ${logFile}`);
120
+ } catch (error) {
121
+ console.error('✗ Failed to trigger coze-coding-dev-sdk update:', error);
122
+ console.log(' You can manually run: pnpm update coze-coding-dev-sdk');
123
+ }
52
124
  },
53
125
  };
54
126
 
@@ -3,14 +3,15 @@
3
3
  "target": "ES2020",
4
4
  "lib": ["ES2020", "DOM", "DOM.Iterable"],
5
5
  "module": "ESNext",
6
- "moduleResolution": "bundler",
6
+ "moduleResolution": "node",
7
7
  "strict": true,
8
8
  "esModuleInterop": true,
9
9
  "skipLibCheck": true,
10
10
  "forceConsistentCasingInFileNames": true,
11
11
  "resolveJsonModule": true,
12
12
  "isolatedModules": true,
13
- "noEmit": true
13
+ "noEmit": true,
14
+ "types": ["node"]
14
15
  },
15
- "include": ["src"]
16
+ "include": ["src", "server"]
16
17
  }
@@ -1,15 +1,20 @@
1
1
  import { defineConfig } from 'vite';
2
2
 
3
3
  export default defineConfig({
4
- port: '<%= port %>',
5
- host: '0.0.0.0',
6
4
  server: {
5
+ port: <%= port %>,
6
+ host: '0.0.0.0',
7
+ allowedHosts: true,
7
8
  hmr: {
8
9
  overlay: true,
9
10
  path: '/hot/vite-hmr',
10
- port: '<%= port %>',
11
+ port: <%= hmrPort %>,
11
12
  clientPort: 443,
12
13
  timeout: 30000,
13
14
  },
15
+ watch: {
16
+ usePolling: true,
17
+ interval: 100,
18
+ }
14
19
  },
15
20
  });