@coze-arch/cli 0.0.1-alpha.de6c14 → 0.0.1-alpha.deaedf

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 (235) hide show
  1. package/README.md +1 -0
  2. package/lib/__templates__/expo/.coze +1 -1
  3. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +19 -82
  4. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +82 -88
  5. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +2 -2
  6. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +3 -4
  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__/expo/_npmrc +2 -4
  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 +3 -19
  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 +116 -67
  19. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  20. package/lib/__templates__/expo/{eslint.config.mjs → client/eslint.config.mjs} +40 -10
  21. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
  22. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  23. package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
  24. package/lib/__templates__/expo/client/metro.config.js +124 -0
  25. package/lib/__templates__/expo/client/package.json +95 -0
  26. package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
  27. package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
  28. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +11 -10
  29. package/lib/__templates__/expo/client/tsconfig.json +24 -0
  30. package/lib/__templates__/expo/client/utils/index.ts +22 -0
  31. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  32. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  33. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  34. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  35. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/index.js +9 -0
  36. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/rule.js +112 -0
  37. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/tech.md +94 -0
  38. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  39. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  40. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  41. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  42. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/index.js +9 -0
  43. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/rule.js +120 -0
  44. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/tech.md +58 -0
  45. package/lib/__templates__/expo/package.json +11 -107
  46. package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
  47. package/lib/__templates__/expo/pnpm-lock.yaml +1437 -3171
  48. package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
  49. package/lib/__templates__/expo/server/build.js +21 -0
  50. package/lib/__templates__/expo/server/package.json +34 -0
  51. package/lib/__templates__/expo/server/src/index.ts +20 -0
  52. package/lib/__templates__/expo/server/tsconfig.json +24 -0
  53. package/lib/__templates__/expo/template.config.js +57 -0
  54. package/lib/__templates__/expo/tsconfig.json +1 -24
  55. package/lib/__templates__/native-static/.coze +11 -0
  56. package/lib/__templates__/native-static/index.html +33 -0
  57. package/lib/__templates__/native-static/styles/main.css +136 -0
  58. package/lib/__templates__/native-static/template.config.js +22 -0
  59. package/lib/__templates__/nextjs/.babelrc +15 -0
  60. package/lib/__templates__/nextjs/.coze +1 -0
  61. package/lib/__templates__/nextjs/README.md +5 -0
  62. package/lib/__templates__/nextjs/_npmrc +1 -0
  63. package/lib/__templates__/nextjs/eslint.config.mjs +5 -0
  64. package/lib/__templates__/nextjs/next.config.ts +11 -0
  65. package/lib/__templates__/nextjs/package.json +10 -2
  66. package/lib/__templates__/nextjs/pnpm-lock.yaml +3488 -1569
  67. package/lib/__templates__/nextjs/scripts/build.sh +4 -1
  68. package/lib/__templates__/nextjs/scripts/dev.sh +8 -2
  69. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  70. package/lib/__templates__/nextjs/scripts/start.sh +7 -1
  71. package/lib/__templates__/nextjs/src/app/globals.css +10 -2
  72. package/lib/__templates__/nextjs/src/app/layout.tsx +5 -14
  73. package/lib/__templates__/nextjs/src/app/page.tsx +18 -49
  74. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
  75. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
  76. package/lib/__templates__/nextjs/src/server.ts +35 -0
  77. package/lib/__templates__/nextjs/template.config.js +67 -2
  78. package/lib/__templates__/nextjs/tsconfig.json +1 -1
  79. package/lib/__templates__/nuxt-vue/.coze +12 -0
  80. package/lib/__templates__/nuxt-vue/README.md +73 -0
  81. package/lib/__templates__/nuxt-vue/_gitignore +24 -0
  82. package/lib/__templates__/nuxt-vue/_npmrc +23 -0
  83. package/lib/__templates__/nuxt-vue/app/app.vue +6 -0
  84. package/lib/__templates__/nuxt-vue/app/pages/index.vue +23 -0
  85. package/lib/__templates__/nuxt-vue/assets/css/main.css +24 -0
  86. package/lib/__templates__/nuxt-vue/nuxt.config.ts +116 -0
  87. package/lib/__templates__/nuxt-vue/package.json +35 -0
  88. package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8759 -0
  89. package/lib/__templates__/nuxt-vue/postcss.config.mjs +8 -0
  90. package/lib/__templates__/nuxt-vue/public/favicon.ico +0 -0
  91. package/lib/__templates__/nuxt-vue/public/robots.txt +2 -0
  92. package/lib/__templates__/nuxt-vue/scripts/build.sh +14 -0
  93. package/lib/__templates__/nuxt-vue/scripts/dev.sh +39 -0
  94. package/lib/__templates__/nuxt-vue/scripts/prepare.sh +14 -0
  95. package/lib/__templates__/nuxt-vue/scripts/start.sh +21 -0
  96. package/lib/__templates__/nuxt-vue/server/api/hello.ts +10 -0
  97. package/lib/__templates__/nuxt-vue/server/middleware/logger.ts +10 -0
  98. package/lib/__templates__/nuxt-vue/server/routes/health.ts +10 -0
  99. package/lib/__templates__/nuxt-vue/tailwind.config.js +13 -0
  100. package/lib/__templates__/nuxt-vue/template.config.js +87 -0
  101. package/lib/__templates__/nuxt-vue/tsconfig.json +18 -0
  102. package/lib/__templates__/taro/.coze +14 -0
  103. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
  104. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
  105. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
  106. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
  107. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
  108. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -0
  109. package/lib/__templates__/taro/README.md +763 -0
  110. package/lib/__templates__/taro/_gitignore +40 -0
  111. package/lib/__templates__/taro/_npmrc +18 -0
  112. package/lib/__templates__/taro/babel.config.js +12 -0
  113. package/lib/__templates__/taro/config/dev.ts +9 -0
  114. package/lib/__templates__/taro/config/index.ts +237 -0
  115. package/lib/__templates__/taro/config/prod.ts +34 -0
  116. package/lib/__templates__/taro/eslint.config.mjs +135 -0
  117. package/lib/__templates__/taro/key/private.appid.key +0 -0
  118. package/lib/__templates__/taro/package.json +112 -0
  119. package/lib/__templates__/taro/patches/@tarojs__plugin-mini-ci@4.1.9.patch +30 -0
  120. package/lib/__templates__/taro/pnpm-lock.yaml +23412 -0
  121. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  122. package/lib/__templates__/taro/project.config.json +15 -0
  123. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  124. package/lib/__templates__/taro/server/package.json +40 -0
  125. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  126. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  127. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  128. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  129. package/lib/__templates__/taro/server/src/main.ts +49 -0
  130. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  131. package/lib/__templates__/taro/src/app.config.ts +11 -0
  132. package/lib/__templates__/taro/src/app.css +156 -0
  133. package/lib/__templates__/taro/src/app.tsx +9 -0
  134. package/lib/__templates__/taro/src/components/ui/accordion.tsx +159 -0
  135. package/lib/__templates__/taro/src/components/ui/alert-dialog.tsx +260 -0
  136. package/lib/__templates__/taro/src/components/ui/alert.tsx +60 -0
  137. package/lib/__templates__/taro/src/components/ui/aspect-ratio.tsx +36 -0
  138. package/lib/__templates__/taro/src/components/ui/avatar.tsx +84 -0
  139. package/lib/__templates__/taro/src/components/ui/badge.tsx +37 -0
  140. package/lib/__templates__/taro/src/components/ui/breadcrumb.tsx +117 -0
  141. package/lib/__templates__/taro/src/components/ui/button-group.tsx +83 -0
  142. package/lib/__templates__/taro/src/components/ui/button.tsx +67 -0
  143. package/lib/__templates__/taro/src/components/ui/calendar.tsx +394 -0
  144. package/lib/__templates__/taro/src/components/ui/card.tsx +108 -0
  145. package/lib/__templates__/taro/src/components/ui/carousel.tsx +228 -0
  146. package/lib/__templates__/taro/src/components/ui/checkbox.tsx +58 -0
  147. package/lib/__templates__/taro/src/components/ui/code-block.tsx +169 -0
  148. package/lib/__templates__/taro/src/components/ui/collapsible.tsx +71 -0
  149. package/lib/__templates__/taro/src/components/ui/command.tsx +385 -0
  150. package/lib/__templates__/taro/src/components/ui/context-menu.tsx +614 -0
  151. package/lib/__templates__/taro/src/components/ui/dialog.tsx +256 -0
  152. package/lib/__templates__/taro/src/components/ui/drawer.tsx +192 -0
  153. package/lib/__templates__/taro/src/components/ui/dropdown-menu.tsx +561 -0
  154. package/lib/__templates__/taro/src/components/ui/field.tsx +228 -0
  155. package/lib/__templates__/taro/src/components/ui/hover-card.tsx +282 -0
  156. package/lib/__templates__/taro/src/components/ui/input-group.tsx +197 -0
  157. package/lib/__templates__/taro/src/components/ui/input-otp.tsx +136 -0
  158. package/lib/__templates__/taro/src/components/ui/input.tsx +56 -0
  159. package/lib/__templates__/taro/src/components/ui/label.tsx +24 -0
  160. package/lib/__templates__/taro/src/components/ui/menubar.tsx +595 -0
  161. package/lib/__templates__/taro/src/components/ui/navigation-menu.tsx +264 -0
  162. package/lib/__templates__/taro/src/components/ui/pagination.tsx +118 -0
  163. package/lib/__templates__/taro/src/components/ui/popover.tsx +291 -0
  164. package/lib/__templates__/taro/src/components/ui/portal.tsx +19 -0
  165. package/lib/__templates__/taro/src/components/ui/progress.tsx +28 -0
  166. package/lib/__templates__/taro/src/components/ui/radio-group.tsx +64 -0
  167. package/lib/__templates__/taro/src/components/ui/resizable.tsx +346 -0
  168. package/lib/__templates__/taro/src/components/ui/scroll-area.tsx +34 -0
  169. package/lib/__templates__/taro/src/components/ui/select.tsx +438 -0
  170. package/lib/__templates__/taro/src/components/ui/separator.tsx +30 -0
  171. package/lib/__templates__/taro/src/components/ui/sheet.tsx +262 -0
  172. package/lib/__templates__/taro/src/components/ui/skeleton.tsx +17 -0
  173. package/lib/__templates__/taro/src/components/ui/slider.tsx +203 -0
  174. package/lib/__templates__/taro/src/components/ui/sonner.tsx +1 -0
  175. package/lib/__templates__/taro/src/components/ui/switch.tsx +55 -0
  176. package/lib/__templates__/taro/src/components/ui/table.tsx +142 -0
  177. package/lib/__templates__/taro/src/components/ui/tabs.tsx +114 -0
  178. package/lib/__templates__/taro/src/components/ui/textarea.tsx +54 -0
  179. package/lib/__templates__/taro/src/components/ui/toast.tsx +517 -0
  180. package/lib/__templates__/taro/src/components/ui/toggle-group.tsx +120 -0
  181. package/lib/__templates__/taro/src/components/ui/toggle.tsx +77 -0
  182. package/lib/__templates__/taro/src/components/ui/tooltip.tsx +455 -0
  183. package/lib/__templates__/taro/src/index.html +39 -0
  184. package/lib/__templates__/taro/src/lib/hooks/use-keyboard-offset.ts +37 -0
  185. package/lib/__templates__/taro/src/lib/measure.ts +115 -0
  186. package/lib/__templates__/taro/src/lib/platform.ts +12 -0
  187. package/lib/__templates__/taro/src/lib/utils.ts +6 -0
  188. package/lib/__templates__/taro/src/network.ts +39 -0
  189. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  190. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  191. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  192. package/lib/__templates__/taro/src/presets/dev-debug.ts +23 -0
  193. package/lib/__templates__/taro/src/presets/h5-container.tsx +15 -0
  194. package/lib/__templates__/taro/src/presets/h5-navbar.tsx +238 -0
  195. package/lib/__templates__/taro/src/presets/h5-styles.ts +220 -0
  196. package/lib/__templates__/taro/src/presets/index.tsx +18 -0
  197. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  198. package/lib/__templates__/taro/template.config.js +68 -0
  199. package/lib/__templates__/taro/tsconfig.json +29 -0
  200. package/lib/__templates__/taro/types/global.d.ts +32 -0
  201. package/lib/__templates__/templates.json +136 -43
  202. package/lib/__templates__/vite/.coze +1 -0
  203. package/lib/__templates__/vite/README.md +190 -11
  204. package/lib/__templates__/vite/_gitignore +1 -0
  205. package/lib/__templates__/vite/_npmrc +1 -0
  206. package/lib/__templates__/vite/eslint.config.mjs +14 -0
  207. package/lib/__templates__/vite/package.json +22 -2
  208. package/lib/__templates__/vite/pnpm-lock.yaml +2398 -182
  209. package/lib/__templates__/vite/scripts/build.sh +4 -1
  210. package/lib/__templates__/vite/scripts/dev.sh +9 -2
  211. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  212. package/lib/__templates__/vite/scripts/start.sh +9 -3
  213. package/lib/__templates__/vite/server/routes/index.ts +31 -0
  214. package/lib/__templates__/vite/server/server.ts +65 -0
  215. package/lib/__templates__/vite/server/vite.ts +67 -0
  216. package/lib/__templates__/vite/src/main.ts +17 -48
  217. package/lib/__templates__/vite/template.config.js +67 -6
  218. package/lib/__templates__/vite/tsconfig.json +4 -3
  219. package/lib/__templates__/vite/vite.config.ts +5 -0
  220. package/lib/cli.js +1084 -225
  221. package/package.json +12 -4
  222. package/lib/__templates__/expo/app.json +0 -63
  223. package/lib/__templates__/expo/babel.config.js +0 -19
  224. package/lib/__templates__/expo/client/app/(tabs)/_layout.tsx +0 -43
  225. package/lib/__templates__/expo/client/app/(tabs)/home.tsx +0 -1
  226. package/lib/__templates__/expo/client/app/(tabs)/index.tsx +0 -7
  227. package/lib/__templates__/expo/client/hooks/useColorScheme.ts +0 -1
  228. package/lib/__templates__/expo/client/index.js +0 -12
  229. package/lib/__templates__/expo/client/screens/home/index.tsx +0 -51
  230. package/lib/__templates__/expo/client/screens/home/styles.ts +0 -60
  231. package/lib/__templates__/expo/metro.config.js +0 -51
  232. package/lib/__templates__/expo/src/index.ts +0 -12
  233. package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
  234. package/lib/__templates__/vite/.vscode/settings.json +0 -7
  235. /package/lib/__templates__/expo/{eslint-formatter-simple.mjs → client/eslint-formatter-simple.mjs} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze-arch/cli",
