@coze-arch/cli 0.0.1-alpha.3ce8c6 → 0.0.1-alpha.40ed71
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/lib/__templates__/expo/.coze +1 -1
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +19 -82
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +75 -88
- package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +2 -2
- package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +2 -2
- package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
- package/lib/__templates__/expo/README.md +39 -7
- package/lib/__templates__/expo/client/app/+not-found.tsx +30 -0
- 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 +65 -60
- package/lib/__templates__/expo/client/components/Screen.tsx +1 -17
- package/lib/__templates__/expo/client/components/ThemedView.tsx +1 -2
- package/lib/__templates__/expo/client/constants/theme.ts +25 -698
- package/lib/__templates__/expo/client/declarations.d.ts +5 -0
- package/lib/__templates__/expo/client/eslint.config.mjs +33 -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/package.json +6 -3
- 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 +1 -0
- package/lib/__templates__/expo/client/utils/index.ts +22 -0
- 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/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/package.json +7 -98
- package/lib/__templates__/expo/patches/expo@54.0.32.patch +44 -0
- package/lib/__templates__/expo/pnpm-lock.yaml +2001 -2124
- package/lib/__templates__/expo/server/build.js +21 -0
- package/lib/__templates__/expo/server/package.json +19 -4
- package/lib/__templates__/expo/server/src/index.ts +9 -2
- package/lib/__templates__/expo/server/tsconfig.json +24 -0
- package/lib/__templates__/expo/template.config.js +1 -0
- package/lib/__templates__/nextjs/.babelrc +15 -0
- package/lib/__templates__/nextjs/.coze +1 -0
- package/lib/__templates__/nextjs/_npmrc +1 -0
- package/lib/__templates__/nextjs/next.config.ts +12 -0
- package/lib/__templates__/nextjs/package.json +11 -2
- package/lib/__templates__/nextjs/pnpm-lock.yaml +2606 -1723
- package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
- package/lib/__templates__/nextjs/src/app/globals.css +10 -2
- package/lib/__templates__/nextjs/src/app/layout.tsx +5 -14
- package/lib/__templates__/nextjs/src/app/page.tsx +35 -23
- package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
- package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
- package/lib/__templates__/nextjs/template.config.js +30 -0
- package/lib/__templates__/templates.json +61 -43
- package/lib/__templates__/vite/.coze +1 -0
- package/lib/__templates__/vite/_npmrc +1 -0
- package/lib/__templates__/vite/eslint.config.mjs +9 -0
- package/lib/__templates__/vite/package.json +10 -1
- package/lib/__templates__/vite/pnpm-lock.yaml +3115 -126
- package/lib/__templates__/vite/scripts/prepare.sh +9 -0
- package/lib/__templates__/vite/src/main.ts +1 -2
- package/lib/__templates__/vite/template.config.js +30 -4
- package/lib/cli.js +989 -131
- package/package.json +5 -3
- package/lib/__templates__/expo/client/app/index.ts +0 -1
- package/lib/__templates__/expo/client/hooks/useColorScheme.ts +0 -1
- package/lib/__templates__/expo/client/screens/home/index.tsx +0 -50
- package/lib/__templates__/expo/client/screens/home/styles.ts +0 -60
- package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
- 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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
68
|
-
"
|
|
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:
|
|
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' | '
|
|
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
|
|