@coze-arch/cli 0.0.1-alpha.d85d9d → 0.0.1-alpha.de5a13

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 (41) hide show
  1. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +13 -12
  2. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +9 -8
  3. package/lib/__templates__/expo/client/package.json +35 -35
  4. package/lib/__templates__/expo/client/screens/demo/index.tsx +3 -3
  5. package/lib/__templates__/expo/package.json +1 -1
  6. package/lib/__templates__/expo/patches/{expo@54.0.32.patch → expo@54.0.33.patch} +3 -2
  7. package/lib/__templates__/expo/pnpm-lock.yaml +336 -1735
  8. package/lib/__templates__/expo/server/package.json +9 -7
  9. package/lib/__templates__/expo/server/src/index.ts +1 -0
  10. package/lib/__templates__/expo/template.config.js +56 -0
  11. package/lib/__templates__/nextjs/.babelrc +0 -3
  12. package/lib/__templates__/nextjs/package.json +3 -1
  13. package/lib/__templates__/nextjs/pnpm-lock.yaml +116 -106
  14. package/lib/__templates__/nextjs/src/app/page.tsx +18 -60
  15. package/lib/__templates__/nextjs/template.config.js +49 -14
  16. package/lib/__templates__/taro/.coze +1 -1
  17. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +5 -6
  18. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +6 -8
  19. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +0 -15
  20. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +28 -5
  21. package/lib/__templates__/taro/_gitignore +40 -0
  22. package/lib/__templates__/taro/_npmrc +18 -0
  23. package/lib/__templates__/taro/config/index.ts +3 -2
  24. package/lib/__templates__/taro/eslint.config.mjs +57 -0
  25. package/lib/__templates__/taro/package.json +30 -32
  26. package/lib/__templates__/taro/pnpm-lock.yaml +466 -679
  27. package/lib/__templates__/taro/server/package.json +8 -7
  28. package/lib/__templates__/taro/server/src/main.ts +14 -2
  29. package/lib/__templates__/taro/src/app.css +29 -18
  30. package/lib/__templates__/taro/src/app.ts +11 -25
  31. package/lib/__templates__/taro/src/index.html +20 -1
  32. package/lib/__templates__/taro/src/pages/index/index.tsx +14 -11
  33. package/lib/__templates__/taro/src/utils/wx-debug.ts +23 -0
  34. package/lib/__templates__/vite/package.json +3 -1
  35. package/lib/__templates__/vite/pnpm-lock.yaml +142 -1659
  36. package/lib/__templates__/vite/src/main.ts +17 -47
  37. package/lib/__templates__/vite/template.config.js +49 -14
  38. package/lib/cli.js +42 -62
  39. package/package.json +1 -1
  40. package/lib/__templates__/taro/.eslintrc +0 -40
  41. package/lib/__templates__/taro/commitlint.config.mjs +0 -1
@@ -1,7 +1,7 @@
1
1
  ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
2
2
  PREVIEW_DIR="${COZE_PREVIEW_DIR:-/source/preview}"
3
3
  LOG_DIR="${COZE_LOG_DIR:-$ROOT_DIR/logs}"
4
- LOG_FILE="$LOG_DIR/app.log"
4
+ LOG_CLIENT_FILE="$LOG_DIR/client.log"
5
5
  mkdir -p "$LOG_DIR"
6
6
 
7
7
  # ==================== 配置项 ====================
