@coze-arch/cli 0.0.1-alpha.01c0ee

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 (304) hide show
  1. package/README.md +143 -0
  2. package/bin/main +2 -0
  3. package/lib/__templates__/expo/.coze +12 -0
  4. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +46 -0
  5. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +229 -0
  6. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +47 -0
  7. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +34 -0
  8. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
  9. package/lib/__templates__/expo/README.md +74 -0
  10. package/lib/__templates__/expo/_gitignore +11 -0
  11. package/lib/__templates__/expo/_npmrc +20 -0
  12. package/lib/__templates__/expo/client/app/+not-found.tsx +30 -0
  13. package/lib/__templates__/expo/client/app/_layout.tsx +36 -0
  14. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  15. package/lib/__templates__/expo/client/app.config.ts +76 -0
  16. package/lib/__templates__/expo/client/assets/fonts/SpaceMono-Regular.ttf +0 -0
  17. package/lib/__templates__/expo/client/assets/images/adaptive-icon.png +0 -0
  18. package/lib/__templates__/expo/client/assets/images/default-avatar.png +0 -0
  19. package/lib/__templates__/expo/client/assets/images/favicon.png +0 -0
  20. package/lib/__templates__/expo/client/assets/images/icon.png +0 -0
  21. package/lib/__templates__/expo/client/assets/images/partial-react-logo.png +0 -0
  22. package/lib/__templates__/expo/client/assets/images/react-logo.png +0 -0
  23. package/lib/__templates__/expo/client/assets/images/react-logo@2x.png +0 -0
  24. package/lib/__templates__/expo/client/assets/images/react-logo@3x.png +0 -0
  25. package/lib/__templates__/expo/client/assets/images/splash-icon.png +0 -0
  26. package/lib/__templates__/expo/client/components/Screen.tsx +314 -0
  27. package/lib/__templates__/expo/client/components/SmartDateInput.tsx +238 -0
  28. package/lib/__templates__/expo/client/components/ThemedText.tsx +33 -0
  29. package/lib/__templates__/expo/client/components/ThemedView.tsx +37 -0
  30. package/lib/__templates__/expo/client/constants/theme.ts +177 -0
  31. package/lib/__templates__/expo/client/contexts/AuthContext.tsx +49 -0
  32. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  33. package/lib/__templates__/expo/client/eslint-formatter-simple.mjs +49 -0
  34. package/lib/__templates__/expo/client/eslint.config.mjs +128 -0
  35. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
  36. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  37. package/lib/__templates__/expo/client/hooks/useTheme.ts +33 -0
  38. package/lib/__templates__/expo/client/metro.config.js +124 -0
  39. package/lib/__templates__/expo/client/package.json +95 -0
  40. package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
  41. package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
  42. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +105 -0
  43. package/lib/__templates__/expo/client/tsconfig.json +24 -0
  44. package/lib/__templates__/expo/client/utils/index.ts +76 -0
  45. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  46. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  47. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  48. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  49. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/index.js +9 -0
  50. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/rule.js +112 -0
  51. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/tech.md +94 -0
  52. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  53. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  54. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  55. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  56. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/index.js +9 -0
  57. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/rule.js +120 -0
  58. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/tech.md +58 -0
  59. package/lib/__templates__/expo/package.json +25 -0
  60. package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
  61. package/lib/__templates__/expo/pnpm-lock.yaml +12657 -0
  62. package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
  63. package/lib/__templates__/expo/server/build.js +21 -0
  64. package/lib/__templates__/expo/server/package.json +34 -0
  65. package/lib/__templates__/expo/server/src/index.ts +20 -0
  66. package/lib/__templates__/expo/server/tsconfig.json +24 -0
  67. package/lib/__templates__/expo/template.config.js +106 -0
  68. package/lib/__templates__/expo/tsconfig.json +1 -0
  69. package/lib/__templates__/native-static/.coze +11 -0
  70. package/lib/__templates__/native-static/index.html +33 -0
  71. package/lib/__templates__/native-static/styles/main.css +136 -0
  72. package/lib/__templates__/native-static/template.config.js +22 -0
  73. package/lib/__templates__/nextjs/.babelrc +15 -0
  74. package/lib/__templates__/nextjs/.coze +12 -0
  75. package/lib/__templates__/nextjs/README.md +363 -0
  76. package/lib/__templates__/nextjs/_gitignore +99 -0
  77. package/lib/__templates__/nextjs/_npmrc +23 -0
  78. package/lib/__templates__/nextjs/components.json +21 -0
  79. package/lib/__templates__/nextjs/eslint.config.mjs +23 -0
  80. package/lib/__templates__/nextjs/next-env.d.ts +6 -0
  81. package/lib/__templates__/nextjs/next.config.ts +18 -0
  82. package/lib/__templates__/nextjs/package.json +93 -0
  83. package/lib/__templates__/nextjs/pnpm-lock.yaml +12404 -0
  84. package/lib/__templates__/nextjs/postcss.config.mjs +7 -0
  85. package/lib/__templates__/nextjs/public/file.svg +1 -0
  86. package/lib/__templates__/nextjs/public/globe.svg +1 -0
  87. package/lib/__templates__/nextjs/public/next.svg +1 -0
  88. package/lib/__templates__/nextjs/public/vercel.svg +1 -0
  89. package/lib/__templates__/nextjs/public/window.svg +1 -0
  90. package/lib/__templates__/nextjs/scripts/build.sh +17 -0
  91. package/lib/__templates__/nextjs/scripts/dev.sh +39 -0
  92. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  93. package/lib/__templates__/nextjs/scripts/start.sh +21 -0
  94. package/lib/__templates__/nextjs/src/app/favicon.ico +0 -0
  95. package/lib/__templates__/nextjs/src/app/globals.css +137 -0
  96. package/lib/__templates__/nextjs/src/app/layout.tsx +74 -0
  97. package/lib/__templates__/nextjs/src/app/page.tsx +35 -0
  98. package/lib/__templates__/nextjs/src/app/robots.ts +11 -0
  99. package/lib/__templates__/nextjs/src/components/ui/accordion.tsx +66 -0
  100. package/lib/__templates__/nextjs/src/components/ui/alert-dialog.tsx +157 -0
  101. package/lib/__templates__/nextjs/src/components/ui/alert.tsx +66 -0
  102. package/lib/__templates__/nextjs/src/components/ui/aspect-ratio.tsx +11 -0
  103. package/lib/__templates__/nextjs/src/components/ui/avatar.tsx +53 -0
  104. package/lib/__templates__/nextjs/src/components/ui/badge.tsx +46 -0
  105. package/lib/__templates__/nextjs/src/components/ui/breadcrumb.tsx +109 -0
  106. package/lib/__templates__/nextjs/src/components/ui/button-group.tsx +83 -0
  107. package/lib/__templates__/nextjs/src/components/ui/button.tsx +62 -0
  108. package/lib/__templates__/nextjs/src/components/ui/calendar.tsx +220 -0
  109. package/lib/__templates__/nextjs/src/components/ui/card.tsx +92 -0
  110. package/lib/__templates__/nextjs/src/components/ui/carousel.tsx +241 -0
  111. package/lib/__templates__/nextjs/src/components/ui/chart.tsx +357 -0
  112. package/lib/__templates__/nextjs/src/components/ui/checkbox.tsx +32 -0
  113. package/lib/__templates__/nextjs/src/components/ui/collapsible.tsx +33 -0
  114. package/lib/__templates__/nextjs/src/components/ui/command.tsx +184 -0
  115. package/lib/__templates__/nextjs/src/components/ui/context-menu.tsx +252 -0
  116. package/lib/__templates__/nextjs/src/components/ui/dialog.tsx +143 -0
  117. package/lib/__templates__/nextjs/src/components/ui/drawer.tsx +135 -0
  118. package/lib/__templates__/nextjs/src/components/ui/dropdown-menu.tsx +257 -0
  119. package/lib/__templates__/nextjs/src/components/ui/empty.tsx +104 -0
  120. package/lib/__templates__/nextjs/src/components/ui/field.tsx +248 -0
  121. package/lib/__templates__/nextjs/src/components/ui/form.tsx +167 -0
  122. package/lib/__templates__/nextjs/src/components/ui/hover-card.tsx +44 -0
  123. package/lib/__templates__/nextjs/src/components/ui/input-group.tsx +170 -0
  124. package/lib/__templates__/nextjs/src/components/ui/input-otp.tsx +77 -0
  125. package/lib/__templates__/nextjs/src/components/ui/input.tsx +21 -0
  126. package/lib/__templates__/nextjs/src/components/ui/item.tsx +193 -0
  127. package/lib/__templates__/nextjs/src/components/ui/kbd.tsx +28 -0
  128. package/lib/__templates__/nextjs/src/components/ui/label.tsx +24 -0
  129. package/lib/__templates__/nextjs/src/components/ui/menubar.tsx +276 -0
  130. package/lib/__templates__/nextjs/src/components/ui/navigation-menu.tsx +168 -0
  131. package/lib/__templates__/nextjs/src/components/ui/pagination.tsx +127 -0
  132. package/lib/__templates__/nextjs/src/components/ui/popover.tsx +48 -0
  133. package/lib/__templates__/nextjs/src/components/ui/progress.tsx +31 -0
  134. package/lib/__templates__/nextjs/src/components/ui/radio-group.tsx +45 -0
  135. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +63 -0
  136. package/lib/__templates__/nextjs/src/components/ui/scroll-area.tsx +58 -0
  137. package/lib/__templates__/nextjs/src/components/ui/select.tsx +190 -0
  138. package/lib/__templates__/nextjs/src/components/ui/separator.tsx +28 -0
  139. package/lib/__templates__/nextjs/src/components/ui/sheet.tsx +139 -0
  140. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +724 -0
  141. package/lib/__templates__/nextjs/src/components/ui/skeleton.tsx +13 -0
  142. package/lib/__templates__/nextjs/src/components/ui/slider.tsx +63 -0
  143. package/lib/__templates__/nextjs/src/components/ui/sonner.tsx +40 -0
  144. package/lib/__templates__/nextjs/src/components/ui/spinner.tsx +16 -0
  145. package/lib/__templates__/nextjs/src/components/ui/switch.tsx +31 -0
  146. package/lib/__templates__/nextjs/src/components/ui/table.tsx +116 -0
  147. package/lib/__templates__/nextjs/src/components/ui/tabs.tsx +66 -0
  148. package/lib/__templates__/nextjs/src/components/ui/textarea.tsx +18 -0
  149. package/lib/__templates__/nextjs/src/components/ui/toggle-group.tsx +83 -0
  150. package/lib/__templates__/nextjs/src/components/ui/toggle.tsx +47 -0
  151. package/lib/__templates__/nextjs/src/components/ui/tooltip.tsx +61 -0
  152. package/lib/__templates__/nextjs/src/hooks/use-mobile.ts +19 -0
  153. package/lib/__templates__/nextjs/src/lib/utils.ts +6 -0
  154. package/lib/__templates__/nextjs/src/server.ts +35 -0
  155. package/lib/__templates__/nextjs/template.config.js +120 -0
  156. package/lib/__templates__/nextjs/tsconfig.json +34 -0
  157. package/lib/__templates__/nuxt-vue/.coze +12 -0
  158. package/lib/__templates__/nuxt-vue/README.md +73 -0
  159. package/lib/__templates__/nuxt-vue/_gitignore +24 -0
  160. package/lib/__templates__/nuxt-vue/_npmrc +23 -0
  161. package/lib/__templates__/nuxt-vue/app/app.vue +6 -0
  162. package/lib/__templates__/nuxt-vue/app/pages/index.vue +23 -0
  163. package/lib/__templates__/nuxt-vue/assets/css/main.css +24 -0
  164. package/lib/__templates__/nuxt-vue/nuxt.config.ts +116 -0
  165. package/lib/__templates__/nuxt-vue/package.json +35 -0
  166. package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8759 -0
  167. package/lib/__templates__/nuxt-vue/postcss.config.mjs +8 -0
  168. package/lib/__templates__/nuxt-vue/public/favicon.ico +0 -0
  169. package/lib/__templates__/nuxt-vue/public/robots.txt +2 -0
  170. package/lib/__templates__/nuxt-vue/scripts/build.sh +14 -0
  171. package/lib/__templates__/nuxt-vue/scripts/dev.sh +39 -0
  172. package/lib/__templates__/nuxt-vue/scripts/prepare.sh +14 -0
  173. package/lib/__templates__/nuxt-vue/scripts/start.sh +21 -0
  174. package/lib/__templates__/nuxt-vue/server/api/hello.ts +10 -0
  175. package/lib/__templates__/nuxt-vue/server/middleware/logger.ts +10 -0
  176. package/lib/__templates__/nuxt-vue/server/routes/health.ts +10 -0
  177. package/lib/__templates__/nuxt-vue/tailwind.config.js +13 -0
  178. package/lib/__templates__/nuxt-vue/template.config.js +87 -0
  179. package/lib/__templates__/nuxt-vue/tsconfig.json +18 -0
  180. package/lib/__templates__/taro/.coze +14 -0
  181. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
  182. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
  183. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
  184. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
  185. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
  186. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -0
  187. package/lib/__templates__/taro/README.md +763 -0
  188. package/lib/__templates__/taro/_gitignore +40 -0
  189. package/lib/__templates__/taro/_npmrc +18 -0
  190. package/lib/__templates__/taro/babel.config.js +12 -0
  191. package/lib/__templates__/taro/config/dev.ts +9 -0
  192. package/lib/__templates__/taro/config/index.ts +237 -0
  193. package/lib/__templates__/taro/config/prod.ts +34 -0
  194. package/lib/__templates__/taro/eslint.config.mjs +135 -0
  195. package/lib/__templates__/taro/key/private.appid.key +0 -0
  196. package/lib/__templates__/taro/package.json +112 -0
  197. package/lib/__templates__/taro/patches/@tarojs__plugin-mini-ci@4.1.9.patch +30 -0
  198. package/lib/__templates__/taro/pnpm-lock.yaml +23412 -0
  199. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  200. package/lib/__templates__/taro/project.config.json +15 -0
  201. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  202. package/lib/__templates__/taro/server/package.json +40 -0
  203. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  204. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  205. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  206. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  207. package/lib/__templates__/taro/server/src/main.ts +49 -0
  208. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  209. package/lib/__templates__/taro/src/app.config.ts +11 -0
  210. package/lib/__templates__/taro/src/app.css +156 -0
  211. package/lib/__templates__/taro/src/app.tsx +9 -0
  212. package/lib/__templates__/taro/src/components/ui/accordion.tsx +159 -0
  213. package/lib/__templates__/taro/src/components/ui/alert-dialog.tsx +260 -0
  214. package/lib/__templates__/taro/src/components/ui/alert.tsx +60 -0
  215. package/lib/__templates__/taro/src/components/ui/aspect-ratio.tsx +36 -0
  216. package/lib/__templates__/taro/src/components/ui/avatar.tsx +84 -0
  217. package/lib/__templates__/taro/src/components/ui/badge.tsx +37 -0
  218. package/lib/__templates__/taro/src/components/ui/breadcrumb.tsx +117 -0
  219. package/lib/__templates__/taro/src/components/ui/button-group.tsx +83 -0
  220. package/lib/__templates__/taro/src/components/ui/button.tsx +67 -0
  221. package/lib/__templates__/taro/src/components/ui/calendar.tsx +394 -0
  222. package/lib/__templates__/taro/src/components/ui/card.tsx +108 -0
  223. package/lib/__templates__/taro/src/components/ui/carousel.tsx +228 -0
  224. package/lib/__templates__/taro/src/components/ui/checkbox.tsx +58 -0
  225. package/lib/__templates__/taro/src/components/ui/code-block.tsx +169 -0
  226. package/lib/__templates__/taro/src/components/ui/collapsible.tsx +71 -0
  227. package/lib/__templates__/taro/src/components/ui/command.tsx +385 -0
  228. package/lib/__templates__/taro/src/components/ui/context-menu.tsx +614 -0
  229. package/lib/__templates__/taro/src/components/ui/dialog.tsx +256 -0
  230. package/lib/__templates__/taro/src/components/ui/drawer.tsx +192 -0
  231. package/lib/__templates__/taro/src/components/ui/dropdown-menu.tsx +561 -0
  232. package/lib/__templates__/taro/src/components/ui/field.tsx +228 -0
  233. package/lib/__templates__/taro/src/components/ui/hover-card.tsx +282 -0
  234. package/lib/__templates__/taro/src/components/ui/input-group.tsx +197 -0
  235. package/lib/__templates__/taro/src/components/ui/input-otp.tsx +136 -0
  236. package/lib/__templates__/taro/src/components/ui/input.tsx +56 -0
  237. package/lib/__templates__/taro/src/components/ui/label.tsx +24 -0
  238. package/lib/__templates__/taro/src/components/ui/menubar.tsx +595 -0
  239. package/lib/__templates__/taro/src/components/ui/navigation-menu.tsx +264 -0
  240. package/lib/__templates__/taro/src/components/ui/pagination.tsx +118 -0
  241. package/lib/__templates__/taro/src/components/ui/popover.tsx +291 -0
  242. package/lib/__templates__/taro/src/components/ui/portal.tsx +19 -0
  243. package/lib/__templates__/taro/src/components/ui/progress.tsx +28 -0
  244. package/lib/__templates__/taro/src/components/ui/radio-group.tsx +64 -0
  245. package/lib/__templates__/taro/src/components/ui/resizable.tsx +346 -0
  246. package/lib/__templates__/taro/src/components/ui/scroll-area.tsx +34 -0
  247. package/lib/__templates__/taro/src/components/ui/select.tsx +438 -0
  248. package/lib/__templates__/taro/src/components/ui/separator.tsx +30 -0
  249. package/lib/__templates__/taro/src/components/ui/sheet.tsx +262 -0
  250. package/lib/__templates__/taro/src/components/ui/skeleton.tsx +17 -0
  251. package/lib/__templates__/taro/src/components/ui/slider.tsx +203 -0
  252. package/lib/__templates__/taro/src/components/ui/sonner.tsx +1 -0
  253. package/lib/__templates__/taro/src/components/ui/switch.tsx +55 -0
  254. package/lib/__templates__/taro/src/components/ui/table.tsx +142 -0
  255. package/lib/__templates__/taro/src/components/ui/tabs.tsx +114 -0
  256. package/lib/__templates__/taro/src/components/ui/textarea.tsx +54 -0
  257. package/lib/__templates__/taro/src/components/ui/toast.tsx +517 -0
  258. package/lib/__templates__/taro/src/components/ui/toggle-group.tsx +120 -0
  259. package/lib/__templates__/taro/src/components/ui/toggle.tsx +77 -0
  260. package/lib/__templates__/taro/src/components/ui/tooltip.tsx +455 -0
  261. package/lib/__templates__/taro/src/index.html +39 -0
  262. package/lib/__templates__/taro/src/lib/hooks/use-keyboard-offset.ts +37 -0
  263. package/lib/__templates__/taro/src/lib/measure.ts +115 -0
  264. package/lib/__templates__/taro/src/lib/platform.ts +12 -0
  265. package/lib/__templates__/taro/src/lib/utils.ts +6 -0
  266. package/lib/__templates__/taro/src/network.ts +39 -0
  267. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  268. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  269. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  270. package/lib/__templates__/taro/src/presets/dev-debug.ts +23 -0
  271. package/lib/__templates__/taro/src/presets/h5-container.tsx +15 -0
  272. package/lib/__templates__/taro/src/presets/h5-navbar.tsx +238 -0
  273. package/lib/__templates__/taro/src/presets/h5-styles.ts +220 -0
  274. package/lib/__templates__/taro/src/presets/index.tsx +18 -0
  275. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  276. package/lib/__templates__/taro/template.config.js +68 -0
  277. package/lib/__templates__/taro/tsconfig.json +29 -0
  278. package/lib/__templates__/taro/types/global.d.ts +32 -0
  279. package/lib/__templates__/templates.json +162 -0
  280. package/lib/__templates__/vite/.coze +12 -0
  281. package/lib/__templates__/vite/README.md +418 -0
  282. package/lib/__templates__/vite/_gitignore +67 -0
  283. package/lib/__templates__/vite/_npmrc +23 -0
  284. package/lib/__templates__/vite/eslint.config.mjs +14 -0
  285. package/lib/__templates__/vite/index.html +13 -0
  286. package/lib/__templates__/vite/package.json +44 -0
  287. package/lib/__templates__/vite/pnpm-lock.yaml +3465 -0
  288. package/lib/__templates__/vite/postcss.config.js +6 -0
  289. package/lib/__templates__/vite/scripts/build.sh +17 -0
  290. package/lib/__templates__/vite/scripts/dev.sh +39 -0
  291. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  292. package/lib/__templates__/vite/scripts/start.sh +21 -0
  293. package/lib/__templates__/vite/server/routes/index.ts +31 -0
  294. package/lib/__templates__/vite/server/server.ts +65 -0
  295. package/lib/__templates__/vite/server/vite.ts +67 -0
  296. package/lib/__templates__/vite/src/index.css +21 -0
  297. package/lib/__templates__/vite/src/index.ts +5 -0
  298. package/lib/__templates__/vite/src/main.ts +34 -0
  299. package/lib/__templates__/vite/tailwind.config.js +9 -0
  300. package/lib/__templates__/vite/template.config.js +127 -0
  301. package/lib/__templates__/vite/tsconfig.json +17 -0
  302. package/lib/__templates__/vite/vite.config.ts +20 -0
  303. package/lib/cli.js +2631 -0
  304. package/package.json +81 -0
