@coze-arch/cli 0.0.37 → 0.1.3-alpha.32023e

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 (169) hide show
  1. package/README.md +69 -104
  2. package/docs/deploy.md +181 -0
  3. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +7 -3
  4. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +108 -19
  5. package/lib/__templates__/expo/.cozeproj/scripts/prepare-node-modules.sh +142 -0
  6. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +3 -3
  7. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +1 -1
  8. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +1 -1
  9. package/lib/__templates__/expo/client/metro.config.js +3 -1
  10. package/lib/__templates__/expo/pnpm-lock.yaml +5 -5
  11. package/lib/__templates__/expo/server/package.json +2 -2
  12. package/lib/__templates__/expo/server/src/index.ts +1 -1
  13. package/lib/__templates__/expo/template.config.js +11 -2
  14. package/lib/__templates__/native-static/.coze +4 -2
  15. package/lib/__templates__/native-static/scripts/serve.ps1 +7 -0
  16. package/lib/__templates__/nextjs/.coze +5 -0
  17. package/lib/__templates__/nextjs/package.json +2 -2
  18. package/lib/__templates__/nextjs/pnpm-lock.yaml +57 -341
  19. package/lib/__templates__/nextjs/scripts/build.ps1 +16 -0
  20. package/lib/__templates__/nextjs/scripts/build.sh +1 -1
  21. package/lib/__templates__/nextjs/scripts/dev.ps1 +63 -0
  22. package/lib/__templates__/nextjs/scripts/dev.sh +234 -7
  23. package/lib/__templates__/nextjs/scripts/prepare-node-modules.sh +142 -0
  24. package/lib/__templates__/nextjs/scripts/prepare.ps1 +18 -0
  25. package/lib/__templates__/nextjs/scripts/prepare.sh +1 -4
  26. package/lib/__templates__/nextjs/scripts/start.ps1 +11 -0
  27. package/lib/__templates__/nextjs/scripts/validate.ps1 +8 -0
  28. package/lib/__templates__/nextjs/template.config.js +0 -57
  29. package/lib/__templates__/nuxt-vue/.coze +5 -0
  30. package/lib/__templates__/nuxt-vue/package.json +1 -1
  31. package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +5 -5
  32. package/lib/__templates__/nuxt-vue/scripts/build.ps1 +12 -0
  33. package/lib/__templates__/nuxt-vue/scripts/build.sh +1 -1
  34. package/lib/__templates__/nuxt-vue/scripts/dev.ps1 +63 -0
  35. package/lib/__templates__/nuxt-vue/scripts/dev.sh +232 -3
  36. package/lib/__templates__/nuxt-vue/scripts/prepare-node-modules.sh +142 -0
  37. package/lib/__templates__/nuxt-vue/scripts/prepare.ps1 +12 -0
  38. package/lib/__templates__/nuxt-vue/scripts/prepare.sh +1 -4
  39. package/lib/__templates__/nuxt-vue/scripts/start.ps1 +11 -0
  40. package/lib/__templates__/nuxt-vue/scripts/validate.ps1 +8 -0
  41. package/lib/__templates__/phaser/.coze +18 -0
  42. package/lib/__templates__/phaser/README.md +45 -0
  43. package/lib/__templates__/phaser/_gitignore +23 -0
  44. package/lib/__templates__/phaser/_npmrc +14 -0
  45. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0001.png +0 -0
  46. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0002.png +0 -0
  47. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0003.png +0 -0
  48. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0004.png +0 -0
  49. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0005.png +0 -0
  50. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0006.png +0 -0
  51. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0007.png +0 -0
  52. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0008.png +0 -0
  53. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0009.png +0 -0
  54. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0010.png +0 -0
  55. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0011.png +0 -0
  56. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0012.png +0 -0
  57. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0013.png +0 -0
  58. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0014.png +0 -0
  59. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0015.png +0 -0
  60. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0016.png +0 -0
  61. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0017.png +0 -0
  62. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0018.png +0 -0
  63. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0019.png +0 -0
  64. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0020.png +0 -0
  65. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0021.png +0 -0
  66. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0022.png +0 -0
  67. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0023.png +0 -0
  68. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0024.png +0 -0
  69. package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/manifest.json +11 -0
  70. package/lib/__templates__/phaser/debug-runtime/flow-graph.json +20 -0
  71. package/lib/__templates__/phaser/index.html +12 -0
  72. package/lib/__templates__/phaser/package.json +31 -0
  73. package/lib/__templates__/phaser/pnpm-lock.yaml +661 -0
  74. package/lib/__templates__/phaser/scripts/build.ps1 +12 -0
  75. package/lib/__templates__/phaser/scripts/build.sh +8 -0
  76. package/lib/__templates__/phaser/scripts/dev.ps1 +49 -0
  77. package/lib/__templates__/phaser/scripts/dev.sh +82 -0
  78. package/lib/__templates__/phaser/scripts/prepare.ps1 +8 -0
  79. package/lib/__templates__/phaser/scripts/prepare.sh +7 -0
  80. package/lib/__templates__/phaser/scripts/spawn-detached.cjs +29 -0
  81. package/lib/__templates__/phaser/scripts/start.ps1 +49 -0
  82. package/lib/__templates__/phaser/scripts/start.sh +82 -0
  83. package/lib/__templates__/phaser/scripts/validate.ps1 +7 -0
  84. package/lib/__templates__/phaser/scripts/validate.sh +7 -0
  85. package/lib/__templates__/phaser/src/assets.ts +15 -0
  86. package/lib/__templates__/phaser/src/global.d.ts +39 -0
  87. package/lib/__templates__/phaser/src/main.ts +28 -0
  88. package/lib/__templates__/phaser/src/scene/BootScene.ts +213 -0
  89. package/lib/__templates__/phaser/src/scene/DevLoadingScene.ts +69 -0
  90. package/lib/__templates__/phaser/src/style.css +28 -0
  91. package/lib/__templates__/phaser/src/types.ts +32 -0
  92. package/lib/__templates__/phaser/src/utils/asset-loader.ts +319 -0
  93. package/lib/__templates__/phaser/src/utils/index.ts +2 -0
  94. package/lib/__templates__/phaser/src/utils/mark-editable.ts +13 -0
  95. package/lib/__templates__/phaser/template.config.js +43 -0
  96. package/lib/__templates__/phaser/tsconfig.json +23 -0
  97. package/lib/__templates__/phaser/vite.config.ts +96 -0
  98. package/lib/__templates__/phaser-static/.coze +15 -0
  99. package/lib/__templates__/phaser-static/README.md +40 -0
  100. package/lib/__templates__/phaser-static/_gitignore +6 -0
  101. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0001.png +0 -0
  102. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0002.png +0 -0
  103. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0003.png +0 -0
  104. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0004.png +0 -0
  105. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0005.png +0 -0
  106. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0006.png +0 -0
  107. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0007.png +0 -0
  108. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0008.png +0 -0
  109. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0009.png +0 -0
  110. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0010.png +0 -0
  111. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0011.png +0 -0
  112. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0012.png +0 -0
  113. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0013.png +0 -0
  114. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0014.png +0 -0
  115. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0015.png +0 -0
  116. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0016.png +0 -0
  117. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0017.png +0 -0
  118. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0018.png +0 -0
  119. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0019.png +0 -0
  120. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0020.png +0 -0
  121. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0021.png +0 -0
  122. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0022.png +0 -0
  123. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0023.png +0 -0
  124. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0024.png +0 -0
  125. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/manifest.json +11 -0
  126. package/lib/__templates__/phaser-static/debug-runtime/flow-graph.json +20 -0
  127. package/lib/__templates__/phaser-static/index.html +17 -0
  128. package/lib/__templates__/phaser-static/scripts/serve.ps1 +7 -0
  129. package/lib/__templates__/phaser-static/src/assets.js +15 -0
  130. package/lib/__templates__/phaser-static/src/main.js +26 -0
  131. package/lib/__templates__/phaser-static/src/phaser.js +7 -0
  132. package/lib/__templates__/phaser-static/src/scene/BootScene.js +205 -0
  133. package/lib/__templates__/phaser-static/src/scene/DevLoadingScene.js +67 -0
  134. package/lib/__templates__/phaser-static/src/style.css +28 -0
  135. package/lib/__templates__/phaser-static/src/utils/asset-loader.js +267 -0
  136. package/lib/__templates__/phaser-static/src/utils/index.js +2 -0
  137. package/lib/__templates__/phaser-static/src/utils/mark-editable.js +3 -0
  138. package/lib/__templates__/phaser-static/template.config.js +35 -0
  139. package/lib/__templates__/pi-agent/package.json +1 -1
  140. package/lib/__templates__/pi-agent/pnpm-lock.yaml +5 -5
  141. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +3 -2
  142. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +1 -1
  143. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +3 -0
  144. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +178 -68
  145. package/lib/__templates__/taro/.cozeproj/scripts/prepare-node-modules.sh +142 -0
  146. package/lib/__templates__/taro/AGENTS.md +11 -7
  147. package/lib/__templates__/taro/README.md +4 -4
  148. package/lib/__templates__/taro/config/index.ts +10 -2
  149. package/lib/__templates__/taro/pnpm-lock.yaml +5 -5
  150. package/lib/__templates__/taro/server/package.json +1 -1
  151. package/lib/__templates__/taro/server/src/main.ts +8 -2
  152. package/lib/__templates__/templates.json +51 -1
  153. package/lib/__templates__/vite/.coze +5 -0
  154. package/lib/__templates__/vite/package.json +1 -1
  155. package/lib/__templates__/vite/pnpm-lock.yaml +5 -5
  156. package/lib/__templates__/vite/scripts/build.ps1 +16 -0
  157. package/lib/__templates__/vite/scripts/build.sh +1 -1
  158. package/lib/__templates__/vite/scripts/dev.ps1 +63 -0
  159. package/lib/__templates__/vite/scripts/dev.sh +110 -1
  160. package/lib/__templates__/vite/scripts/prepare-node-modules.sh +142 -0
  161. package/lib/__templates__/vite/scripts/prepare.ps1 +18 -0
  162. package/lib/__templates__/vite/scripts/prepare.sh +1 -4
  163. package/lib/__templates__/vite/scripts/start.ps1 +11 -0
  164. package/lib/__templates__/vite/scripts/validate.ps1 +8 -0
  165. package/lib/__templates__/vite/template.config.js +0 -57
  166. package/lib/cli.js +3751 -222
  167. package/lib/deploy/package-project.js +244 -0
  168. package/lib/deploy/package-project.py +183 -0
  169. package/package.json +5 -2