3
- "version": "0.0.1-alpha.de6c14",
3
+ "version": "0.0.1-alpha.deaedf",
4
4
  "private": false,
5
5
  "description": "coze coding devtools cli",
6
6
  "license": "MIT",
@@ -19,12 +19,13 @@
19
19
  "scripts": {
20
20
  "prebuild": "tsx scripts/prebuild.ts",
21
21
  "build": "tsx scripts/build.ts",
22
+ "create": "tsx scripts/create-template.ts",
22
23
  "lint": "eslint ./ --cache",
23
24
  "postpublish": "bash scripts/sync-npmmirror.sh",
24
25
  "test": "vitest --run --passWithNoTests",
25
26
  "test:all": "bash scripts/test-coverage.sh",
26
27
  "test:cov": "vitest --run --passWithNoTests --coverage",
27
- "test:e2e": "bash scripts/e2e.sh",
28
+ "test:e2e": "NODE_ENV=test bash scripts/e2e.sh",
28
29
  "test:perf": "vitest bench --run --config vitest.perf.config.ts",
29
30
  "test:perf:compare": "bash scripts/compare-perf.sh",
30
31
  "test:perf:save": "bash scripts/run-perf-with-output.sh"
@@ -48,18 +49,25 @@
48
49
  "@coze-arch/ts-config": "workspace:*",
49
50
  "@coze-arch/vitest-config": "workspace:*",
50
51
  "@coze-coding/lambda": "workspace:*",
52
+ "@inquirer/prompts": "^3.2.0",
53
+ "@playwright/test": "~1.55.0",
51
54
  "@types/ejs": "^3.1.5",
52
55
  "@types/iarna__toml": "^2.0.5",
53
56
  "@types/js-yaml": "^4.0.9",
57
+ "@types/minimatch": "^5.1.2",
54
58
  "@types/minimist": "^1.2.5",
55
59
  "@types/node": "^24",
56
60
  "@types/shelljs": "^0.10.0",
57
- "@vitest/coverage-v8": "~4.0.16",
61
+ "@vitest/coverage-v8": "~4.0.18",
58
62
  "json-schema-to-typescript": "^15.0.3",
63
+ "minimatch": "^10.0.1",
64
+ "playwright": "~1.55.0",
59
65
  "rollup": "^4.41.1",
60
66
  "sucrase": "^3.35.0",
67
+ "tree-kill": "^1.2.2",
61
68
  "tsx": "^4.20.6",
62
- "vitest": "~4.0.16"
69
+ "vite-tsconfig-paths": "^4.2.1",
70
+ "vitest": "~4.0.18"
63
71
  },