@@ -0,0 +1,30 @@
1
+ import { View, Text, StyleSheet } from 'react-native';
2
+ import { Link } from 'expo-router';
3
+ import { useTheme } from '@/hooks/useTheme';
4
+ import { Spacing } from '@/constants/theme';
5
+
6
+ export default function NotFoundScreen() {
7
+ const { theme } = useTheme();
8
+
9
+ return (
10
+ <View style={[styles.container, { backgroundColor: theme.backgroundRoot }]}>
11
+ <Text>
12
+ 页面不存在
13
+ </Text>
14
+ <Link href="/" style={[styles.gohome]}>
15
+ 返回首页
16
+ </Link>
17
+ </View>
18
+ );
19
+ }
20
+
21
+ const styles = StyleSheet.create({
22
+ container: {
23
+ flex: 1,
24
+ justifyContent: 'center',
25
+ alignItems: 'center',
26
+ },
27
+ gohome: {
28
+ marginTop: Spacing['2xl'],
29
+ },
30
+ });
@@ -0,0 +1,36 @@
1
+ import { useEffect } from 'react';
2
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
3
+ import { Stack } from 'expo-router';
4
+ import { StatusBar } from 'expo-status-bar';
5
+ import { LogBox } from 'react-native';
6
+ import Toast from 'react-native-toast-message';
7
+ import { AuthProvider } from "@/contexts/AuthContext";
8
+ import { ColorSchemeProvider } from '@/hooks/useColorScheme';
9
+
10
+ LogBox.ignoreLogs([
11
+ "TurboModuleRegistry.getEnforcing(...): 'RNMapsAirModule' could not be found",
12
+ // 添加其它想暂时忽略的错误或警告信息
13
+ ]);
14
+
15
+ export default function RootLayout() {
16
+ return (
17
+ <AuthProvider>
18
+ <ColorSchemeProvider>
19
+ <GestureHandlerRootView style={{ flex: 1 }}>
20
+ <StatusBar style="dark"></StatusBar>
21
+ <Stack screenOptions={{
22
+ // 设置所有页面的切换动画为从右侧滑入,适用于iOS 和 Android
23
+ animation: 'slide_from_right',
24
+ gestureEnabled: true,
25
+ gestureDirection: 'horizontal',
26
+ // 隐藏自带的头部
27
+ headerShown: false
28
+ }}>
29
+ <Stack.Screen name="index" options={{ title: "" }} />
30
+ </Stack>
31
+ <Toast />
32
+ </GestureHandlerRootView>
33
+ </ColorSchemeProvider>
34
+ </AuthProvider>
35
+ );
36
+ }
@@ -0,0 +1 @@
1
+ export { default } from '@/screens/demo';
@@ -0,0 +1,76 @@
1
+ import { ExpoConfig, ConfigContext } from 'expo/config';
2
+
3
+ const appName = process.env.COZE_PROJECT_NAME || process.env.EXPO_PUBLIC_COZE_PROJECT_NAME || '应用';
4
+ const projectId = process.env.COZE_PROJECT_ID || process.env.EXPO_PUBLIC_COZE_PROJECT_ID;
5
+ const slugAppName = projectId ? `app${projectId}` : 'myapp';
6
+
7
+ export default ({ config }: ConfigContext): ExpoConfig => {
8
+ return {
9
+ ...config,
10
+ "name": appName,
11
+ "slug": slugAppName,
12
+ "version": "1.0.0",
13
+ "orientation": "portrait",
14
+ "icon": "./assets/images/icon.png",
15
+ "scheme": "myapp",
16
+ "userInterfaceStyle": "automatic",
17
+ "newArchEnabled": true,
18
+ "ios": {
19
+ "supportsTablet": true
20
+ },
21
+ "android": {
22
+ "adaptiveIcon": {
23
+ "foregroundImage": "./assets/images/adaptive-icon.png",
24
+ "backgroundColor": "#ffffff"
25
+ },
26
+ "package": `com.anonymous.x${projectId || '0'}`
27
+ },
28
+ "web": {
29
+ "bundler": "metro",
30
+ "output": "single",
31
+ "favicon": "./assets/images/favicon.png"
32
+ },
33
+ "plugins": [
34
+ process.env.EXPO_PUBLIC_BACKEND_BASE_URL ? [
35
+ "expo-router",
36
+ {
37
+ "origin": process.env.EXPO_PUBLIC_BACKEND_BASE_URL
38
+ }
39
+ ] : 'expo-router',
40
+ [
41
+ "expo-splash-screen",
42
+ {
43
+ "image": "./assets/images/splash-icon.png",
44
+ "imageWidth": 200,
45
+ "resizeMode": "contain",
46
+ "backgroundColor": "#ffffff"
47
+ }
48
+ ],
49
+ [
50
+ "expo-image-picker",
51
+ {
52
+ "photosPermission": `允许${appName}访问您的相册,以便您上传或保存图片。`,
53
+ "cameraPermission": `允许${appName}使用您的相机,以便您直接拍摄照片上传。`,
54
+ "microphonePermission": `允许${appName}访问您的麦克风,以便您拍摄带有声音的视频。`
55
+ }
56
+ ],
57
+ [
58
+ "expo-location",
59
+ {
60
+ "locationWhenInUsePermission": `${appName}需要访问您的位置以提供周边服务及导航功能。`
61
+ }
62
+ ],
63
+ [
64
+ "expo-camera",
65
+ {
66
+ "cameraPermission": `${appName}需要访问相机以拍摄照片和视频。`,
67
+ "microphonePermission": `${appName}需要访问麦克风以录制视频声音。`,
68
+ "recordAudioAndroid": true
69
+ }
70
+ ]
71
+ ],
72
+ "experiments": {
73
+ "typedRoutes": true
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,314 @@
1
+ import React, { useEffect } from 'react';
2
+ import {
3
+ Platform,
4
+ StyleSheet,
5
+ ScrollView,
6
+ View,
7
+ TouchableWithoutFeedback,
8
+ Keyboard,
9
+ ViewStyle,
10
+ FlatList,
11
+ SectionList,
12
+ Modal,
13
+ } from 'react-native';
14
+ import { useSafeAreaInsets, Edge } from 'react-native-safe-area-context';
15
+ import { StatusBar } from 'expo-status-bar';
16
+ // 引入 KeyboardAware 系列组件
17
+ import {
18
+ KeyboardAwareScrollView,
19
+ KeyboardAwareFlatList,
20
+ KeyboardAwareSectionList
21
+ } from 'react-native-keyboard-aware-scroll-view';
22
+
23
+ /**
24
+ * # Screen 组件使用指南
25
+ *
26
+ * 核心原则:统一使用手动安全区管理 (padding),支持沉浸式布局,解决 iOS/Android 状态栏一致性问题。
27
+ *
28
+ * ## 1. 普通页面 (默认)
29
+ * - 场景:标准的白底或纯色背景页面,Header 在安全区下方。
30
+ * - 用法:`<Screen>{children}</Screen>`
31
+ * - 行为:自动处理上下左右安全区,状态栏文字黑色。
32
+ *
33
+ * ## 2. 沉浸式 Header (推荐)
34
+ * - 场景:Header 背景色/图片需要延伸到状态栏 (如首页、个人中心)。
35
+ * - 用法:`<Screen safeAreaEdges={['left', 'right', 'bottom']}>` (去掉 'top')
36
+ * - 配合:页面内部 Header 组件必须手动添加 paddingTop:
37
+ * ```tsx
38
+ * const insets = useSafeAreaInsets();
39
+ * <View style={{ paddingTop: insets.top + 12, backgroundColor: '...' }}>
40
+ * ```
41
+ *
42
+ * ## 3. 底部有 TabBar 或 悬浮按钮
43
+ * - 场景:页面底部有固定导航栏,或者需要精细控制底部留白。
44
+ * - 用法:`<Screen safeAreaEdges={['top', 'left', 'right']}>` (去掉 'bottom')
45
+ * - 配合:
46
+ * - 若是滚动页:`<ScrollView contentContainerStyle={{ paddingBottom: insets.bottom + 80 }}>`
47
+ * - 若是固定页:`<View style={{ paddingBottom: insets.bottom + 60 }}>`
48
+ *
49
+ * ## 4. 滚动列表/表单
50
+ * - 场景:长内容,需要键盘避让。
51
+ * - 用法:`<Screen>{children}</Screen>`
52
+ * - 行为:若子树不包含 ScrollView/FlatList/SectionList,则外层自动使用 ScrollView,
53
+ * 自动处理键盘遮挡,底部安全区会自动加在内容末尾。
54
+ */
55
+ interface ScreenProps {
56
+ children: React.ReactNode;
57
+ /** 背景色,默认 #fff */
58
+ backgroundColor?: string;
59
+ /**
60
+ * 状态栏样式
61
+ * - 'dark': 黑色文字 (默认)
62
+ * - 'light': 白色文字 (深色背景时用)
63
+ */
64
+ statusBarStyle?: 'auto' | 'inverted' | 'light' | 'dark';
65
+ /**
66
+ * 状态栏背景色
67
+ * - 默认 'transparent' 以支持沉浸式
68
+ * - Android 下如果需要不透明,可传入具体颜色
69
+ */
70
+ statusBarColor?: string;
71
+ /**
72
+ * 安全区控制 (关键属性)
73
+ * - 默认: ['top', 'left', 'right', 'bottom'] (全避让)
74
+ * - 沉浸式 Header: 去掉 'top'
75
+ * - 自定义底部: 去掉 'bottom'
76
+ */
77
+ safeAreaEdges?: Edge[];
78
+ /** 自定义容器样式 */
79
+ style?: ViewStyle;
80
+ }
81
+
82
+ type KeyboardAwareProps = {
83
+ element: React.ReactElement<any, any>;
84
+ extraPadding: number;
85
+ contentInsetBehaviorIOS: 'automatic' | 'never';
86
+ };
87
+
88
+ const KeyboardAwareScrollable = ({
89
+ element,
90
+ extraPadding,
91
+ contentInsetBehaviorIOS,
92
+ }: KeyboardAwareProps) => {
93
+ // 获取原始组件的 props
94
+ const childAttrs: any = (element as any).props || {};
95
+ const originStyle = childAttrs['contentContainerStyle'];
96
+ const styleArray = Array.isArray(originStyle) ? originStyle : originStyle ? [originStyle] : [];
97
+ const merged = Object.assign({}, ...styleArray);
98
+ const currentPB = typeof merged.paddingBottom === 'number' ? merged.paddingBottom : 0;
99
+
100
+ // 合并 paddingBottom (安全区 + 额外留白)
101
+ const enhancedContentStyle = [{ ...merged, paddingBottom: currentPB + extraPadding }];
102
+
103
+ // 基础配置 props,用于传递给 KeyboardAware 组件
104
+ const commonProps = {
105
+ ...childAttrs,
106
+ contentContainerStyle: enhancedContentStyle,
107
+ keyboardShouldPersistTaps: childAttrs['keyboardShouldPersistTaps'] ?? 'handled',
108
+ keyboardDismissMode: childAttrs['keyboardDismissMode'] ?? 'on-drag',
109
+ enableOnAndroid: true,
110
+ // 类似于原代码中的 setTimeout/scrollToEnd 逻辑,这里设置额外的滚动高度确保输入框可见
111
+ extraHeight: 100,
112
+ // 禁用自带的 ScrollView 自动 inset,由外部 padding 控制
113
+ enableAutomaticScroll: true,
114
+ ...(Platform.OS === 'ios'
115
+ ? { contentInsetAdjustmentBehavior: childAttrs['contentInsetAdjustmentBehavior'] ?? contentInsetBehaviorIOS }
116
+ : {}),
117
+ };
118
+
119
+ const t = (element as any).type;
120
+
121
+ // 根据组件类型返回对应的 KeyboardAware 版本
122
+ // 注意:不再使用 KeyboardAvoidingView,直接替换为增强版 ScrollView
123
+ if (t === ScrollView) {
124
+ return <KeyboardAwareScrollView {...commonProps} />;
125
+ }
126
+
127
+ if (t === FlatList) {
128
+ return <KeyboardAwareFlatList {...commonProps} />;
129
+ }
130
+
131
+ if (t === SectionList) {
132
+ return <KeyboardAwareSectionList {...commonProps} />;
133
+ }
134
+
135
+ // 理论上不应运行到这里,如果是非标准组件则原样返回,仅修改样式
136
+ return React.cloneElement(element, {
137
+ contentContainerStyle: enhancedContentStyle,
138
+ keyboardShouldPersistTaps: childAttrs['keyboardShouldPersistTaps'] ?? 'handled',
139
+ keyboardDismissMode: childAttrs['keyboardDismissMode'] ?? 'on-drag',
140
+ });
141
+ };
142
+
143
+ export const Screen = ({
144
+ children,
145
+ backgroundColor = '#fff',
146
+ statusBarStyle = 'dark',
147
+ statusBarColor = 'transparent',
148
+ safeAreaEdges = ['top', 'left', 'right', 'bottom'],
149
+ style,
150
+ }: ScreenProps) => {
151
+ const insets = useSafeAreaInsets();
152
+ const [keyboardShown, setKeyboardShown] = React.useState(false);
153
+
154
+ useEffect(() => {
155
+ const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
156
+ const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
157
+ const s1 = Keyboard.addListener(showEvent, () => setKeyboardShown(true));
158
+ const s2 = Keyboard.addListener(hideEvent, () => setKeyboardShown(false));
159
+ return () => { s1.remove(); s2.remove(); };
160
+ }, []);
161
+
162
+ // 自动检测:若子树中包含 ScrollView/FlatList/SectionList,则认为页面自身处理滚动
163
+ const isNodeScrollable = (node: React.ReactNode): boolean => {
164
+ const isScrollableElement = (el: unknown): boolean => {
165
+ if (!React.isValidElement(el)) return false;
166
+ const element = el as React.ReactElement<any, any>;
167
+ const t = element.type;
168
+ // 不递归检查 Modal 内容,避免将弹窗内的 ScrollView 误判为页面已具备垂直滚动
169
+ if (t === Modal) return false;
170
+ const props = element.props as Record<string, unknown> | undefined;
171
+ // 仅识别“垂直”滚动容器;横向滚动不视为页面已处理垂直滚动
172
+ // eslint-disable-next-line react/prop-types
173
+ const isHorizontal = !!(props && (props as any).horizontal === true);
174
+ if ((t === ScrollView || t === FlatList || t === SectionList) && !isHorizontal) return true;
175
+ const c: React.ReactNode | undefined = props && 'children' in props
176
+ ? (props.children as React.ReactNode)
177
+ : undefined;
178
+ if (Array.isArray(c)) return c.some(isScrollableElement);
179
+ return c ? isScrollableElement(c) : false;
180
+ };
181
+ if (Array.isArray(node)) return node.some(isScrollableElement);
182
+ return isScrollableElement(node);
183
+ };
184
+
185
+ const childIsNativeScrollable = isNodeScrollable(children);
186
+
187
+ // 说明:避免双重补白
188
+ // KeyboardAwareScrollView 内部会自动处理键盘高度。
189
+ // 我们主要关注非键盘状态下的 Safe Area 管理。
190
+
191
+ // 解析安全区设置
192
+ const hasTop = safeAreaEdges.includes('top');
193
+ const hasBottom = safeAreaEdges.includes('bottom');
194
+ const hasLeft = safeAreaEdges.includes('left');
195
+ const hasRight = safeAreaEdges.includes('right');
196
+
197
+ // 强制禁用 iOS 自动调整内容区域,完全由手动 padding 控制,消除系统自动计算带来的多余空白
198
+ const contentInsetBehaviorIOS = 'never';
199
+
200
+ const wrapperStyle: ViewStyle = {
201
+ flex: 1,
202
+ backgroundColor,
203
+ paddingTop: hasTop ? insets.top : 0,
204
+ paddingLeft: hasLeft ? insets.left : 0,
205
+ paddingRight: hasRight ? insets.right : 0,
206
+ // 当页面不使用外层 ScrollView 时(子树本身可滚动),由外层 View 负责底部安全区
207
+ paddingBottom: (childIsNativeScrollable && hasBottom)
208
+ ? (keyboardShown ? 0 : insets.bottom)
209
+ : 0,
210
+ };
211
+
212
+ // 若子树不可滚动,则外层使用 KeyboardAwareScrollView 提供“全局页面滑动”能力
213
+ const useScrollContainer = !childIsNativeScrollable;
214
+
215
+ // 2. 滚动容器配置
216
+ // 如果使用滚动容器,则使用 KeyboardAwareScrollView 替代原有的 ScrollView
217
+ const Container = useScrollContainer ? KeyboardAwareScrollView : View;
218
+
219
+ const containerProps = useScrollContainer ? {
220
+ contentContainerStyle: {
221
+ flexGrow: 1,
222
+ // 滚动模式下,Bottom 安全区由内容容器处理,保证内容能完整显示且不被 Home Indicator 遮挡,同时背景色能延伸到底部
223
+ paddingBottom: hasBottom ? (keyboardShown ? 0 : insets.bottom) : 0,
224
+ },
225
+ keyboardShouldPersistTaps: 'handled' as const,
226
+ showsVerticalScrollIndicator: false,
227
+ keyboardDismissMode: 'on-drag' as const,
228
+ enableOnAndroid: true,
229
+ extraHeight: 100, // 替代原代码手动计算的 offset
230
+ // iOS 顶部白条修复:强制不自动添加顶部安全区
231
+ ...(Platform.OS === 'ios'
232
+ ? { contentInsetAdjustmentBehavior: contentInsetBehaviorIOS }
233
+ : {}),
234
+ } : {};
235
+
236
+ // 3. 若子元素自身包含滚动容器,给该滚动容器单独添加键盘避让,不影响其余固定元素(如底部栏)
237
+ const wrapScrollableWithKeyboardAvoid = (nodes: React.ReactNode): React.ReactNode => {
238
+ const isVerticalScrollable = (el: React.ReactElement<any, any>): boolean => {
239
+ const t = el.type;
240
+ const elementProps = (el as any).props || {};
241
+ const isHorizontal = !!(elementProps as any).horizontal;
242
+ return (t === ScrollView || t === FlatList || t === SectionList) && !isHorizontal;
243
+ };
244
+
245
+ const wrapIfNeeded = (el: React.ReactElement<any, any>, idx?: number): React.ReactElement => {
246
+ if (isVerticalScrollable(el)) {
247
+ return (
248
+ <KeyboardAwareScrollable
249
+ key={el.key ?? idx}
250
+ element={el}
251
+ extraPadding={keyboardShown ? 0 : (hasBottom ? insets.bottom : 0)}
252
+ contentInsetBehaviorIOS={contentInsetBehaviorIOS}
253
+ />
254
+ );
255
+ }
256
+ return el;
257
+ };
258
+
259
+ if (Array.isArray(nodes)) {
260
+ return nodes.map((n, idx) => {
261
+ if (React.isValidElement(n)) {
262
+ return wrapIfNeeded(n as React.ReactElement<any, any>, idx);
263
+ }
264
+ return n;
265
+ });
266
+ }
267
+ if (React.isValidElement(nodes)) {
268
+ return wrapIfNeeded(nodes as React.ReactElement<any, any>, 0);
269
+ }
270
+ return nodes;
271
+ };
272
+
273
+ return (
274
+ // 核心原则:严禁使用 SafeAreaView,统一使用 View + padding 手动管理
275
+ <View style={wrapperStyle}>
276
+ {/* 状态栏配置:强制透明背景 + 沉浸式,以支持背景图延伸 */}
277
+ <StatusBar
278
+ style={statusBarStyle}
279
+ backgroundColor={statusBarColor}
280
+ translucent
281
+ />
282
+
283
+ {/* 键盘避让:仅当外层使用 ScrollView 时启用,避免固定底部栏随键盘上移 */}
284
+ {useScrollContainer ? (
285
+ // 替换为 KeyboardAwareScrollView,移除原先的 KeyboardAvoidingView 包裹
286
+ // 因为 KeyboardAwareScrollView 已经内置了处理逻辑
287
+ <Container style={[styles.innerContainer, style]} {...containerProps}>
288
+ {children}
289
+ </Container>
290
+ ) : (
291
+ // 页面自身已处理滚动,不启用全局键盘避让,保证固定底部栏不随键盘上移
292
+ childIsNativeScrollable ? (
293
+ <View style={[styles.innerContainer, style]}>
294
+ {wrapScrollableWithKeyboardAvoid(children)}
295
+ </View>
296
+ ) : (
297
+ <TouchableWithoutFeedback onPress={Keyboard.dismiss} disabled={Platform.OS === 'web'}>
298
+ <View style={[styles.innerContainer, style]}>
299
+ {children}
300
+ </View>
301
+ </TouchableWithoutFeedback>
302
+ )
303
+ )}
304
+ </View>
305
+ );
306
+ };
307
+
308
+ const styles = StyleSheet.create({
309
+ innerContainer: {
310
+ flex: 1,
311
+ // 确保内部容器透明,避免背景色遮挡
312
+ backgroundColor: 'transparent',
313
+ },
314
+ });