@coze-arch/cli 0.0.1-alpha.ecba20 → 0.0.1-alpha.ecccee

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 (114) hide show
  1. package/lib/__templates__/expo/.coze +1 -1
  2. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +19 -82
  3. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +78 -88
  4. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +2 -2
  5. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +2 -2
  6. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
  7. package/lib/__templates__/expo/README.md +26 -16
  8. package/lib/__templates__/expo/client/app/+not-found.tsx +30 -0
  9. package/lib/__templates__/expo/client/app/_layout.tsx +15 -12
  10. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  11. package/lib/__templates__/expo/client/app.config.ts +65 -60
  12. package/lib/__templates__/expo/client/components/Screen.tsx +1 -17
  13. package/lib/__templates__/expo/client/components/ThemedView.tsx +1 -2
  14. package/lib/__templates__/expo/client/constants/theme.ts +25 -698
  15. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  16. package/lib/__templates__/expo/client/eslint.config.mjs +33 -10
  17. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
  18. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  19. package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
  20. package/lib/__templates__/expo/client/package.json +36 -33
  21. package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
  22. package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
  23. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +1 -0
  24. package/lib/__templates__/expo/client/utils/index.ts +22 -0
  25. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  26. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  27. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  28. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  29. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  30. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  31. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  32. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  33. package/lib/__templates__/expo/package.json +3 -0
  34. package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
  35. package/lib/__templates__/expo/pnpm-lock.yaml +1346 -2612
  36. package/lib/__templates__/expo/server/build.js +21 -0
  37. package/lib/__templates__/expo/server/package.json +11 -7
  38. package/lib/__templates__/expo/server/src/index.ts +10 -2
  39. package/lib/__templates__/expo/template.config.js +57 -0
  40. package/lib/__templates__/nextjs/.coze +1 -0
  41. package/lib/__templates__/nextjs/_npmrc +1 -0
  42. package/lib/__templates__/nextjs/next.config.ts +11 -0
  43. package/lib/__templates__/nextjs/package.json +10 -2
  44. package/lib/__templates__/nextjs/pnpm-lock.yaml +1686 -1810
  45. package/lib/__templates__/nextjs/scripts/dev.sh +1 -1
  46. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  47. package/lib/__templates__/nextjs/src/app/globals.css +10 -2
  48. package/lib/__templates__/nextjs/src/app/layout.tsx +1 -14
  49. package/lib/__templates__/nextjs/src/app/page.tsx +18 -48
  50. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
  51. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
  52. package/lib/__templates__/nextjs/template.config.js +67 -2
  53. package/lib/__templates__/taro/.coze +14 -0
  54. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
  55. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
  56. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
  57. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
  58. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
  59. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +1 -0
  60. package/lib/__templates__/taro/README.md +749 -0
  61. package/lib/__templates__/taro/_gitignore +40 -0
  62. package/lib/__templates__/taro/_npmrc +18 -0
  63. package/lib/__templates__/taro/babel.config.js +12 -0
  64. package/lib/__templates__/taro/config/dev.ts +9 -0
  65. package/lib/__templates__/taro/config/index.ts +173 -0
  66. package/lib/__templates__/taro/config/prod.ts +35 -0
  67. package/lib/__templates__/taro/eslint.config.mjs +57 -0
  68. package/lib/__templates__/taro/key/private.appid.key +0 -0
  69. package/lib/__templates__/taro/package.json +97 -0
  70. package/lib/__templates__/taro/pnpm-lock.yaml +22708 -0
  71. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  72. package/lib/__templates__/taro/project.config.json +15 -0
  73. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  74. package/lib/__templates__/taro/server/package.json +41 -0
  75. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  76. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  77. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  78. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  79. package/lib/__templates__/taro/server/src/main.ts +49 -0
  80. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  81. package/lib/__templates__/taro/src/app.config.ts +11 -0
  82. package/lib/__templates__/taro/src/app.css +52 -0
  83. package/lib/__templates__/taro/src/app.tsx +9 -0
  84. package/lib/__templates__/taro/src/index.html +39 -0
  85. package/lib/__templates__/taro/src/network.ts +39 -0
  86. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  87. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  88. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  89. package/lib/__templates__/taro/src/presets/h5-navbar.tsx +171 -0
  90. package/lib/__templates__/taro/src/presets/h5-styles.ts +33 -0
  91. package/lib/__templates__/taro/src/presets/index.tsx +18 -0
  92. package/lib/__templates__/taro/src/presets/wx-debug.ts +23 -0
  93. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  94. package/lib/__templates__/taro/template.config.js +68 -0
  95. package/lib/__templates__/taro/tsconfig.json +29 -0
  96. package/lib/__templates__/taro/types/global.d.ts +32 -0
  97. package/lib/__templates__/templates.json +88 -65
  98. package/lib/__templates__/vite/.coze +1 -0
  99. package/lib/__templates__/vite/_npmrc +1 -0
  100. package/lib/__templates__/vite/eslint.config.mjs +9 -0
  101. package/lib/__templates__/vite/package.json +14 -1
  102. package/lib/__templates__/vite/pnpm-lock.yaml +1581 -105
  103. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  104. package/lib/__templates__/vite/src/main.ts +17 -48
  105. package/lib/__templates__/vite/template.config.js +67 -6
  106. package/lib/cli.js +864 -139
  107. package/package.json +1 -1
  108. package/lib/__templates__/expo/client/app/index.ts +0 -1
  109. package/lib/__templates__/expo/client/hooks/useColorScheme.ts +0 -1
  110. package/lib/__templates__/expo/client/screens/home/index.tsx +0 -50
  111. package/lib/__templates__/expo/client/screens/home/styles.ts +0 -60
  112. package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
  113. package/lib/__templates__/nextjs/server.mjs +0 -50
  114. package/lib/__templates__/vite/.vscode/settings.json +0 -7