@@ -0,0 +1,142 @@
1
+ #!/usr/bin/env bash
2
+ # Install dependencies on local disk and expose them to the source tree by symlink.
3
+ set -euo pipefail
4
+
5
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
6
+ if [ "$(basename "$(dirname "$SCRIPT_DIR")")" = ".cozeproj" ]; then
7
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd -P)"
8
+ else
9
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"
10
+ fi
11
+
12
+ command -v pnpm >/dev/null 2>&1 || {
13
+ echo "[node_modules] pnpm is required" >&2
14
+ exit 1
15
+ }
16
+
17
+ DRIVE_ROOT="${COZE_DRIVE_ROOT:-/Coze/Drive}"
18
+ if [ -d "$DRIVE_ROOT" ]; then
19
+ DRIVE_ROOT="$(cd "$DRIVE_ROOT" && pwd -P)"
20
+ else
21
+ DRIVE_ROOT="${DRIVE_ROOT%/}"
22
+ fi
23
+ case "$PROJECT_ROOT" in
24
+ "$DRIVE_ROOT"|"$DRIVE_ROOT"/*) ;;
25
+ *)
26
+ (cd "$PROJECT_ROOT" && pnpm install "$@")
27
+ exit 0
28
+ ;;
29
+ esac
30
+
31
+ COZE_ROOT="${COZE_DIR_PATH:-${HOME}/Coze/tmp}"
32
+ PROJECT_ID="$(basename "$PROJECT_ROOT")-$(printf '%s' "$PROJECT_ROOT" | cksum | awk '{print $1}')"
33
+ mkdir -p "$COZE_ROOT/nm"
34
+ COZE_ROOT="$(cd "$COZE_ROOT" && pwd -P)"
35
+ WORK_DIR="$COZE_ROOT/nm/$PROJECT_ID"
36
+ mkdir -p "$WORK_DIR"
37
+ case "$WORK_DIR" in
38
+ "$DRIVE_ROOT"|"$DRIVE_ROOT"/*)
39
+ echo "[node_modules] local dependency directory must not be on Coze Drive: $WORK_DIR" >&2
40
+ exit 1
41
+ ;;
42
+ esac
43
+
44
+ # Mirror the project with symlinks. node_modules stays real in WORK_DIR;
45
+ # workspace directories stay real too, so pnpm never writes them to Drive.
46
+ mirror_root() {
47
+ local entry name
48
+ while IFS= read -r -d '' entry; do
49
+ name="$(basename "$entry")"
50
+ case "$name" in
51
+ node_modules|pnpm-lock.yaml) continue ;;
52
+ client|server)
53
+ [ -f "$PROJECT_ROOT/$name/package.json" ] && continue
54
+ ;;
55
+ esac
56
+ rm -rf "$entry"
57
+ done < <(find "$WORK_DIR" -mindepth 1 -maxdepth 1 -print0)
58
+
59
+ while IFS= read -r -d '' entry; do
60
+ name="$(basename "$entry")"
61
+ case "$name" in
62
+ node_modules|pnpm-lock.yaml) continue ;;
63
+ client|server)
64
+ [ -f "$entry/package.json" ] && continue
65
+ ;;
66
+ esac
67
+ ln -s "$entry" "$WORK_DIR/$name"
68
+ done < <(find "$PROJECT_ROOT" -mindepth 1 -maxdepth 1 -print0)
69
+ }
70
+
71
+ mirror_workspace() {
72
+ local workspace="$1" source_dir="$PROJECT_ROOT/$1" work_dir="$WORK_DIR/$1"
73
+ local entry name
74
+ if [ -L "$work_dir" ] || { [ -e "$work_dir" ] && [ ! -d "$work_dir" ]; }; then
75
+ rm -rf "$work_dir"
76
+ fi
77
+ mkdir -p "$work_dir"
78
+
79
+ while IFS= read -r -d '' entry; do
80
+ [ "$(basename "$entry")" = "node_modules" ] || rm -rf "$entry"
81
+ done < <(find "$work_dir" -mindepth 1 -maxdepth 1 -print0)
82
+
83
+ while IFS= read -r -d '' entry; do
84
+ name="$(basename "$entry")"
85
+ [ "$name" = "node_modules" ] || ln -s "$entry" "$work_dir/$name"
86
+ done < <(find "$source_dir" -mindepth 1 -maxdepth 1 -print0)
87
+ }
88
+
89
+ mirror_root
90
+ for workspace in client server; do
91
+ if [ -f "$PROJECT_ROOT/$workspace/package.json" ]; then
92
+ mirror_workspace "$workspace"
93
+ fi
94
+ done
95
+
96
+ # pnpm refuses to update a symlinked lockfile, so install against a local copy.
97
+ rm -rf "$WORK_DIR/pnpm-lock.yaml"
98
+ if [ -f "$PROJECT_ROOT/pnpm-lock.yaml" ]; then
99
+ cp "$PROJECT_ROOT/pnpm-lock.yaml" "$WORK_DIR/pnpm-lock.yaml"
100
+ fi
101
+
102
+ echo "[node_modules] Installing dependencies in $WORK_DIR"
103
+ if ! (cd "$WORK_DIR" && pnpm install "$@"); then
104
+ rm -f "$WORK_DIR/pnpm-lock.yaml"
105
+ exit 1
106
+ fi
107
+
108
+ if [ -f "$WORK_DIR/pnpm-lock.yaml" ]; then
109
+ temporary_lockfile="$(mktemp "$PROJECT_ROOT/.pnpm-lock.yaml.XXXXXX")"
110
+ cp "$WORK_DIR/pnpm-lock.yaml" "$temporary_lockfile"
111
+ chmod 0644 "$temporary_lockfile"
112
+ mv -f "$temporary_lockfile" "$PROJECT_ROOT/pnpm-lock.yaml"
113
+ fi
114
+
115
+ link_node_modules() {
116
+ local source_dir="$1" target_dir="$2"
117
+ local current=""
118
+ mkdir -p "$target_dir"
119
+ if [ -L "$source_dir/node_modules" ]; then
120
+ current="$(readlink "$source_dir/node_modules")"
121
+ case "$current" in
122
+ "$COZE_ROOT"/nm/*/node_modules|"$COZE_ROOT"/nm/*/*/node_modules) ;;
123
+ *)
124
+ echo "[node_modules] refusing to replace unmanaged symlink: $source_dir/node_modules" >&2
125
+ exit 1
126
+ ;;
127
+ esac
128
+ rm "$source_dir/node_modules"
129
+ elif [ -e "$source_dir/node_modules" ]; then
130
+ rm -rf "$source_dir/node_modules"
131
+ fi
132
+ ln -s "$target_dir" "$source_dir/node_modules"
133
+ }
134
+
135
+ link_node_modules "$PROJECT_ROOT" "$WORK_DIR/node_modules"
136
+ for workspace in client server; do
137
+ if [ -f "$PROJECT_ROOT/$workspace/package.json" ]; then
138
+ link_node_modules "$PROJECT_ROOT/$workspace" "$WORK_DIR/$workspace/node_modules"
139
+ fi
140
+ done
141
+
142
+ echo "[node_modules] Dependencies ready"
@@ -1,7 +1,7 @@
1
1
  #!/bin/bash
