@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.
- package/README.md +1 -0
- package/lib/__templates__/expo/.coze +7 -2
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +46 -0
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +229 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +47 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +34 -0
- package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
- package/lib/__templates__/expo/README.md +68 -7
- package/lib/__templates__/expo/_gitignore +1 -1
- package/lib/__templates__/{react-rsbuild → expo}/_npmrc +4 -5
- package/lib/__templates__/expo/client/app/+not-found.tsx +15 -64
- package/lib/__templates__/expo/client/app/_layout.tsx +15 -12
- package/lib/__templates__/expo/client/app/index.tsx +1 -0
- package/lib/__templates__/expo/client/app.config.ts +76 -0
- package/lib/__templates__/expo/client/components/Screen.tsx +22 -38
- package/lib/__templates__/expo/client/components/ThemedText.tsx +33 -0
- package/lib/__templates__/expo/client/components/ThemedView.tsx +37 -0
- package/lib/__templates__/expo/client/constants/theme.ts +117 -58
- package/lib/__templates__/expo/client/contexts/AuthContext.tsx +14 -107
- package/lib/__templates__/expo/client/declarations.d.ts +5 -0
- package/lib/__templates__/expo/{eslint.config.mjs → client/eslint.config.mjs} +40 -10
- package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
- package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
- package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
- package/lib/__templates__/expo/client/metro.config.js +124 -0
- package/lib/__templates__/expo/client/package.json +95 -0
- package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
- package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
- package/lib/__templates__/expo/client/scripts/install-missing-deps.js +47 -22
- package/lib/__templates__/expo/client/tsconfig.json +24 -0
- package/lib/__templates__/expo/client/utils/index.ts +23 -2
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
- package/lib/__templates__/expo/eslint-plugins/forbid-emoji/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/forbid-emoji/rule.js +112 -0
- package/lib/__templates__/expo/eslint-plugins/forbid-emoji/tech.md +94 -0
- package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
- package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
- package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/rule.js +120 -0
- package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/tech.md +58 -0
- package/lib/__templates__/expo/package.json +16 -91
- package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
- package/lib/__templates__/expo/pnpm-lock.yaml +1805 -3126
- package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
- package/lib/__templates__/expo/server/build.js +21 -0
- package/lib/__templates__/expo/server/package.json +34 -0
- package/lib/__templates__/expo/server/src/index.ts +20 -0
- package/lib/__templates__/expo/server/tsconfig.json +24 -0
- package/lib/__templates__/expo/template.config.js +58 -1
- package/lib/__templates__/expo/tsconfig.json +1 -24
- package/lib/__templates__/native-static/.coze +11 -0
- package/lib/__templates__/native-static/index.html +33 -0
- package/lib/__templates__/native-static/styles/main.css +136 -0
- package/lib/__templates__/native-static/template.config.js +22 -0
- package/lib/__templates__/nextjs/.babelrc +15 -0
- package/lib/__templates__/nextjs/.coze +4 -3
- package/lib/__templates__/nextjs/README.md +346 -19
- package/lib/__templates__/nextjs/_npmrc +2 -1
- package/lib/__templates__/nextjs/components.json +21 -0
- package/lib/__templates__/nextjs/eslint.config.mjs +5 -0
- package/lib/__templates__/nextjs/next.config.ts +11 -0
- package/lib/__templates__/nextjs/package.json +63 -2
- package/lib/__templates__/nextjs/pnpm-lock.yaml +10053 -1710
- package/lib/__templates__/nextjs/scripts/build.sh +4 -1
- package/lib/__templates__/nextjs/scripts/dev.sh +15 -27
- package/lib/__templates__/{react-rsbuild/scripts/build.sh → nextjs/scripts/prepare.sh} +0 -5
- package/lib/__templates__/nextjs/scripts/start.sh +7 -1
- package/lib/__templates__/nextjs/src/app/globals.css +124 -13
- package/lib/__templates__/nextjs/src/app/layout.tsx +56 -16
- package/lib/__templates__/nextjs/src/app/page.tsx +18 -49
- package/lib/__templates__/nextjs/src/app/robots.ts +11 -0
- package/lib/__templates__/nextjs/src/components/ui/accordion.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/alert-dialog.tsx +157 -0
- package/lib/__templates__/nextjs/src/components/ui/alert.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/aspect-ratio.tsx +11 -0
- package/lib/__templates__/nextjs/src/components/ui/avatar.tsx +53 -0
- package/lib/__templates__/nextjs/src/components/ui/badge.tsx +46 -0
- package/lib/__templates__/nextjs/src/components/ui/breadcrumb.tsx +109 -0
- package/lib/__templates__/nextjs/src/components/ui/button-group.tsx +83 -0
- package/lib/__templates__/nextjs/src/components/ui/button.tsx +62 -0
- package/lib/__templates__/nextjs/src/components/ui/calendar.tsx +220 -0
- package/lib/__templates__/nextjs/src/components/ui/card.tsx +92 -0
- package/lib/__templates__/nextjs/src/components/ui/carousel.tsx +241 -0
- package/lib/__templates__/nextjs/src/components/ui/chart.tsx +357 -0
- package/lib/__templates__/nextjs/src/components/ui/checkbox.tsx +32 -0
- package/lib/__templates__/nextjs/src/components/ui/collapsible.tsx +33 -0
- package/lib/__templates__/nextjs/src/components/ui/command.tsx +184 -0
- package/lib/__templates__/nextjs/src/components/ui/context-menu.tsx +252 -0
- package/lib/__templates__/nextjs/src/components/ui/dialog.tsx +143 -0
- package/lib/__templates__/nextjs/src/components/ui/drawer.tsx +135 -0
- package/lib/__templates__/nextjs/src/components/ui/dropdown-menu.tsx +257 -0
- package/lib/__templates__/nextjs/src/components/ui/empty.tsx +104 -0
- package/lib/__templates__/nextjs/src/components/ui/field.tsx +248 -0
- package/lib/__templates__/nextjs/src/components/ui/form.tsx +167 -0
- package/lib/__templates__/nextjs/src/components/ui/hover-card.tsx +44 -0
- package/lib/__templates__/nextjs/src/components/ui/input-group.tsx +170 -0
- package/lib/__templates__/nextjs/src/components/ui/input-otp.tsx +77 -0
- package/lib/__templates__/nextjs/src/components/ui/input.tsx +21 -0
- package/lib/__templates__/nextjs/src/components/ui/item.tsx +193 -0
- package/lib/__templates__/nextjs/src/components/ui/kbd.tsx +28 -0
- package/lib/__templates__/nextjs/src/components/ui/label.tsx +24 -0
- package/lib/__templates__/nextjs/src/components/ui/menubar.tsx +276 -0
- package/lib/__templates__/nextjs/src/components/ui/navigation-menu.tsx +168 -0
- package/lib/__templates__/nextjs/src/components/ui/pagination.tsx +127 -0
- package/lib/__templates__/nextjs/src/components/ui/popover.tsx +48 -0
- package/lib/__templates__/nextjs/src/components/ui/progress.tsx +31 -0
- package/lib/__templates__/nextjs/src/components/ui/radio-group.tsx +45 -0
- package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +63 -0
- package/lib/__templates__/nextjs/src/components/ui/scroll-area.tsx +58 -0
- package/lib/__templates__/nextjs/src/components/ui/select.tsx +190 -0
- package/lib/__templates__/nextjs/src/components/ui/separator.tsx +28 -0
- package/lib/__templates__/nextjs/src/components/ui/sheet.tsx +139 -0
- package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +724 -0
- package/lib/__templates__/nextjs/src/components/ui/skeleton.tsx +13 -0
- package/lib/__templates__/nextjs/src/components/ui/slider.tsx +63 -0
- package/lib/__templates__/nextjs/src/components/ui/sonner.tsx +40 -0
- package/lib/__templates__/nextjs/src/components/ui/spinner.tsx +16 -0
- package/lib/__templates__/nextjs/src/components/ui/switch.tsx +31 -0
- package/lib/__templates__/nextjs/src/components/ui/table.tsx +116 -0
- package/lib/__templates__/nextjs/src/components/ui/tabs.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/textarea.tsx +18 -0
- package/lib/__templates__/nextjs/src/components/ui/toggle-group.tsx +83 -0
- package/lib/__templates__/nextjs/src/components/ui/toggle.tsx +47 -0
- package/lib/__templates__/nextjs/src/components/ui/tooltip.tsx +61 -0
- package/lib/__templates__/nextjs/src/hooks/use-mobile.ts +19 -0
- package/lib/__templates__/nextjs/src/lib/utils.ts +6 -0
- package/lib/__templates__/nextjs/src/server.ts +35 -0
- package/lib/__templates__/nextjs/template.config.js +70 -5
- package/lib/__templates__/nextjs/tsconfig.json +1 -1
- package/lib/__templates__/nuxt-vue/.coze +12 -0
- package/lib/__templates__/nuxt-vue/README.md +73 -0
- package/lib/__templates__/nuxt-vue/_gitignore +24 -0
- package/lib/__templates__/{rsbuild → nuxt-vue}/_npmrc +2 -1
- package/lib/__templates__/nuxt-vue/app/app.vue +6 -0
- package/lib/__templates__/nuxt-vue/app/pages/index.vue +23 -0
- package/lib/__templates__/{rsbuild/src/index.css → nuxt-vue/assets/css/main.css} +7 -4
- package/lib/__templates__/nuxt-vue/nuxt.config.ts +116 -0
- package/lib/__templates__/nuxt-vue/package.json +35 -0
- package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8759 -0
- package/lib/__templates__/nuxt-vue/postcss.config.mjs +8 -0
- package/lib/__templates__/nuxt-vue/public/favicon.ico +0 -0
- package/lib/__templates__/nuxt-vue/public/robots.txt +2 -0
- package/lib/__templates__/{rsbuild → nuxt-vue}/scripts/build.sh +2 -2
- package/lib/__templates__/nuxt-vue/scripts/dev.sh +39 -0
- package/lib/__templates__/nuxt-vue/scripts/prepare.sh +14 -0
- package/lib/__templates__/nuxt-vue/scripts/start.sh +21 -0
- package/lib/__templates__/nuxt-vue/server/api/hello.ts +10 -0
- package/lib/__templates__/nuxt-vue/server/middleware/logger.ts +10 -0
- package/lib/__templates__/nuxt-vue/server/routes/health.ts +10 -0
- package/lib/__templates__/nuxt-vue/tailwind.config.js +13 -0
- package/lib/__templates__/nuxt-vue/template.config.js +87 -0
- package/lib/__templates__/nuxt-vue/tsconfig.json +18 -0
- package/lib/__templates__/taro/.coze +14 -0
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
- package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
- package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -0
- package/lib/__templates__/taro/README.md +763 -0
- package/lib/__templates__/taro/_gitignore +40 -0
- package/lib/__templates__/taro/_npmrc +18 -0
- package/lib/__templates__/taro/babel.config.js +12 -0
- package/lib/__templates__/taro/config/dev.ts +9 -0
- package/lib/__templates__/taro/config/index.ts +238 -0
- package/lib/__templates__/taro/config/prod.ts +34 -0
- package/lib/__templates__/taro/eslint.config.mjs +135 -0
- package/lib/__templates__/taro/key/private.appid.key +0 -0
- package/lib/__templates__/taro/package.json +112 -0
- package/lib/__templates__/taro/patches/@tarojs__plugin-mini-ci@4.1.9.patch +30 -0
- package/lib/__templates__/taro/pnpm-lock.yaml +23412 -0
- package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
- package/lib/__templates__/taro/project.config.json +15 -0
- package/lib/__templates__/taro/server/nest-cli.json +10 -0
- package/lib/__templates__/taro/server/package.json +40 -0
- package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
- package/lib/__templates__/taro/server/src/app.module.ts +10 -0
- package/lib/__templates__/taro/server/src/app.service.ts +8 -0
- package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
- package/lib/__templates__/taro/server/src/main.ts +49 -0
- package/lib/__templates__/taro/server/tsconfig.json +24 -0
- package/lib/__templates__/taro/src/app.config.ts +11 -0
- package/lib/__templates__/taro/src/app.css +156 -0
- package/lib/__templates__/taro/src/app.tsx +9 -0
- package/lib/__templates__/taro/src/components/ui/accordion.tsx +159 -0
- package/lib/__templates__/taro/src/components/ui/alert-dialog.tsx +260 -0
- package/lib/__templates__/taro/src/components/ui/alert.tsx +60 -0
- package/lib/__templates__/taro/src/components/ui/aspect-ratio.tsx +36 -0
- package/lib/__templates__/taro/src/components/ui/avatar.tsx +84 -0
- package/lib/__templates__/taro/src/components/ui/badge.tsx +37 -0
- package/lib/__templates__/taro/src/components/ui/breadcrumb.tsx +117 -0
- package/lib/__templates__/taro/src/components/ui/button-group.tsx +83 -0
- package/lib/__templates__/taro/src/components/ui/button.tsx +67 -0
- package/lib/__templates__/taro/src/components/ui/calendar.tsx +394 -0
- package/lib/__templates__/taro/src/components/ui/card.tsx +108 -0
- package/lib/__templates__/taro/src/components/ui/carousel.tsx +228 -0
- package/lib/__templates__/taro/src/components/ui/checkbox.tsx +58 -0
- package/lib/__templates__/taro/src/components/ui/code-block.tsx +169 -0
- package/lib/__templates__/taro/src/components/ui/collapsible.tsx +71 -0
- package/lib/__templates__/taro/src/components/ui/command.tsx +385 -0
- package/lib/__templates__/taro/src/components/ui/context-menu.tsx +614 -0
- package/lib/__templates__/taro/src/components/ui/dialog.tsx +256 -0
- package/lib/__templates__/taro/src/components/ui/drawer.tsx +192 -0
- package/lib/__templates__/taro/src/components/ui/dropdown-menu.tsx +561 -0
- package/lib/__templates__/taro/src/components/ui/field.tsx +228 -0
- package/lib/__templates__/taro/src/components/ui/hover-card.tsx +282 -0
- package/lib/__templates__/taro/src/components/ui/input-group.tsx +197 -0
- package/lib/__templates__/taro/src/components/ui/input-otp.tsx +136 -0
- package/lib/__templates__/taro/src/components/ui/input.tsx +56 -0
- package/lib/__templates__/taro/src/components/ui/label.tsx +24 -0
- package/lib/__templates__/taro/src/components/ui/menubar.tsx +595 -0
- package/lib/__templates__/taro/src/components/ui/navigation-menu.tsx +264 -0
- package/lib/__templates__/taro/src/components/ui/pagination.tsx +118 -0
- package/lib/__templates__/taro/src/components/ui/popover.tsx +291 -0
- package/lib/__templates__/taro/src/components/ui/portal.tsx +19 -0
- package/lib/__templates__/taro/src/components/ui/progress.tsx +28 -0
- package/lib/__templates__/taro/src/components/ui/radio-group.tsx +64 -0
- package/lib/__templates__/taro/src/components/ui/resizable.tsx +346 -0
- package/lib/__templates__/taro/src/components/ui/scroll-area.tsx +34 -0
- package/lib/__templates__/taro/src/components/ui/select.tsx +438 -0
- package/lib/__templates__/taro/src/components/ui/separator.tsx +30 -0
- package/lib/__templates__/taro/src/components/ui/sheet.tsx +262 -0
- package/lib/__templates__/taro/src/components/ui/skeleton.tsx +17 -0
- package/lib/__templates__/taro/src/components/ui/slider.tsx +203 -0
- package/lib/__templates__/taro/src/components/ui/sonner.tsx +1 -0
- package/lib/__templates__/taro/src/components/ui/switch.tsx +55 -0
- package/lib/__templates__/taro/src/components/ui/table.tsx +142 -0
- package/lib/__templates__/taro/src/components/ui/tabs.tsx +114 -0
- package/lib/__templates__/taro/src/components/ui/textarea.tsx +54 -0
- package/lib/__templates__/taro/src/components/ui/toast.tsx +517 -0
- package/lib/__templates__/taro/src/components/ui/toggle-group.tsx +120 -0
- package/lib/__templates__/taro/src/components/ui/toggle.tsx +77 -0
- package/lib/__templates__/taro/src/components/ui/tooltip.tsx +455 -0
- package/lib/__templates__/taro/src/index.html +39 -0
- package/lib/__templates__/taro/src/lib/hooks/use-keyboard-offset.ts +37 -0
- package/lib/__templates__/taro/src/lib/measure.ts +115 -0
- package/lib/__templates__/taro/src/lib/platform.ts +12 -0
- package/lib/__templates__/taro/src/lib/utils.ts +6 -0
- package/lib/__templates__/taro/src/network.ts +39 -0
- package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
- package/lib/__templates__/taro/src/pages/index/index.css +1 -0
- package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
- package/lib/__templates__/taro/src/presets/dev-debug.ts +23 -0
- package/lib/__templates__/taro/src/presets/h5-container.tsx +15 -0
- package/lib/__templates__/taro/src/presets/h5-navbar.tsx +238 -0
- package/lib/__templates__/taro/src/presets/h5-styles.ts +220 -0
- package/lib/__templates__/taro/src/presets/index.tsx +18 -0
- package/lib/__templates__/taro/stylelint.config.mjs +4 -0
- package/lib/__templates__/taro/template.config.js +68 -0
- package/lib/__templates__/taro/tsconfig.json +29 -0
- package/lib/__templates__/taro/types/global.d.ts +32 -0
- package/lib/__templates__/templates.json +126 -64
- package/lib/__templates__/vite/.coze +4 -3
- package/lib/__templates__/vite/README.md +383 -26
- package/lib/__templates__/vite/_gitignore +1 -0
- package/lib/__templates__/vite/_npmrc +2 -1
- package/lib/__templates__/vite/eslint.config.mjs +14 -0
- package/lib/__templates__/vite/package.json +23 -3
- package/lib/__templates__/vite/pnpm-lock.yaml +2509 -293
- package/lib/__templates__/vite/scripts/build.sh +4 -1
- package/lib/__templates__/vite/scripts/dev.sh +16 -28
- package/lib/__templates__/vite/scripts/prepare.sh +9 -0
- package/lib/__templates__/vite/scripts/start.sh +9 -3
- package/lib/__templates__/vite/server/routes/index.ts +31 -0
- package/lib/__templates__/vite/server/server.ts +65 -0
- package/lib/__templates__/vite/server/vite.ts +67 -0
- package/lib/__templates__/vite/src/main.ts +17 -48
- package/lib/__templates__/vite/template.config.js +82 -10
- package/lib/__templates__/vite/tsconfig.json +4 -3
- package/lib/__templates__/vite/vite.config.ts +8 -3
- package/lib/cli.js +1544 -488
- package/package.json +18 -7
- package/lib/__templates__/expo/.cozeproj/scripts/deploy_build.sh +0 -109
- package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +0 -257
- package/lib/__templates__/expo/app.json +0 -63
- package/lib/__templates__/expo/babel.config.js +0 -9
- package/lib/__templates__/expo/client/app/(tabs)/_layout.tsx +0 -43
- package/lib/__templates__/expo/client/app/(tabs)/home.tsx +0 -1
- package/lib/__templates__/expo/client/app/(tabs)/index.tsx +0 -7
- package/lib/__templates__/expo/client/hooks/useColorScheme.ts +0 -1
- package/lib/__templates__/expo/client/index.js +0 -11
- package/lib/__templates__/expo/client/screens/home/index.tsx +0 -54
- package/lib/__templates__/expo/client/screens/home/styles.ts +0 -332
- package/lib/__templates__/expo/metro.config.js +0 -53
- package/lib/__templates__/expo/src/index.ts +0 -12
- package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
- package/lib/__templates__/react-rsbuild/.coze +0 -11
- package/lib/__templates__/react-rsbuild/.vscode/settings.json +0 -121
- package/lib/__templates__/react-rsbuild/README.md +0 -61
- package/lib/__templates__/react-rsbuild/_gitignore +0 -97
- package/lib/__templates__/react-rsbuild/package.json +0 -31
- package/lib/__templates__/react-rsbuild/pnpm-lock.yaml +0 -997
- package/lib/__templates__/react-rsbuild/rsbuild.config.ts +0 -13
- package/lib/__templates__/react-rsbuild/scripts/dev.sh +0 -51
- package/lib/__templates__/react-rsbuild/scripts/start.sh +0 -15
- package/lib/__templates__/react-rsbuild/src/App.tsx +0 -60
- package/lib/__templates__/react-rsbuild/src/index.css +0 -21
- package/lib/__templates__/react-rsbuild/src/index.html +0 -12
- package/lib/__templates__/react-rsbuild/src/index.tsx +0 -16
- package/lib/__templates__/react-rsbuild/tailwind.config.js +0 -9
- package/lib/__templates__/react-rsbuild/template.config.js +0 -54
- package/lib/__templates__/react-rsbuild/tsconfig.json +0 -17
- package/lib/__templates__/rsbuild/.coze +0 -11
- package/lib/__templates__/rsbuild/.vscode/settings.json +0 -7
- package/lib/__templates__/rsbuild/README.md +0 -61
- package/lib/__templates__/rsbuild/_gitignore +0 -97
- package/lib/__templates__/rsbuild/package.json +0 -24
- package/lib/__templates__/rsbuild/pnpm-lock.yaml +0 -888
- package/lib/__templates__/rsbuild/rsbuild.config.ts +0 -12
- package/lib/__templates__/rsbuild/scripts/dev.sh +0 -51
- package/lib/__templates__/rsbuild/scripts/start.sh +0 -15
- package/lib/__templates__/rsbuild/src/index.html +0 -12
- package/lib/__templates__/rsbuild/src/index.ts +0 -5
- package/lib/__templates__/rsbuild/src/main.ts +0 -65
- package/lib/__templates__/rsbuild/tailwind.config.js +0 -9
- package/lib/__templates__/rsbuild/template.config.js +0 -54
- package/lib/__templates__/rsbuild/tsconfig.json +0 -16
- package/lib/__templates__/vite/.vscode/settings.json +0 -7
- /package/lib/__templates__/expo/{eslint-formatter-simple.mjs → client/eslint-formatter-simple.mjs} +0 -0
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import js from
|
|
2
|
-
import globals from
|
|
3
|
-
import tseslint from
|
|
4
|
-
import pluginReact from
|
|
5
|
-
import reactHooks from
|
|
6
|
-
import regexp from
|
|
7
|
-
import pluginImport from
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
import tseslint from 'typescript-eslint';
|
|
4
|
+
import pluginReact from 'eslint-plugin-react';
|
|
5
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
6
|
+
import regexp from 'eslint-plugin-regexp';
|
|
7
|
+
import pluginImport from 'eslint-plugin-import';
|
|
8
|
+
import fontawesome6 from '../eslint-plugins/fontawesome6/index.js';
|
|
9
|
+
import reanimated from '../eslint-plugins/reanimated/index.js';
|
|
10
|
+
import reactnative from '../eslint-plugins/react-native/index.js';
|
|
11
|
+
import forbidEmoji from '../eslint-plugins/forbid-emoji/index.js';
|
|
12
|
+
import restrictLinearGradient from '../eslint-plugins/restrict-linear-gradient/index.js';
|
|
8
13
|
|
|
9
14
|
export default [
|
|
10
15
|
{
|
|
@@ -15,19 +20,22 @@ export default [
|
|
|
15
20
|
'src/api/**', // 排除 src 下的自动生成 API
|
|
16
21
|
'.expo/**', // 排除 Expo 自动生成的文件
|
|
17
22
|
'tailwind.config.js', // 排除 Tailwind 配置文件
|
|
23
|
+
'**/*.d.ts',
|
|
24
|
+
'eslint.config.*',
|
|
25
|
+
'metro.config.*',
|
|
18
26
|
],
|
|
19
27
|
},
|
|
20
28
|
regexp.configs["flat/recommended"],
|
|
21
29
|
js.configs.recommended,
|
|
22
30
|
...tseslint.configs.recommended,
|
|
23
|
-
|
|
31
|
+
|
|
24
32
|
// React 的推荐配置
|
|
25
33
|
pluginReact.configs.flat.recommended,
|
|
26
34
|
pluginReact.configs.flat['jsx-runtime'],
|
|
27
35
|
reactHooks.configs.flat.recommended,
|
|
28
36
|
{
|
|
29
37
|
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
30
|
-
|
|
38
|
+
|
|
31
39
|
// 语言选项:设置全局变量
|
|
32
40
|
languageOptions: {
|
|
33
41
|
globals: {
|
|
@@ -52,6 +60,11 @@ export default [
|
|
|
52
60
|
|
|
53
61
|
plugins: {
|
|
54
62
|
import: pluginImport,
|
|
63
|
+
fontawesome6,
|
|
64
|
+
reanimated,
|
|
65
|
+
reactnative,
|
|
66
|
+
forbidEmoji,
|
|
67
|
+
restrictLinearGradient,
|
|
55
68
|
},
|
|
56
69
|
rules: {
|
|
57
70
|
// 关闭代码风格规则
|
|
@@ -70,6 +83,23 @@ export default [
|
|
|
70
83
|
'no-prototype-builtins': 'off',
|
|
71
84
|
'react/react-in-jsx-scope': 'off',
|
|
72
85
|
'react/jsx-uses-react': 'off',
|
|
86
|
+
'fontawesome6/valid-name': 'error',
|
|
87
|
+
'reanimated/ban-mix-use': 'error',
|
|
88
|
+
'forbidEmoji/no-emoji': 'error',
|
|
89
|
+
'restrictLinearGradient/no-linear-gradient-backgroundcolor': 'error',
|
|
90
|
+
// 禁止使用 via.placeholder.com 服务
|
|
91
|
+
'no-restricted-syntax': [
|
|
92
|
+
'error',
|
|
93
|
+
{
|
|
94
|
+
'selector': 'Literal[value=/via\\.placeholder\\.com/]',
|
|
95
|
+
'message': 'via.placeholder.com 服务不可用,禁止在代码中使用',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
'selector': 'TemplateLiteral > TemplateElement[value.raw=/via\\.placeholder\\.com/]',
|
|
99
|
+
'message': 'via.placeholder.com 服务不可用,禁止在代码中使用',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
'reactnative/wrap-horizontal-scrollview-inside-view': ['error'],
|
|
73
103
|
},
|
|
74
104
|
},
|
|
75
105
|
|
|
@@ -91,7 +121,7 @@ export default [
|
|
|
91
121
|
// 在 .js 文件中关闭 TS 规则
|
|
92
122
|
'@typescript-eslint/no-require-imports': 'off',
|
|
93
123
|
// 在 Node.js 文件中允许 require
|
|
94
|
-
'@typescript-eslint/no-var-requires': 'off',
|
|
124
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
95
125
|
'no-undef': 'off',
|
|
96
126
|
},
|
|
97
127
|
},
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createContext, Dispatch, ReactNode, SetStateAction, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { ColorSchemeName, useColorScheme as useReactNativeColorScheme, Platform } from 'react-native';
|
|
3
|
+
|
|
4
|
+
const ColorSchemeContext = createContext<'light' | 'dark' | null | undefined>(null);
|
|
5
|
+
|
|
6
|
+
const ColorSchemeProvider = function ({ children }: { children?: ReactNode }) {
|
|
7
|
+
const systemColorScheme = useReactNativeColorScheme();
|
|
8
|
+
const [colorScheme, setColorScheme] = useState(systemColorScheme);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setColorScheme(systemColorScheme);
|
|
12
|
+
}, [systemColorScheme]);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
function handleMessage(e: MessageEvent<{ event: string; colorScheme: ColorSchemeName; } | undefined>) {
|
|
16
|
+
if (e.data?.event === 'coze.workbench.colorScheme') {
|
|
17
|
+
const cs = e.data.colorScheme;
|
|
18
|
+
if (typeof cs === 'string' && typeof setColorScheme === 'function') {
|
|
19
|
+
setColorScheme(cs);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (Platform.OS === 'web') {
|
|
25
|
+
window.addEventListener('message', handleMessage, false);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return () => {
|
|
29
|
+
if (Platform.OS === 'web') {
|
|
30
|
+
window.removeEventListener('message', handleMessage, false);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, [setColorScheme]);
|
|
34
|
+
|
|
35
|
+
return <ColorSchemeContext.Provider value={colorScheme}>
|
|
36
|
+
{children}
|
|
37
|
+
</ColorSchemeContext.Provider>
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
function useColorScheme() {
|
|
41
|
+
const colorScheme = useContext(ColorSchemeContext);
|
|
42
|
+
return colorScheme;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
ColorSchemeProvider,
|
|
47
|
+
useColorScheme,
|
|
48
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 安全路由 Hook - 完全代替原生的 useRouter 和 useLocalSearchParams
|
|
3
|
+
*
|
|
4
|
+
* 提供的 Hook:
|
|
5
|
+
* - useSafeRouter: 代替 useRouter,包含所有路由方法,并对 push/replace/navigate/setParams 进行安全编码
|
|
6
|
+
* - useSafeSearchParams: 代替 useLocalSearchParams,获取路由参数
|
|
7
|
+
*
|
|
8
|
+
* 解决的问题:
|
|
9
|
+
* 1. URI 编解码不对称 - useLocalSearchParams 会自动解码,但 router.push 不会自动编码,
|
|
10
|
+
* 当参数包含 % 等特殊字符时会拿到错误的值
|
|
11
|
+
* 2. 类型丢失 - URL 参数全是 string,Number/Boolean 类型会丢失
|
|
12
|
+
* 3. 嵌套对象无法传递 - URL search params 不支持嵌套结构
|
|
13
|
+
*
|
|
14
|
+
* 解决方案:
|
|
15
|
+
* 采用 Payload 模式,将所有参数打包成 JSON 并 Base64 编码后传递,
|
|
16
|
+
* 接收时再解码还原,确保数据完整性和类型安全。
|
|
17
|
+
*
|
|
18
|
+
* 优点:
|
|
19
|
+
* 1. 自动处理所有特殊字符(如 %、&、=、中文、Emoji 等)
|
|
20
|
+
* 2. 保留数据类型(Number、Boolean 不会变成 String)
|
|
21
|
+
* 3. 支持嵌套对象和数组传递
|
|
22
|
+
* 4. 三端兼容(iOS、Android、Web)
|
|
23
|
+
*
|
|
24
|
+
* 使用方式:
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // 发送端 - 使用 useSafeRouter 代替 useRouter
|
|
27
|
+
* const router = useSafeRouter();
|
|
28
|
+
* router.push('/detail', { id: 123, uri: 'file:///path/%40test.mp3' });
|
|
29
|
+
* router.replace('/home', { tab: 'settings' });
|
|
30
|
+
* router.navigate('/profile', { userId: 456 });
|
|
31
|
+
* router.back();
|
|
32
|
+
* if (router.canGoBack()) { ... }
|
|
33
|
+
* router.setParams({ updated: true });
|
|
34
|
+
*
|
|
35
|
+
* // 接收端 - 使用 useSafeSearchParams 代替 useLocalSearchParams
|
|
36
|
+
* const { id, uri } = useSafeSearchParams<{ id: number; uri: string }>();
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
import { useMemo } from 'react';
|
|
40
|
+
import { useRouter as useExpoRouter, useLocalSearchParams as useExpoParams } from 'expo-router';
|
|
41
|
+
import { Base64 } from 'js-base64';
|
|
42
|
+
|
|
43
|
+
const PAYLOAD_KEY = '__safeRouterPayload__';
|
|
44
|
+
const LOG_PREFIX = '[SafeRouter]';
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const getCurrentParams = (rawParams: Record<string, string | string[]>): Record<string, unknown> => {
|
|
48
|
+
const payload = rawParams[PAYLOAD_KEY];
|
|
49
|
+
if (payload && typeof payload === 'string') {
|
|
50
|
+
const decoded = deserializeParams<Record<string, unknown>>(payload);
|
|
51
|
+
if (decoded && Object.keys(decoded).length > 0) {
|
|
52
|
+
return decoded;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const { [PAYLOAD_KEY]: _, ...rest } = rawParams;
|
|
56
|
+
return rest as Record<string, unknown>;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const serializeParams = (params: Record<string, unknown>): string => {
|
|
60
|
+
try {
|
|
61
|
+
const jsonStr = JSON.stringify(params);
|
|
62
|
+
return Base64.encode(jsonStr);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.error(LOG_PREFIX, 'serialize failed:', error instanceof Error ? error.message : 'Unknown error');
|
|
65
|
+
return '';
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const deserializeParams = <T = Record<string, unknown>>(
|
|
70
|
+
payload: string | string[] | undefined
|
|
71
|
+
): T | null => {
|
|
72
|
+
if (!payload || typeof payload !== 'string') {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const jsonStr = Base64.decode(payload);
|
|
77
|
+
return JSON.parse(jsonStr) as T;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.error(LOG_PREFIX, 'deserialize failed:', error instanceof Error ? error.message : 'Unknown error');
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 安全路由 Hook,用于页面跳转,代替 useRouter
|
|
87
|
+
* @returns 路由方法(继承 useRouter 所有方法,并对以下方法进行安全编码)
|
|
88
|
+
* - push(pathname, params) - 入栈新页面
|
|
89
|
+
* - replace(pathname, params) - 替换当前页面
|
|
90
|
+
* - navigate(pathname, params) - 智能跳转(已存在则返回,否则 push)
|
|
91
|
+
* - setParams(params) - 更新当前页面参数(合并现有参数)
|
|
92
|
+
*/
|
|
93
|
+
export function useSafeRouter() {
|
|
94
|
+
const router = useExpoRouter();
|
|
95
|
+
const rawParams = useExpoParams<Record<string, string | string[]>>();
|
|
96
|
+
|
|
97
|
+
const push = (pathname: string, params: Record<string, unknown> = {}) => {
|
|
98
|
+
const encodedPayload = serializeParams(params);
|
|
99
|
+
router.push({
|
|
100
|
+
pathname: pathname as `/${string}`,
|
|
101
|
+
params: { [PAYLOAD_KEY]: encodedPayload },
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const replace = (pathname: string, params: Record<string, unknown> = {}) => {
|
|
106
|
+
const encodedPayload = serializeParams(params);
|
|
107
|
+
router.replace({
|
|
108
|
+
pathname: pathname as `/${string}`,
|
|
109
|
+
params: { [PAYLOAD_KEY]: encodedPayload },
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const navigate = (pathname: string, params: Record<string, unknown> = {}) => {
|
|
114
|
+
const encodedPayload = serializeParams(params);
|
|
115
|
+
router.navigate({
|
|
116
|
+
pathname: pathname as `/${string}`,
|
|
117
|
+
params: { [PAYLOAD_KEY]: encodedPayload },
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const setParams = (params: Record<string, unknown>) => {
|
|
122
|
+
const currentParams = getCurrentParams(rawParams);
|
|
123
|
+
const mergedParams = { ...currentParams, ...params };
|
|
124
|
+
const encodedPayload = serializeParams(mergedParams);
|
|
125
|
+
router.setParams({ [PAYLOAD_KEY]: encodedPayload });
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
...router,
|
|
130
|
+
push,
|
|
131
|
+
replace,
|
|
132
|
+
navigate,
|
|
133
|
+
setParams,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 安全获取路由参数 Hook,用于接收方,代替 useLocalSearchParams
|
|
139
|
+
* 兼容两种跳转方式:
|
|
140
|
+
* 1. useSafeRouter 跳转 - 自动解码 Payload
|
|
141
|
+
* 2. 外部跳转(深链接、浏览器直接访问等)- 回退到原始参数
|
|
142
|
+
* @returns 解码后的参数对象,类型安全
|
|
143
|
+
*/
|
|
144
|
+
export function useSafeSearchParams<T = Record<string, unknown>>(): T {
|
|
145
|
+
const rawParams = useExpoParams<Record<string, string | string[]>>();
|
|
146
|
+
|
|
147
|
+
const decodedParams = useMemo(() => {
|
|
148
|
+
return getCurrentParams(rawParams) as T;
|
|
149
|
+
}, [rawParams]);
|
|
150
|
+
|
|
151
|
+
return decodedParams;
|
|
152
|
+
}
|
|
@@ -1,13 +1,33 @@
|
|
|
1
|
-
import { Colors } from
|
|
2
|
-
import { useColorScheme } from
|
|
1
|
+
import { Colors } from '@/constants/theme';
|
|
2
|
+
import { useColorScheme } from '@/hooks/useColorScheme';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
enum COLOR_SCHEME_CHOICE {
|
|
5
|
+
FOLLOW_SYSTEM = 'follow-system', // 跟随系统自动变化
|
|
6
|
+
DARK = 'dark', // 固定为 dark 主题,不随系统变化
|
|
7
|
+
LIGHT = 'light', // 固定为 light 主题,不随系统变化
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const userPreferColorScheme: COLOR_SCHEME_CHOICE = COLOR_SCHEME_CHOICE.FOLLOW_SYSTEM;
|
|
11
|
+
|
|
12
|
+
function getTheme(colorScheme?: 'dark' | 'light' | null) {
|
|
13
|
+
const isDark = colorScheme === 'dark';
|
|
14
|
+
const theme = Colors[colorScheme ?? 'light'];
|
|
8
15
|
|
|
9
16
|
return {
|
|
10
17
|
theme,
|
|
11
18
|
isDark,
|
|
12
19
|
};
|
|
13
20
|
}
|
|
21
|
+
|
|
22
|
+
function useTheme() {
|
|
23
|
+
const systemColorScheme = useColorScheme()
|
|
24
|
+
const colorScheme = userPreferColorScheme === COLOR_SCHEME_CHOICE.FOLLOW_SYSTEM ?
|
|
25
|
+
systemColorScheme :
|
|
26
|
+
userPreferColorScheme;
|
|
27
|
+
|
|
28
|
+
return getTheme(colorScheme);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
useTheme,
|
|
33
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
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
|
+
// 5. pnpm 临时目录(避免 ENOENT 错误)
|
|
31
|
+
/.*node_modules\/\.pnpm\/.*_tmp_\d+.*/,
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const BACKEND_TARGET = 'http://localhost:9091';
|
|
35
|
+
|
|
36
|
+
const apiProxy = createProxyMiddleware({
|
|
37
|
+
target: BACKEND_TARGET,
|
|
38
|
+
changeOrigin: true,
|
|
39
|
+
logLevel: 'debug',
|
|
40
|
+
proxyTimeout: 86400000,
|
|
41
|
+
onProxyReq: (proxyReq, req) => {
|
|
42
|
+
const accept = req.headers.accept || '';
|
|
43
|
+
if (accept.includes('text/event-stream')) {
|
|
44
|
+
proxyReq.setHeader('accept-encoding', 'identity');
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
onProxyRes: (proxyRes, req, res) => {
|
|
48
|
+
const contentType = proxyRes.headers['content-type'] || '';
|
|
49
|
+
if (contentType.includes('text/event-stream') || contentType.includes('application/stream')) {
|
|
50
|
+
res.setHeader('Cache-Control', 'no-cache');
|
|
51
|
+
res.setHeader('Connection', 'keep-alive');
|
|
52
|
+
res.setHeader('X-Accel-Buffering', 'no');
|
|
53
|
+
if (typeof res.flushHeaders === 'function') {
|
|
54
|
+
try { res.flushHeaders(); } catch {}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const streamProxy = createProxyMiddleware({
|
|
61
|
+
target: BACKEND_TARGET,
|
|
62
|
+
changeOrigin: true,
|
|
63
|
+
logLevel: 'debug',
|
|
64
|
+
ws: true,
|
|
65
|
+
proxyTimeout: 86400000,
|
|
66
|
+
onProxyReq: (proxyReq, req) => {
|
|
67
|
+
const upgrade = req.headers.upgrade;
|
|
68
|
+
const accept = req.headers.accept || '';
|
|
69
|
+
if (upgrade && upgrade.toLowerCase() === 'websocket') {
|
|
70
|
+
proxyReq.setHeader('Connection', 'upgrade');
|
|
71
|
+
proxyReq.setHeader('Upgrade', req.headers.upgrade);
|
|
72
|
+
} else if (accept.includes('text/event-stream')) {
|
|
73
|
+
proxyReq.setHeader('accept-encoding', 'identity');
|
|
74
|
+
proxyReq.setHeader('Connection', 'keep-alive');
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
onProxyRes: (proxyRes, req, res) => {
|
|
78
|
+
const contentType = proxyRes.headers['content-type'] || '';
|
|
79
|
+
if (contentType.includes('text/event-stream') || contentType.includes('application/stream')) {
|
|
80
|
+
res.setHeader('Cache-Control', 'no-cache');
|
|
81
|
+
res.setHeader('Connection', 'keep-alive');
|
|
82
|
+
res.setHeader('X-Accel-Buffering', 'no');
|
|
83
|
+
if (typeof res.flushHeaders === 'function') {
|
|
84
|
+
try { res.flushHeaders(); } catch {}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const shouldProxyToBackend = (url) => {
|
|
91
|
+
if (!url) return false;
|
|
92
|
+
if (/^\/api\/v\d+\//.test(url)) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const isWebSocketRequest = (req) =>
|
|
99
|
+
!!(req.headers.upgrade && req.headers.upgrade.toLowerCase() === 'websocket');
|
|
100
|
+
const isSSERequest = (req) => {
|
|
101
|
+
const accept = req.headers.accept || '';
|
|
102
|
+
return accept.includes('text/event-stream');
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
config.server = {
|
|
106
|
+
...config.server,
|
|
107
|
+
enhanceMiddleware: (metroMiddleware, metroServer) => {
|
|
108
|
+
return connect()
|
|
109
|
+
.use((req, res, next) => {
|
|
110
|
+
if (shouldProxyToBackend(req.url)) {
|
|
111
|
+
console.log(`[Metro Proxy] Forwarding ${req.method} ${req.url}`);
|
|
112
|
+
|
|
113
|
+
if (isWebSocketRequest(req) || isSSERequest(req)) {
|
|
114
|
+
return streamProxy(req, res, next);
|
|
115
|
+
}
|
|
116
|
+
return apiProxy(req, res, next);
|
|
117
|
+
}
|
|
118
|
+
next();
|
|
119
|
+
})
|
|
120
|
+
.use(metroMiddleware);
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
module.exports = config;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "expo-app",
|
|
3
|
+
"description": "<%= appName %>",
|
|
4
|
+
"main": "expo-router/entry",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"check-deps": "npx depcheck",
|
|
8
|
+
"postinstall": "npm run install-missing",
|
|
9
|
+
"install-missing": "node ./scripts/install-missing-deps.js",
|
|
10
|
+
"lint": "expo lint",
|
|
11
|
+
"start": "expo start --web --clear",
|
|
12
|
+
"test": "jest --watchAll"
|
|
13
|
+
},
|
|
14
|
+
"jest": {
|
|
15
|
+
"preset": "jest-expo"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@expo/metro-runtime": "~6.1.2",
|
|
19
|
+
"@expo/vector-icons": "^15.0.3",
|
|
20
|
+
"@react-native-async-storage/async-storage": "2.2.0",
|
|
21
|
+
"@react-native-community/datetimepicker": "8.4.4",
|
|
22
|
+
"@react-native-community/slider": "5.0.1",
|
|
23
|
+
"@react-native-masked-view/masked-view": "0.3.2",
|
|
24
|
+
"@react-native-picker/picker": "2.11.1",
|
|
25
|
+
"@react-navigation/bottom-tabs": "^7.2.0",
|
|
26
|
+
"@react-navigation/native": "^7.0.14",
|
|
27
|
+
"dayjs": "^1.11.19",
|
|
28
|
+
"expo": "54.0.33",
|
|
29
|
+
"expo-auth-session": "~7.0.10",
|
|
30
|
+
"expo-av": "~16.0.8",
|
|
31
|
+
"expo-blur": "~15.0.8",
|
|
32
|
+
"expo-camera": "~17.0.10",
|
|
33
|
+
"expo-constants": "~18.0.13",
|
|
34
|
+
"expo-crypto": "~15.0.8",
|
|
35
|
+
"expo-file-system": "~19.0.21",
|
|
36
|
+
"expo-font": "~14.0.11",
|
|
37
|
+
"expo-haptics": "~15.0.8",
|
|
38
|
+
"expo-image": "~3.0.11",
|
|
39
|
+
"expo-image-picker": "~17.0.10",
|
|
40
|
+
"expo-linear-gradient": "~15.0.8",
|
|
41
|
+
"expo-linking": "~8.0.11",
|
|
42
|
+
"expo-location": "~19.0.8",
|
|
43
|
+
"expo-router": "~6.0.23",
|
|
44
|
+
"expo-splash-screen": "~31.0.13",
|
|
45
|
+
"expo-status-bar": "~3.0.9",
|
|
46
|
+
"expo-symbols": "~1.0.8",
|
|
47
|
+
"expo-system-ui": "~6.0.9",
|
|
48
|
+
"expo-web-browser": "~15.0.10",
|
|
49
|
+
"js-base64": "^3.7.7",
|
|
50
|
+
"react": "19.1.0",
|
|
51
|
+
"react-dom": "19.1.0",
|
|
52
|
+
"react-native": "0.81.5",
|
|
53
|
+
"react-native-chart-kit": "^6.12.0",
|
|
54
|
+
"react-native-gesture-handler": "~2.28.0",
|
|
55
|
+
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
56
|
+
"react-native-modal-datetime-picker": "18.0.0",
|
|
57
|
+
"react-native-reanimated": "~4.1.1",
|
|
58
|
+
"react-native-safe-area-context": "~5.6.0",
|
|
59
|
+
"react-native-screens": "~4.16.0",
|
|
60
|
+
"react-native-svg": "15.12.1",
|
|
61
|
+
"react-native-toast-message": "^2.3.3",
|
|
62
|
+
"react-native-web": "~0.21.0",
|
|
63
|
+
"react-native-webview": "13.15.0",
|
|
64
|
+
"react-native-worklets": "0.5.1",
|
|
65
|
+
"zod": "^4.2.1"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@babel/core": "^7.25.2",
|
|
69
|
+
"@eslint/js": "^9.27.0",
|
|
70
|
+
"@types/jest": "^29.5.12",
|
|
71
|
+
"@types/react": "~19.1.0",
|
|
72
|
+
"@types/react-test-renderer": "19.1.0",
|
|
73
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
|
74
|
+
"babel-preset-expo": "^54.0.9",
|
|
75
|
+
"chalk": "^4.1.2",
|
|
76
|
+
"connect": "^3.7.0",
|
|
77
|
+
"depcheck": "^1.4.7",
|
|
78
|
+
"esbuild": "0.27.2",
|
|
79
|
+
"eslint": "^9.39.2",
|
|
80
|
+
"eslint-formatter-compact": "^9.0.1",
|
|
81
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
82
|
+
"eslint-plugin-import": "^2.32.0",
|
|
83
|
+
"eslint-plugin-react": "^7.37.5",
|
|
84
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
85
|
+
"eslint-plugin-regexp": "^2.10.0",
|
|
86
|
+
"globals": "^16.1.0",
|
|
87
|
+
"http-proxy-middleware": "^3.0.5",
|
|
88
|
+
"jest": "^29.2.1",
|
|
89
|
+
"jest-expo": "~54.0.17",
|
|
90
|
+
"react-test-renderer": "19.1.0",
|
|
91
|
+
"tsx": "^4.21.0",
|
|
92
|
+
"typescript": "^5.8.3",
|
|
93
|
+
"typescript-eslint": "^8.32.1"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { View, Text } from 'react-native';
|
|
2
|
+
import { Image } from 'expo-image';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '@/hooks/useTheme';
|
|
5
|
+
import { Screen } from '@/components/Screen';
|
|
6
|
+
import { styles } from './styles';
|
|
7
|
+
|
|
8
|
+
export default function DemoPage() {
|
|
9
|
+
const { theme, isDark } = useTheme();
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Screen backgroundColor={theme.backgroundRoot} statusBarStyle={isDark ? 'light' : 'dark'}>
|
|
13
|
+
<View
|
|
14
|
+
style={styles.container}
|
|
15
|
+
>
|
|
16
|
+
<Image
|
|
17
|
+
style={styles.logo}
|
|
18
|
+
source="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/icon/coze-coding.gif"
|
|
19
|
+
></Image>
|
|
20
|
+
<Text style={{...styles.title, color: theme.textPrimary}}>应用开发中</Text>
|
|
21
|
+
<Text style={{...styles.description, color: theme.textSecondary}}>请稍候,界面即将呈现</Text>
|
|
22
|
+
</View>
|
|
23
|
+
</Screen>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Spacing } from '@/constants/theme';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export const styles = StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
position: 'absolute',
|
|
7
|
+
top: 0,
|
|
8
|
+
left: 0,
|
|
9
|
+
width: '100%',
|
|
10
|
+
height: '100%',
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
justifyContent: 'center',
|
|
15
|
+
},
|
|
16
|
+
logo: {
|
|
17
|
+
width: 130,
|
|
18
|
+
height: 109,
|
|
19
|
+
},
|
|
20
|
+
title: {
|
|
21
|
+
fontSize: 16,
|
|
22
|
+
fontWeight: 'bold',
|
|
23
|
+
},
|
|
24
|
+
description: {
|
|
25
|
+
fontSize: 14,
|
|
26
|
+
marginTop: Spacing.sm,
|
|
27
|
+
},
|
|
28
|
+
});
|