@@ -1,71 +1,76 @@
1
1
  import { ExpoConfig, ConfigContext } from 'expo/config';
2
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
+
3
7
  export default ({ config }: ConfigContext): ExpoConfig => {
4
8
  return {
5
9
  ...config,
6
- "name": "${app_name}",
7
- "slug": "${slug}",
8
- "version": "1.0.0",
9
- "orientation": "portrait",
10
- "icon": "./assets/images/icon.png",
11
- "scheme": "myapp",
12
- "userInterfaceStyle": "automatic",
13
- "newArchEnabled": true,
14
- "ios": {
15
- "supportsTablet": true
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"
16
25
  },
17
- "android": {
18
- "adaptiveIcon": {
19
- "foregroundImage": "./assets/images/adaptive-icon.png",
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",
20
46
  "backgroundColor": "#ffffff"
21
47
  }
22
- },
23
- "web": {
24
- "bundler": "metro",
25
- "output": "single",
26
- "favicon": "./assets/images/favicon.png"
27
- },
28
- "plugins": [
29
- process.env.EXPO_PUBLIC_BACKEND_BASE_URL ? [
30
- "expo-router",
31
- {
32
- "origin": process.env.EXPO_PUBLIC_BACKEND_BASE_URL
33
- }
34
- ] : 'expo-router',
35
- [
36
- "expo-splash-screen",
37
- {
38
- "image": "./assets/images/splash-icon.png",
39
- "imageWidth": 200,
40
- "resizeMode": "contain",
41
- "backgroundColor": "#ffffff"
42
- }
43
- ],
44
- [
45
- "expo-image-picker",
46
- {
47
- "photosPermission": "允许${app_name}访问您的相册,以便您上传或保存图片。",
48
- "cameraPermission": "允许${app_name}使用您的相机,以便您直接拍摄照片上传。",
49
- "microphonePermission": "允许${app_name}访问您的麦克风,以便您拍摄带有声音的视频。"
50
- }
51
- ],
52
- [
53
- "expo-location",
54
- {
55
- "locationWhenInUsePermission": "${app_name}需要访问您的位置以提供周边服务及导航功能。"
56
- }
57
- ],
58
- [
59
- "expo-camera",
60
- {
61
- "cameraPermission": "${app_name}需要访问相机以拍摄照片和视频。",
62
- "microphonePermission": "${app_name}需要访问麦克风以录制视频声音。",
63
- "recordAudioAndroid": true
64
- }
65
- ]
66
48
  ],
67
- "experiments": {
68
- "typedRoutes": true
69
- }
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
+ }
70
75
  }
71
76
  }
@@ -197,26 +197,10 @@ export const Screen = ({
197
197
  // 强制禁用 iOS 自动调整内容区域,完全由手动 padding 控制,消除系统自动计算带来的多余空白
198
198
  const contentInsetBehaviorIOS = 'never';
199
199
 
200
- // 1. 外层容器样式
201
- // 负责:背景色、Top/Left/Right 安全区、以及非滚动模式下的 Bottom 安全区
202
- const childArray = React.Children.toArray(children);
203
- let firstChild: React.ReactElement<any, any> | null = null;
204
- for (let i = 0; i < childArray.length; i++) {
205
- const el = childArray[i];
206
- if (React.isValidElement(el)) { firstChild = el as React.ReactElement<any, any>; break; }
207
- }
208
- const firstChildHasInlinePaddingTop = (() => {
209
- if (!firstChild) return false;
210
- const st: any = (firstChild as any).props?.style;
211
- const arr = Array.isArray(st) ? st : st ? [st] : [];
212
- return arr.some((s) => s && typeof s === 'object' && typeof (s as any).paddingTop === 'number' && (s as any).paddingTop > 10);
213
- })();
214
- const applyTopInset = hasTop && !firstChildHasInlinePaddingTop;
215
-
216
200
  const wrapperStyle: ViewStyle = {
217
201
  flex: 1,
218
202
  backgroundColor,
219
- paddingTop: applyTopInset ? insets.top : 0,
203
+ paddingTop: hasTop ? insets.top : 0,
220
204
  paddingLeft: hasLeft ? insets.left : 0,
221
205
  paddingRight: hasRight ? insets.right : 0,
222
206
  // 当页面不使用外层 ScrollView 时(子树本身可滚动),由外层 View 负责底部安全区
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { View, ViewProps, ViewStyle } from 'react-native';
3
3
  import { useTheme } from '@/hooks/useTheme';
4
4
 
5
- type BackgroundLevel = 'root' | 'default' | 'secondary' | 'tertiary';
5
+ type BackgroundLevel = 'root' | 'default' | 'tertiary';
6
6
 
7
7
  interface ThemedViewProps extends ViewProps {
8
8
  level?: BackgroundLevel;
@@ -12,7 +12,6 @@ interface ThemedViewProps extends ViewProps {
12
12
  const backgroundMap: Record<BackgroundLevel, string> = {
13
13
  root: 'backgroundRoot',
14
14
  default: 'backgroundDefault',
15
- secondary: 'backgroundSecondary',
16
15
  tertiary: 'backgroundTertiary',
17
16
  };
18
17