2
2
  if [ -z "${BASH_VERSION:-}" ]; then exec /usr/bin/env bash "$0" "$@"; fi
3
3
  set -euo pipefail
4
- ROOT_DIR="$(pwd)"
4
+ ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
5
5
 
6
6
  # ==================== 工具函数 ====================
7
7
  info() {
@@ -32,8 +32,8 @@ info "==================== 安装 Node 依赖 ===================="
32
32
  info "开始安装 Node 依赖"
33
33
  if [ -f "$ROOT_DIR/package.json" ]; then
34
34
  info "进入目录:$ROOT_DIR"
35
- info "正在执行:pnpm install"
36
- (cd "$ROOT_DIR" && pnpm install --registry=https://registry.npmmirror.com) || error "Node 依赖安装失败"
35
+ info "正在执行受管依赖准备入口"
36
+ bash "$ROOT_DIR/.cozeproj/scripts/prepare-node-modules.sh" --registry=https://registry.npmmirror.com || error "Node 依赖安装失败"
37
37
  else
38
38
  warn "未找到 $ROOT_DIR/package.json 文件,请检查路径是否正确"
39
39
  fi
@@ -5,7 +5,7 @@ set -euo pipefail
5
5
  ROOT_DIR="$(pwd)"
6
6
 
7
7
  HOST="${HOST:-0.0.0.0}"
8
- PORT="${PORT:-5000}"
8
+ PORT="${DEPLOY_RUN_PORT:-${PORT:-<%= port %>}}"
9
9
 
10
10
  # ==================== 工具函数 ====================
11
11
  info() {
@@ -4,7 +4,7 @@ ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
4
4
  SERVER_DIR="$ROOT_DIR/server"
5
5
  LOG_DIR="${COZE_LOG_DIR:-$ROOT_DIR/logs}"
6
6
  LOG_SERVER_FILE="$LOG_DIR/server.log"
7
- SERVER_PORT="${SERVER_PORT:-9091}"
7
+ SERVER_PORT="${SERVER_PORT:-<%= serverPort %>}"
8
8
 
9
9
  mkdir -p "$LOG_DIR"
10
10
 
@@ -32,7 +32,9 @@ config.resolver.blockList = [
32
32
  /.*node_modules\/\.pnpm\/.*_tmp_\d+.*/,
33
33
  ];
34
34
 
35
- const BACKEND_TARGET = 'http://localhost:9091';
35
+ const DEFAULT_BACKEND_PORT = '<%= serverPort %>';
36
+ const BACKEND_PORT = process.env.SERVER_PORT || DEFAULT_BACKEND_PORT;
37
+ const BACKEND_TARGET = `http://localhost:${BACKEND_PORT}`;
36
38
 
37
39
  const apiProxy = createProxyMiddleware({
38
40
  target: BACKEND_TARGET,
@@ -269,8 +269,8 @@ importers:
269
269
  specifier: ^2.8.5
270
270
  version: 2.8.6
271
271
  coze-coding-dev-sdk:
272
- specifier: ^0.7.24
273
- version: 0.7.24(openai@6.16.0(ws@8.19.0)(zod@4.3.6))(ws@8.19.0)
272
+ specifier: ^0.7.25
273
+ version: 0.7.25(openai@6.16.0(ws@8.19.0)(zod@4.3.6))(ws@8.19.0)
274
274
  dayjs:
275
275
  specifier: ^1.11.20
276
276
  version: 1.11.20
@@ -2643,8 +2643,8 @@ packages:
2643
2643
  resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==}
2644
2644
  engines: {node: '>=10'}
2645
2645
 
2646
- coze-coding-dev-sdk@0.7.24:
2647
- resolution: {integrity: sha512-oL9Tg5PwxP6iMixonzzMO4aBjOKWcFUMVM+iz5dPyaqQkG84HP1y9DqK5DJVmtdfJuYdAW7pzOatDqLvgvZiXg==}
2646
+ coze-coding-dev-sdk@0.7.25:
2647
+ resolution: {integrity: sha512-5683ngikMdsRW0slGTE2OAZ1Fyj0lhkC4fGNOwsqKc35e68/gtg9KmmtK9CK9SZ+5/oIn/4wLoHXFB0gHJtO2A==}
2648
2648
  engines: {node: '>=18.0.0'}
2649
2649
  hasBin: true
2650
2650
 
@@ -9088,7 +9088,7 @@ snapshots:
9088
9088
  path-type: 4.0.0
9089
9089
  yaml: 1.10.2
9090
9090
 
9091
- coze-coding-dev-sdk@0.7.24(openai@6.16.0(ws@8.19.0)(zod@4.3.6))(ws@8.19.0):
9091
+ coze-coding-dev-sdk@0.7.25(openai@6.16.0(ws@8.19.0)(zod@4.3.6))(ws@8.19.0):
9092
9092
  dependencies:
9093
9093
  '@langchain/core': 1.1.17(openai@6.16.0(ws@8.19.0)(zod@4.3.6))
9094
9094
  '@langchain/openai': 1.2.3(@langchain/core@1.1.17(openai@6.16.0(ws@8.19.0)(zod@4.3.6)))(ws@8.19.0)
@@ -6,13 +6,13 @@
6
6
  "build": "node build.js",
7
7
  "dev": "bash ../.cozeproj/scripts/server_dev_run.sh",
8
8
  "preinstall": "npx only-allow pnpm",
9
- "start": "NODE_ENV=production PORT=${PORT:-5000} node dist/index.js",
9
+ "start": "NODE_ENV=production PORT=${PORT:-<%= port %>} node dist/index.js",
10
10
  "lint": "tsc --noEmit"
11
11
  },
12
12
  "dependencies": {
13
13
  "@supabase/supabase-js": "2.95.3",
14
14
  "cors": "^2.8.5",
15
- "coze-coding-dev-sdk": "^0.7.24",
15
+ "coze-coding-dev-sdk": "^0.7.25",
16
16
  "dayjs": "^1.11.20",
17
17
  "dotenv": "^17.2.3",
18
18
  "drizzle-orm": "^0.45.1",
@@ -2,7 +2,7 @@ import express from "express";
2
2
  import cors from "cors";
3
3
 
4
4
  const app = express();
5
- const port = process.env.PORT || 9091;
5
+ const port = process.env.PORT || <%= serverPort %>;
6
6
 
7
7
  // Middleware
8
8
  app.use(cors());
@@ -6,6 +6,7 @@
6
6
 
7
7
 
8
8
 
9
+
9
10
  export const paramsSchema = {
10
11
  type: 'object',
11
12
  properties: {
@@ -18,11 +19,18 @@ export const paramsSchema = {
18
19
  },
19
20
  port: {
20
21
  type: 'number',
21
- default: 8081,
22
+ default: 5000,
22
23
  minimum: 1024,
23
24
  maximum: 65535,
24
25
  description: 'Metro bundler port',
25
26
  },
27
+ serverPort: {
28
+ type: 'number',
29
+ default: 9091,
30
+ minimum: 1024,
31
+ maximum: 65535,
32
+ description: 'Express backend server port',
33
+ },
26
34
  },
27
35
  required: [],
28
36
  additionalProperties: false,
@@ -32,7 +40,8 @@ const config = {
32
40
  description: 'Expo template for React Native applications',
33
41
  paramsSchema,
34
42
  defaultParams: {
35
- port: 9090,
43
+ port: 5000,
44
+ serverPort: 9091,
36
45
  appName: 'my-expo-app',
37
46
  },
38
47
  onBeforeRender: async context => {
@@ -5,8 +5,10 @@ project_type = "web"
5
5
 
6
6
  [dev]
7
7
  build = []
8
- run = [ "sh", "-c", "python -m http.server ${DEPLOY_RUN_PORT} --bind 0.0.0.0" ]
8
+ run = ["python3", "-m", "http.server", "${DEPLOY_RUN_PORT}", "--bind", "0.0.0.0"]
9
+ run_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "./scripts/serve.ps1"]
9
10
 
10
11
  [deploy]
11
12
  build = []
12
- run = [ "sh", "-c", "python -m http.server ${DEPLOY_RUN_PORT} --bind 0.0.0.0" ]
13
+ run = ["python3", "-m", "http.server", "${DEPLOY_RUN_PORT}", "--bind", "0.0.0.0"]
14
+ run_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "./scripts/serve.ps1"]
@@ -0,0 +1,7 @@
1
+ $ErrorActionPreference = "Stop"
2
+
3
+ $port = if ($env:DEPLOY_RUN_PORT) { $env:DEPLOY_RUN_PORT } else { "8000" }
4
+
5
+ Write-Host "Starting static server on port $port..."
6
+ & python -m http.server $port --bind 0.0.0.0
7
+ exit $LASTEXITCODE
@@ -4,11 +4,16 @@ project_type = "web"
4
4
 
5
5
  [dev]
6
6
  build = ["bash", "./scripts/prepare.sh"]
7
+ build_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "./scripts/prepare.ps1"]
7
8
  run = ["bash", "./scripts/dev.sh"]
9
+ run_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "./scripts/dev.ps1"]
8
10
  validate = ["bash", "./scripts/validate.sh"]
11
+ validate_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "./scripts/validate.ps1"]
9
12
  deps = ["git"] # -> apt install git
10
13
 
11
14
  [deploy]
12
15
  build = ["bash","./scripts/build.sh"]
16
+ build_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "./scripts/build.ps1"]
13
17
  run = ["bash","./scripts/start.sh"]
18
+ run_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "./scripts/start.ps1"]
14
19
  deps = ["git"] # -> apt install git
@@ -47,7 +47,7 @@
47
47
  "class-variance-authority": "^0.7.1",
48
48
  "clsx": "^2.1.1",
49
49
  "cmdk": "^1.1.1",
50
- "coze-coding-dev-sdk": "^0.7.16",
50
+ "coze-coding-dev-sdk": "^0.7.25",
51
51
  "date-fns": "^4.1.0",
52
52
  "dotenv": "^17.2.3",
53
53
  "drizzle-kit": "^0.31.8",
@@ -56,7 +56,7 @@
56
56
  "embla-carousel-react": "^8.6.0",
57
57
  "input-otp": "^1.4.2",
58
58
  "lucide-react": "^0.468.0",
59
- "next": "16.1.1",
59
+ "next": "16.3.3",
60
60
  "next-themes": "^0.4.6",
61
61
  "pg": "^8.16.3",
62
62
  "react": "19.2.3",