@@ -89,14 +89,17 @@ ensure_port() {
89
89
  pipe_to_log() {
90
90
  local source="${1:-CLIENT}"
91
91
  local raw_log="${2:-}"
92
- local line timestamp ts msg record
92
+ local line clean_line timestamp
93
93
  while IFS= read -r line || [ -n "$line" ]; do
94
+ clean_line=$(printf '%s' "$line" | sed 's/\x1b\[[0-9;]*[mA-Za-z]//g')
95
+ if echo "$clean_line" | grep -qE '(^(Web|iOS|Android) node_modules/.*expo-router.*entry\.js.*%|^(Web|iOS|Android) Bundled [0-9]+ms node_modules/.*expo-router.*entry\.js|Logs will appear in the browser)'; then
96
+ continue
97
+ fi
94
98
  if [ -n "$raw_log" ]; then
95
- echo "$line" >> "$raw_log"
99
+ timestamp=$(date '+%Y-%m-%d %H:%M:%S')
100
+ echo "[$timestamp] $clean_line" >> "$raw_log"
96
101
  fi
97
- line=$(echo "[$source] $line" | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g; s/\x1b\[[0-9;]*m//g')
98
- msg="${line}"
99
- echo "$msg"
102
+ printf '[%s] %s\n' "$source" "$clean_line"
100
103
  done
101
104
  }
102
105
 
@@ -116,10 +119,10 @@ start_expo() {
116
119
 
117
120
  if [ "$offline" = "1" ]; then
118
121
  ( EXPO_OFFLINE=1 EXPO_NO_DEPENDENCY_VALIDATION=1 EXPO_PUBLIC_BACKEND_BASE_URL="$EXPO_PUBLIC_BACKEND_BASE_URL" EXPO_PACKAGER_PROXY_URL="$EXPO_PACKAGER_PROXY_URL" EXPO_PUBLIC_COZE_PROJECT_ID="$EXPO_PUBLIC_COZE_PROJECT_ID" \
119
- nohup npx expo start --clear --port "$EXPO_PORT" 2>&1 | pipe_to_log "CLIENT" "$ROOT_DIR/logs/client.log" ) &
122
+ nohup npx expo start --clear --port "$EXPO_PORT" 2>&1 | pipe_to_log "CLIENT" "$LOG_CLIENT_FILE" ) &
120
123
  else
121
124
  ( EXPO_NO_DEPENDENCY_VALIDATION=1 EXPO_PUBLIC_BACKEND_BASE_URL="$EXPO_PUBLIC_BACKEND_BASE_URL" EXPO_PACKAGER_PROXY_URL="$EXPO_PACKAGER_PROXY_URL" EXPO_PUBLIC_COZE_PROJECT_ID="$EXPO_PUBLIC_COZE_PROJECT_ID" \
122
- nohup npx expo start --clear --port "$EXPO_PORT" 2>&1 | pipe_to_log "CLIENT" "$ROOT_DIR/logs/client.log" ) &
125
+ nohup npx expo start --clear --port "$EXPO_PORT" 2>&1 | pipe_to_log "CLIENT" "$LOG_CLIENT_FILE" ) &
123
126
  fi
124
127
  EXPO_PID=$!
125
128
  disown $EXPO_PID 2>/dev/null || true
@@ -130,9 +133,9 @@ start_expo() {
130
133
  detect_expo_fetch_failed() {
131
134
  local timeout="${1:-8}"
132
135
  local waited=0
133
- local log_file="$ROOT_DIR/logs/client.log"
136
+ local log_file="$LOG_CLIENT_FILE"
134
137
  while [ "$waited" -lt "$timeout" ]; do
135
- if [ -f "$log_file" ] && grep -q "TypeError: fetch failed" "$log_file" 2>/dev/null; then
138
+ if [ -f "$log_file" ] && tail -n 100 "$log_file" 2>/dev/null | grep -q "TypeError: fetch failed"; then
136
139
  return 0
137
140
  fi
138
141
  sleep 1
@@ -166,8 +169,6 @@ check_command "pnpm"
166
169
  check_command "lsof"
167
170
  check_command "bash"
168
171
 
169
- echo "准备日志目录:$ROOT_DIR/logs"
170
- mkdir -p "$ROOT_DIR/logs"
171
172
  # 端口占用预检查与处理
172
173
  ensure_port SERVER_PORT "$SERVER_PORT"
173
174
  ensure_port EXPO_PORT "$EXPO_PORT"
@@ -2,8 +2,8 @@
2
2
 
3
3
  ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
4
4
  SERVER_DIR="$ROOT_DIR/server"
5
- LOG_DIR="$ROOT_DIR/logs"
6
- LOG_FILE="$LOG_DIR/server.log"
5
+ LOG_DIR="${COZE_LOG_DIR:-$ROOT_DIR/logs}"
6
+ LOG_SERVER_FILE="$LOG_DIR/server.log"
7
7
  SERVER_PORT="${SERVER_PORT:-9091}"
8
8
 
9
9
  mkdir -p "$LOG_DIR"
@@ -11,13 +11,14 @@ mkdir -p "$LOG_DIR"
11
11
  pipe_to_log() {
12
12
  local source="${1:-SERVER}"
13
13
  local raw_log="${2:-}"
14
- local line
14
+ local line clean_line timestamp
15
15
  while IFS= read -r line || [ -n "$line" ]; do
16
+ clean_line=$(printf '%s' "$line" | sed 's/\x1b\[[0-9;]*[mA-Za-z]//g')
16
17
  if [ -n "$raw_log" ]; then
17
- echo "$line" >> "$raw_log"
18
+ timestamp=$(date '+%Y-%m-%d %H:%M:%S')
19
+ echo "[$timestamp] $clean_line" >> "$raw_log"
18
20
  fi
19
- line=$(echo "[$source] $line" | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g; s/\x1b\[[0-9;]*m//g')
20
- echo "$line"
21
+ printf '[%s] %s\n' "$source" "$clean_line"
21
22
  done
22
23
  }
23
24
 
@@ -36,10 +37,10 @@ kill_old_server() {
36
37
  echo "==================== Server Dev Run ===================="
37
38
  echo "Server 目录:$SERVER_DIR"
38
39
  echo "Server 端口:$SERVER_PORT"
39
- echo "日志文件:$LOG_FILE"
40
+ echo "日志文件:$LOG_SERVER_FILE"
40
41
 
41
42
  kill_old_server
42
43
 
43
44
  echo "启动 server 服务..."
44
45
  cd "$SERVER_DIR"
45
- NODE_ENV=development PORT="$SERVER_PORT" npx tsx ./src/index.ts 2>&1 | pipe_to_log "SERVER" "$LOG_FILE"
46
+ NODE_ENV=development PORT="$SERVER_PORT" npx tsx ./src/index.ts 2>&1 | pipe_to_log "SERVER" "$LOG_SERVER_FILE"
@@ -15,38 +15,38 @@
15
15
  "preset": "jest-expo"
16
16
  },
17
17
  "dependencies": {
18
- "@expo/metro-runtime": "^6.1.2",
19
- "@expo/vector-icons": "^15.0.0",
20
- "@react-native-async-storage/async-storage": "^2.2.0",
21
- "@react-native-community/datetimepicker": "^8.5.0",
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.0",
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
25
  "@react-navigation/bottom-tabs": "^7.2.0",
26
26
  "@react-navigation/native": "^7.0.14",
27
27
  "dayjs": "^1.11.19",
28
- "expo": "54.0.32",
29
- "expo-auth-session": "^7.0.9",
30
- "expo-av": "~16.0.6",
31
- "expo-blur": "~15.0.6",
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
32
  "expo-camera": "~17.0.10",
33
- "expo-constants": "~18.0.8",
34
- "expo-crypto": "^15.0.7",
33
+ "expo-constants": "~18.0.13",
34
+ "expo-crypto": "~15.0.8",
35
35
  "expo-file-system": "~19.0.21",
36
- "expo-font": "~14.0.7",
37
- "expo-haptics": "~15.0.6",
38
- "expo-image-picker": "~17.0.7",
39
- "expo-linear-gradient": "~15.0.6",
40
- "expo-linking": "~8.0.7",
41
- "expo-location": "~19.0.7",
42
- "expo-image": "^3.0.11",
43
- "js-base64": "^3.7.7",
44
- "expo-router": "~6.0.0",
45
- "expo-splash-screen": "~31.0.8",
46
- "expo-status-bar": "~3.0.7",
47
- "expo-symbols": "~1.0.6",
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",
48
47
  "expo-system-ui": "~6.0.9",
49
48
  "expo-web-browser": "~15.0.10",
49
+ "js-base64": "^3.7.7",
50
50
  "react": "19.1.0",
51
51
  "react-dom": "19.1.0",
52
52
  "react-native": "0.81.5",
@@ -54,25 +54,26 @@
54
54
  "react-native-gesture-handler": "~2.28.0",
55
55
  "react-native-keyboard-aware-scroll-view": "^0.9.5",
56
56
  "react-native-modal-datetime-picker": "18.0.0",
57
- "react-native-reanimated": "~4.1.0",
57
+ "react-native-reanimated": "~4.1.1",
58
58
  "react-native-safe-area-context": "~5.6.0",
59
59
  "react-native-screens": "~4.16.0",
60
- "react-native-svg": "15.15.0",
60
+ "react-native-svg": "15.12.1",
61
61
  "react-native-toast-message": "^2.3.3",
62
- "react-native-web": "^0.21.2",
63
- "react-native-webview": "~13.15.0",
62
+ "react-native-web": "~0.21.0",
63
+ "react-native-webview": "13.15.0",
64
64
  "react-native-worklets": "0.5.1",
65
65
  "zod": "^4.2.1"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@babel/core": "^7.25.2",
69
- "babel-plugin-module-resolver": "^5.0.2",
70
- "babel-preset-expo": "^54.0.9",
71
69
  "@eslint/js": "^9.27.0",
72
70
  "@types/jest": "^29.5.12",
73
71
  "@types/react": "~19.1.0",
74
72
  "@types/react-test-renderer": "19.1.0",
73
+ "babel-plugin-module-resolver": "^5.0.2",
74
+ "babel-preset-expo": "^54.0.9",
75
75
  "chalk": "^4.1.2",
76
+ "connect": "^3.7.0",
76
77
  "depcheck": "^1.4.7",
77
78
  "esbuild": "0.27.2",
78
79
  "eslint": "^9.39.2",
@@ -83,13 +84,12 @@
83
84
  "eslint-plugin-react-hooks": "^7.0.1",
84
85
  "eslint-plugin-regexp": "^2.10.0",
85
86
  "globals": "^16.1.0",
87
+ "http-proxy-middleware": "^3.0.5",
86
88
  "jest": "^29.2.1",
87
- "jest-expo": "~54.0.10",
89
+ "jest-expo": "~54.0.17",
88
90
  "react-test-renderer": "19.1.0",
89
91
  "tsx": "^4.21.0",
90
92
  "typescript": "^5.8.3",
91
- "typescript-eslint": "^8.32.1",
92
- "connect": "^3.7.0",
93
- "http-proxy-middleware": "^3.0.5"
93
+ "typescript-eslint": "^8.32.1"
94
94
  }
95
95
  }
@@ -15,10 +15,10 @@ export default function DemoPage() {
15
15
  >
16
16
  <Image
17
17
  style={styles.logo}
18
- source="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/expo/coze-loading.gif"
18
+ source="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/icon/coze-coding.gif"
19
19
  ></Image>
20
- <Text style={{...styles.title, color: theme.textPrimary}}>APP 开发中</Text>
21
- <Text style={{...styles.description, color: theme.textSecondary}}>即将为您呈现应用界面</Text>
20
+ <Text style={{...styles.title, color: theme.textPrimary}}>应用开发中</Text>
21
+ <Text style={{...styles.description, color: theme.textSecondary}}>请稍候,界面即将呈现</Text>
22
22
  </View>
23
23
  </Screen>
24
24
  );
@@ -19,7 +19,7 @@
19
19
  "esbuild": "0.27.2"
20
20
  },
21
21
  "patchedDependencies": {
22
- "expo@54.0.32": "patches/expo@54.0.32.patch"
22
+ "expo@54.0.33": "patches/expo@54.0.33.patch"
23
23
  }
24
24
  }
25
25
  }
@@ -1,8 +1,8 @@
1
1
  diff --git a/src/async-require/hmr.ts b/src/async-require/hmr.ts
2
- index 33ce50ee2950c40d2b0553b148710f1e24e44f3d..a13d6f2da10dea858019cc991c21753f64f01fd0 100644
2
+ index 33ce50ee2950c40d2b0553b148710f1e24e44f3d..3d78cb02dd7e96ac9727a2935d8178f2c7e95982 100644
3
3
  --- a/src/async-require/hmr.ts
4
4
  +++ b/src/async-require/hmr.ts
5
- @@ -216,6 +216,39 @@ const HMRClient: HMRClientNativeInterface = {
5
+ @@ -216,6 +216,40 @@ const HMRClient: HMRClientNativeInterface = {
6
6
 
7
7
  client.on('update-done', () => {
8
8
  hideLoading();
@@ -39,6 +39,7 @@ index 33ce50ee2950c40d2b0553b148710f1e24e44f3d..a13d6f2da10dea858019cc991c21753f
39
39
  + checkServerAndReload(6);
40
40
  + }, 35_000);
41
41
  + }
42
+ + console.log('[HMR] Update done.');
42
43
  });
43
44
 
44
45
  client.on('error', (data: { type: string; message: string }) => {