64
72
  "publishConfig": {
65
73
  "access": "public",
@@ -1,63 +0,0 @@
1
- {
2
- "expo": {
3
- "name": "${app_name}",
4
- "slug": "${slug}",
5
- "version": "1.0.0",
6
- "orientation": "portrait",
7
- "icon": "./client/assets/images/icon.png",
8
- "scheme": "myapp",
9
- "userInterfaceStyle": "automatic",
10
- "newArchEnabled": true,
11
- "ios": {
12
- "supportsTablet": true
13
- },
14
- "android": {
15
- "adaptiveIcon": {
16
- "foregroundImage": "./client/assets/images/adaptive-icon.png",
17
- "backgroundColor": "#ffffff"
18
- }
19
- },
20
- "web": {
21
- "bundler": "metro",
22
- "output": "single",
23
- "favicon": "./client/assets/images/favicon.png"
24
- },
25
- "plugins": [
26
- "expo-router",
27
- [
28
- "expo-splash-screen",
29
- {
30
- "image": "./client/assets/images/splash-icon.png",
31
- "imageWidth": 200,
32
- "resizeMode": "contain",
33
- "backgroundColor": "#ffffff"
34
- }
35
- ],
36
- [
37
- "expo-image-picker",
38
- {
39
- "photosPermission": "允许${app_name}访问您的相册,以便您上传或保存图片。",
40
- "cameraPermission": "允许${app_name}使用您的相机,以便您直接拍摄照片上传。",
41
- "microphonePermission": "允许${app_name}访问您的麦克风,以便您拍摄带有声音的视频。"
42
- }
43
- ],
44
- [
45
- "expo-location",
46
- {
47
- "locationWhenInUsePermission": "${app_name}需要访问您的位置以提供周边服务及导航功能。"
48
- }
49
- ],
50
- [
51
- "expo-camera",
52
- {
53
- "cameraPermission": "${app_name}需要访问相机以拍摄照片和视频。",
54
- "microphonePermission": "${app_name}需要访问麦克风以录制视频声音。",
55
- "recordAudioAndroid": true
56
- }
57
- ]
58
- ],
59
- "experiments": {
60
- "typedRoutes": true
61
- }
62
- }
63
- }
@@ -1,19 +0,0 @@
1
- module.exports = function (api) {
2
- api.cache(true);
3
- return {
4
- presets: ["babel-preset-expo"],
5
- plugins: [
6
- [
7
- "module-resolver",
8
- {
9
- root: ["./"],
10
- alias: {
11
- "@": "./client",
12
- },
13
- extensions: [".ios.js", ".android.js", ".js", ".ts", ".tsx", ".json"],
14
- },
15
- ],
16
- "react-native-reanimated/plugin",
17
- ],
18
- };
19
- };
@@ -1,43 +0,0 @@
1
- import { Tabs } from 'expo-router';
2
- import { FontAwesome6 } from '@expo/vector-icons';
3
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
- import { useTheme } from '@/hooks/useTheme';
5
-
6
- export default function TabLayout() {
7
- const insets = useSafeAreaInsets();
8
- const { theme } = useTheme();
9
- const tabBarHeight = 56 + Math.max(insets.bottom, 8);
10
-
11
- return (
12
- <Tabs
13
- backBehavior='history'
14
- screenOptions={{
15
- headerShown: false,
16
- tabBarActiveTintColor: theme.tabIconSelected,
17
- tabBarInactiveTintColor: theme.tabIconDefault,
18
- tabBarStyle: {
19
- backgroundColor: theme.backgroundRoot,
20
- borderTopColor: theme.backgroundSecondary,
21
- borderTopWidth: 1,
22
- height: tabBarHeight,
23
- paddingBottom: Math.max(insets.bottom, 8),
24
- paddingTop: 6,
25
- },
26
- }}
27
- >
28
- <Tabs.Screen
29
- name='index'
30
- options={{ href: null }}
31
- />
32
- <Tabs.Screen
33
- name='home'
34
- options={{
35
- title: '首页',
36
- tabBarIcon: ({ color }) => (
37
- <FontAwesome6 name='house' size={20} color={color} />
38
- ),
39
- }}
40
- />
41
- </Tabs>
42
- );
43
- }
@@ -1 +0,0 @@
1
- export { default } from "@/screens/home";
@@ -1,7 +0,0 @@
1
- import { Redirect } from 'expo-router';
2
-
3
- const Index = () => {
4
- return <Redirect href="./home" relativeToDirectory />;
5
- };
6
-
7
- export default Index;
@@ -1 +0,0 @@
1
- export { useColorScheme } from "react-native";
@@ -1,12 +0,0 @@
1
- import '@expo/metro-runtime';
2
- import { registerRootComponent } from 'expo';
3
- import { ExpoRoot } from 'expo-router';
4
-
5
- // 显式定义 App 组件
6
- export function App() {
7
- // eslint-disable-next-line no-undef
8
- const ctx = require.context('./app');
9
- return <ExpoRoot context={ctx} />;
10
- }
11
-
12
- registerRootComponent(App);
@@ -1,51 +0,0 @@
1
- import React, { useState, useCallback } from 'react';
2
- import {
3
- View,
4
- Text,
5
- ScrollView,
6
- RefreshControl,
7
- } from 'react-native';
8
- import { useRouter, useFocusEffect } from 'expo-router';
9
- import { FontAwesome6 } from '@expo/vector-icons';
10
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
11
- import { useTheme } from "@/hooks/useTheme";
12
-
13
- import { Screen } from '@/components/Screen';
14
-
15
- import { styles } from './styles';
16
-
17
-
18
- export default function HomeScreen() {
19
- const insets = useSafeAreaInsets();
20
- const { theme, isDark } = useTheme();
21
-
22
- const [isRefreshing, setIsRefreshing] = useState(false);
23
-
24
- const loadData = useCallback(async () => {
25
- }, []);
26
-
27
- useFocusEffect(
28
- useCallback(() => {
29
- loadData();
30
- }, [loadData])
31
- );
32
-
33
- const handleRefresh = useCallback(() => {
34
- setIsRefreshing(true);
35
- loadData();
36
- }, [loadData]);
37
- return (
38
- <Screen backgroundColor={theme.backgroundRoot} statusBarStyle={isDark ? 'light' : 'dark'}>
39
- <ScrollView
40
- showsVerticalScrollIndicator={false}
41
- contentContainerStyle={{}}
42
- refreshControl={
43
- <RefreshControl refreshing={isRefreshing} onRefresh={handleRefresh} colors={['#2563EB']} />
44
- }
45
- >
46
- <View style={[styles.header]}>
47
- </View>
48
- </ScrollView>
49
- </Screen>
50
- );
51
- }
@@ -1,60 +0,0 @@
1
- import { StyleSheet, Platform } from 'react-native';
2
-
3
- export const styles = StyleSheet.create({
4
- loadingContainer: {
5
- flex: 1,
6
- justifyContent: 'center',
7
- alignItems: 'center',
8
- },
9
- loadingText: {
10
- marginTop: 12,
11
- fontSize: 14,
12
- color: '#64748B',
13
- },
14
- errorContainer: {
15
- flex: 1,
16
- justifyContent: 'center',
17
- alignItems: 'center',
18
- paddingHorizontal: 24,
19
- },
20
- errorText: {
21
- marginTop: 16,
22
- fontSize: 16,
23
- color: '#64748B',
24
- },
25
- header: {
26
- flexDirection: 'row',
27
- justifyContent: 'space-between',
28
- alignItems: 'center',
29
- paddingHorizontal: 16,
30
- // paddingBottom: 16,
31
- backgroundColor: '#FFFFFF',
32
- // borderBottomWidth: 1,
33
- borderBottomColor: '#E2E8F0',
34
- },
35
- logoContainer: {
36
- width: 32,
37
- height: 32,
38
- backgroundColor: '#2563EB',
39
- borderRadius: 8,
40
- justifyContent: 'center',
41
- alignItems: 'center',
42
- ...Platform.select({
43
- ios: {
44
- shadowColor: '#000',
45
- shadowOffset: { width: 0, height: 1 },
46
- shadowOpacity: 0.1,
47
- shadowRadius: 2,
48
- },
49
- android: {
50
- elevation: 2,
51
- },
52
- }),
53
- },
54
- logoText: {
55
- fontSize: 18,
56
- fontWeight: '700',
57
- color: '#1E293B',
58
- letterSpacing: -0.5,
59
- },
60
- });
@@ -1,51 +0,0 @@
1
- const { getDefaultConfig } = require('expo/metro-config');
2
- const { createProxyMiddleware } = require('http-proxy-middleware');
3
- const connect = require('connect');
4
-
5
- const config = getDefaultConfig(__dirname);
6
-
7
- // 安全地获取 Expo 的默认排除列表
8
- const existingBlockList = [].concat(config.resolver.blockList || []);
9
-
10
- config.resolver.blockList = [
11
- ...existingBlockList,
12
- /.*\/\.expo\/.*/, // Expo 的缓存和构建产物目录
13
-
14
- // 1. 原生代码 (Java/C++/Objective-C)
15
- /.*\/react-native\/ReactAndroid\/.*/,
16
- /.*\/react-native\/ReactCommon\/.*/,
17
-
18
- // 2. 纯开发和调试工具
19
- // 这些工具只在开发电脑上运行,不会被打包到应用中
20
- /.*\/@typescript-eslint\/eslint-plugin\/.*/,
21
-
22
- // 3. 构建时数据
23
- // 这个数据库只在打包过程中使用,应用运行时不需要
24
- /.*\/caniuse-lite\/data\/.*/,
25
-
26
- // 4. 通用规则
27
- /.*\/__tests__\/.*/, // 排除所有测试目录
28
- /.*\.git\/.*/, // 排除 Git 目录
29
- ];
30
-
31
- const apiProxy = createProxyMiddleware({
32
- target: 'http://localhost:9091',
33
- logLevel: 'debug',
34
- });
35
-
36
- config.server = {
37
- ...config.server,
38
- enhanceMiddleware: (metroMiddleware, metroServer) => {
39
- return connect()
40
- .use((req, res, next) => {
41
- if (req.url && req.url.startsWith('/api/v')) {
42
- console.log(`[Metro Proxy] Forwarding ${req.method} ${req.url}`);
43
- return apiProxy(req, res, next);
44
- }
45
- next();
46
- })
47
- .use(metroMiddleware);
48
- },
49
- }
50
-
51
- module.exports = config;
@@ -1,12 +0,0 @@
1
- import express from "express";
2
-
3
- const app = express();
4
- const port = process.env.PORT || 9091;
5
-
6
- app.get('/api/v1/ping', (req, res) => {
7
- res.status(200).json({ message: 'connected' });
8
- });
9
-
10
- app.listen(port, () => {
11
- console.log(`Server listening at http://localhost:${port}/`);
12
- });
@@ -1,121 +0,0 @@
1
- {
2
- "[css]": {
3
- "editor.defaultFormatter": "esbenp.prettier-vscode"
4
- },
5
- "[dotenv]": {
6
- "editor.defaultFormatter": "foxundermoon.shell-format"
7
- },
8
- "[html]": {
9
- "editor.defaultFormatter": "esbenp.prettier-vscode"
10
- },
11
- "[ignore]": {
12
- "editor.defaultFormatter": "foxundermoon.shell-format"
13
- },
14
- "[javascript]": {
15
- "editor.defaultFormatter": "esbenp.prettier-vscode"
16
- },
17
- "[javascriptreact]": {
18
- "editor.defaultFormatter": "esbenp.prettier-vscode"
19
- },
20
- "[json]": {
21
- "editor.defaultFormatter": "esbenp.prettier-vscode"
22
- },
23
- "[jsonc]": {
24
- "editor.defaultFormatter": "esbenp.prettier-vscode"
25
- },
26
- "[less]": {
27
- "editor.defaultFormatter": "stylelint.vscode-stylelint"
28
- },
29
- "[scss]": {
30
- "editor.defaultFormatter": "esbenp.prettier-vscode"
31
- },
32
- "[shellscript]": {
33
- "editor.defaultFormatter": "foxundermoon.shell-format"
34
- },
35
- "[sql]": {
36
- "editor.defaultFormatter": "adpyke.vscode-sql-formatter"
37
- },
38
- "[svg]": {
39
- "editor.defaultFormatter": "jock.svg"
40
- },
41
- "[typescript]": {
42
- "editor.defaultFormatter": "esbenp.prettier-vscode"
43
- },
44
- "[typescriptreact]": {
45
- "editor.defaultFormatter": "esbenp.prettier-vscode"
46
- },
47
- "[xml]": {
48
- "editor.defaultFormatter": "mblode.pretty-formatter"
49
- },
50
- "[yaml]": {
51
- "editor.defaultFormatter": "esbenp.prettier-vscode"
52
- },
53
- "cSpell.diagnosticLevel": "Warning",
54
- "css.validate": false,
55
- "editor.codeActionsOnSave": {
56
- "source.fixAll": "never",
57
- "source.fixAll.eslint": "explicit",
58
- "source.organizeImports": "never",
59
- "source.removeUnused": "never",
60
- "source.removeUnused.ts": "never",
61
- "source.removeUnusedImports": "never",
62
- "source.sort.json": "never"
63
- // "source.sortImports": "always"
64
- },
65
- "editor.defaultFormatter": "esbenp.prettier-vscode",
66
- "editor.formatOnPaste": false,
67
- "editor.formatOnSave": true,
68
- "editor.formatOnType": false,
69
- "editor.insertSpaces": true,
70
- "editor.minimap.enabled": true,
71
- //
72
- "editor.rulers": [80, 120],
73
- "editor.semanticHighlighting.enabled": false,
74
- "editor.tabSize": 2,
75
- "emmet.triggerExpansionOnTab": true,
76
- "files.associations": {
77
- ".babelrc": "json",
78
- ".code-workspace": "jsonc",
79
- ".eslintrc": "jsonc",
80
- ".eslintrc*.json": "jsonc",
81
- ".htmlhintrc": "jsonc",
82
- ".stylelintrc": "javascript",
83
- "*.json": "jsonc",
84
- "*.log": "plaintext",
85
- "*.map": "plaintext",
86
- "**/coverage/**/*.*": "plaintext",
87
- "**/pnpm-lock.yaml": "plaintext",
88
- "htmlhintrc": "jsonc",
89
- "package.json": "json",
90
- "README": "markdown",
91
- "stylelintrc": "jsonc",
92
- ".coze": "toml"
93
- },
94
- "files.defaultLanguage": "plaintext",
95
- "files.eol": "\n",
96
- "files.exclude": {
97
- "**/.DS_Store": true,
98
- "**/.git": true,
99
- "**/.hg": true,
100
- "**/.svn": true,
101
- // "**/.lintcache": true,
102
- "**/.swc": true,
103
- "**/CVS": true,
104
- "**/Thumbs.db": true
105
- },
106
- "files.insertFinalNewline": true,
107
- "files.trimTrailingWhitespace": true,
108
- "files.watcherExclude": {
109
- "**/.git/objects/**": true,
110
- "**/.git/subtree-cache/**": true,
111
- "**/node_modules/*/**": true
112
- },
113
- "git.openRepositoryInParentFolders": "always",
114
- "search.exclude": {
115
- "**/dist": true,
116
- "**/node_modules": true
117
- },
118
- // "editor.formatOnSaveMode": "modificationsIfAvailable",
119
- "search.followSymlinks": false,
120
- "search.useIgnoreFiles": true
121
- }
@@ -1,7 +0,0 @@
1
- {
2
- "editor.formatOnSave": true,
3
- "editor.codeActionsOnSave": {
4
- "source.fixAll.eslint": "explicit"
5
- },
6
- "typescript.tsdk": "node_modules/typescript/lib"
7
- }