@coze-arch/cli 0.0.1-alpha.9f719c → 0.0.1-alpha.a37c60
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 +2 -2
- package/lib/__templates__/expo/.cozeproj/scripts/{deploy_run.sh → dev_run.sh} +4 -1
- package/lib/__templates__/expo/client/components/ThemedText.tsx +33 -0
- package/lib/__templates__/expo/client/components/ThemedView.tsx +38 -0
- package/lib/__templates__/expo/client/constants/theme.ts +776 -54
- package/lib/__templates__/expo/metro.config.js +75 -5
- package/lib/__templates__/expo/package.json +10 -5
- package/lib/__templates__/expo/pnpm-lock.yaml +71 -516
- package/lib/__templates__/nextjs/next.config.ts +1 -0
- package/lib/__templates__/nextjs/src/app/globals.css +99 -87
- package/lib/__templates__/templates.json +27 -0
- package/lib/cli.js +144 -31
- package/package.json +8 -3
- /package/lib/__templates__/expo/.cozeproj/scripts/{deploy_build.sh → dev_build.sh} +0 -0
|
@@ -3,8 +3,8 @@ entrypoint = "server.js"
|
|
|
3
3
|
requires = ["nodejs-24"]
|
|
4
4
|
|
|
5
5
|
[dev]
|
|
6
|
-
build = ["bash", ".cozeproj/scripts/
|
|
7
|
-
run = ["bash", ".cozeproj/scripts/
|
|
6
|
+
build = ["bash", ".cozeproj/scripts/dev_build.sh"]
|
|
7
|
+
run = ["bash", ".cozeproj/scripts/dev_run.sh"]
|
|
8
8
|
|
|
9
9
|
[deploy]
|
|
10
10
|
build = ["bash", ".cozeproj/scripts/prod_build.sh"]
|
|
@@ -122,7 +122,7 @@ fs.closeSync(fd);
|
|
|
122
122
|
wait_port_connectable() {
|
|
123
123
|
local host=$1 port=$2 retries=${3:-10}
|
|
124
124
|
for _ in $(seq 1 "$retries"); do
|
|
125
|
-
nc -z "$host" "$port" && return 0
|
|
125
|
+
nc -z -w 1 "$host" "$port" >/dev/null 2>&1 && return 0
|
|
126
126
|
sleep 1
|
|
127
127
|
done
|
|
128
128
|
return 1
|
|
@@ -154,6 +154,9 @@ detect_expo_fetch_failed() {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
# ==================== 前置检查 ====================
|
|
157
|
+
# 关掉nginx进程
|
|
158
|
+
ps -ef | grep nginx | grep -v grep | awk '{print $2}' | xargs -r kill -9
|
|
159
|
+
|
|
157
160
|
write_log "INFO" "检查根目录 pre_install.py"
|
|
158
161
|
if [ -f "$PREVIEW_DIR/pre_install.py" ]; then
|
|
159
162
|
write_log "INFO" "执行:python $PREVIEW_DIR/pre_install.py"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text, TextProps, TextStyle } from 'react-native';
|
|
3
|
+
import { useTheme } from '@/hooks/useTheme';
|
|
4
|
+
import { Typography } from '@/constants/theme';
|
|
5
|
+
|
|
6
|
+
type TypographyVariant = keyof typeof Typography;
|
|
7
|
+
|
|
8
|
+
interface ThemedTextProps extends TextProps {
|
|
9
|
+
variant?: TypographyVariant;
|
|
10
|
+
color?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function ThemedText({
|
|
14
|
+
variant = 'body',
|
|
15
|
+
color,
|
|
16
|
+
style,
|
|
17
|
+
children,
|
|
18
|
+
...props
|
|
19
|
+
}: ThemedTextProps) {
|
|
20
|
+
const { theme } = useTheme();
|
|
21
|
+
const typographyStyle = Typography[variant];
|
|
22
|
+
|
|
23
|
+
const textStyle: TextStyle = {
|
|
24
|
+
...typographyStyle,
|
|
25
|
+
color: color ?? theme.textPrimary,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Text style={[textStyle, style]} {...props}>
|
|
30
|
+
{children}
|
|
31
|
+
</Text>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, ViewProps, ViewStyle } from 'react-native';
|
|
3
|
+
import { useTheme } from '@/hooks/useTheme';
|
|
4
|
+
|
|
5
|
+
type BackgroundLevel = 'root' | 'default' | 'secondary' | 'tertiary';
|
|
6
|
+
|
|
7
|
+
interface ThemedViewProps extends ViewProps {
|
|
8
|
+
level?: BackgroundLevel;
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const backgroundMap: Record<BackgroundLevel, string> = {
|
|
13
|
+
root: 'backgroundRoot',
|
|
14
|
+
default: 'backgroundDefault',
|
|
15
|
+
secondary: 'backgroundSecondary',
|
|
16
|
+
tertiary: 'backgroundTertiary',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export function ThemedView({
|
|
20
|
+
level = 'root',
|
|
21
|
+
backgroundColor,
|
|
22
|
+
style,
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}: ThemedViewProps) {
|
|
26
|
+
const { theme } = useTheme();
|
|
27
|
+
const bgColor = backgroundColor ?? (theme as any)[backgroundMap[level]];
|
|
28
|
+
|
|
29
|
+
const viewStyle: ViewStyle = {
|
|
30
|
+
backgroundColor: bgColor,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<View style={[viewStyle, style]} {...props}>
|
|
35
|
+
{children}
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
}
|