@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.
- package/README.md +69 -104
- package/docs/deploy.md +181 -0
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +7 -3
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +108 -19
- package/lib/__templates__/expo/.cozeproj/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +3 -3
- package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +1 -1
- package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +1 -1
- package/lib/__templates__/expo/client/metro.config.js +3 -1
- package/lib/__templates__/expo/pnpm-lock.yaml +5 -5
- package/lib/__templates__/expo/server/package.json +2 -2
- package/lib/__templates__/expo/server/src/index.ts +1 -1
- package/lib/__templates__/expo/template.config.js +11 -2
- package/lib/__templates__/native-static/.coze +4 -2
- package/lib/__templates__/native-static/scripts/serve.ps1 +7 -0
- package/lib/__templates__/nextjs/.coze +5 -0
- package/lib/__templates__/nextjs/package.json +2 -2
- package/lib/__templates__/nextjs/pnpm-lock.yaml +57 -341
- package/lib/__templates__/nextjs/scripts/build.ps1 +16 -0
- package/lib/__templates__/nextjs/scripts/build.sh +1 -1
- package/lib/__templates__/nextjs/scripts/dev.ps1 +63 -0
- package/lib/__templates__/nextjs/scripts/dev.sh +234 -7
- package/lib/__templates__/nextjs/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/nextjs/scripts/prepare.ps1 +18 -0
- package/lib/__templates__/nextjs/scripts/prepare.sh +1 -4
- package/lib/__templates__/nextjs/scripts/start.ps1 +11 -0
- package/lib/__templates__/nextjs/scripts/validate.ps1 +8 -0
- package/lib/__templates__/nextjs/template.config.js +0 -57
- package/lib/__templates__/nuxt-vue/.coze +5 -0
- package/lib/__templates__/nuxt-vue/package.json +1 -1
- package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +5 -5
- package/lib/__templates__/nuxt-vue/scripts/build.ps1 +12 -0
- package/lib/__templates__/nuxt-vue/scripts/build.sh +1 -1
- package/lib/__templates__/nuxt-vue/scripts/dev.ps1 +63 -0
- package/lib/__templates__/nuxt-vue/scripts/dev.sh +232 -3
- package/lib/__templates__/nuxt-vue/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/nuxt-vue/scripts/prepare.ps1 +12 -0
- package/lib/__templates__/nuxt-vue/scripts/prepare.sh +1 -4
- package/lib/__templates__/nuxt-vue/scripts/start.ps1 +11 -0
- package/lib/__templates__/nuxt-vue/scripts/validate.ps1 +8 -0
- package/lib/__templates__/phaser/.coze +18 -0
- package/lib/__templates__/phaser/README.md +45 -0
- package/lib/__templates__/phaser/_gitignore +23 -0
- package/lib/__templates__/phaser/_npmrc +14 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0001.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0002.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0003.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0004.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0005.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0006.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0007.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0008.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0009.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0010.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0011.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0012.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0013.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0014.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0015.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0016.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0017.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0018.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0019.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0020.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0021.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0022.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0023.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0024.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/manifest.json +11 -0
- package/lib/__templates__/phaser/debug-runtime/flow-graph.json +20 -0
- package/lib/__templates__/phaser/index.html +12 -0
- package/lib/__templates__/phaser/package.json +31 -0
- package/lib/__templates__/phaser/pnpm-lock.yaml +661 -0
- package/lib/__templates__/phaser/scripts/build.ps1 +12 -0
- package/lib/__templates__/phaser/scripts/build.sh +8 -0
- package/lib/__templates__/phaser/scripts/dev.ps1 +49 -0
- package/lib/__templates__/phaser/scripts/dev.sh +82 -0
- package/lib/__templates__/phaser/scripts/prepare.ps1 +8 -0
- package/lib/__templates__/phaser/scripts/prepare.sh +7 -0
- package/lib/__templates__/phaser/scripts/spawn-detached.cjs +29 -0
- package/lib/__templates__/phaser/scripts/start.ps1 +49 -0
- package/lib/__templates__/phaser/scripts/start.sh +82 -0
- package/lib/__templates__/phaser/scripts/validate.ps1 +7 -0
- package/lib/__templates__/phaser/scripts/validate.sh +7 -0
- package/lib/__templates__/phaser/src/assets.ts +15 -0
- package/lib/__templates__/phaser/src/global.d.ts +39 -0
- package/lib/__templates__/phaser/src/main.ts +28 -0
- package/lib/__templates__/phaser/src/scene/BootScene.ts +213 -0
- package/lib/__templates__/phaser/src/scene/DevLoadingScene.ts +69 -0
- package/lib/__templates__/phaser/src/style.css +28 -0
- package/lib/__templates__/phaser/src/types.ts +32 -0
- package/lib/__templates__/phaser/src/utils/asset-loader.ts +319 -0
- package/lib/__templates__/phaser/src/utils/index.ts +2 -0
- package/lib/__templates__/phaser/src/utils/mark-editable.ts +13 -0
- package/lib/__templates__/phaser/template.config.js +43 -0
- package/lib/__templates__/phaser/tsconfig.json +23 -0
- package/lib/__templates__/phaser/vite.config.ts +96 -0
- package/lib/__templates__/phaser-static/.coze +15 -0
- package/lib/__templates__/phaser-static/README.md +40 -0
- package/lib/__templates__/phaser-static/_gitignore +6 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0001.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0002.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0003.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0004.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0005.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0006.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0007.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0008.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0009.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0010.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0011.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0012.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0013.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0014.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0015.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0016.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0017.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0018.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0019.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0020.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0021.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0022.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0023.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0024.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/manifest.json +11 -0
- package/lib/__templates__/phaser-static/debug-runtime/flow-graph.json +20 -0
- package/lib/__templates__/phaser-static/index.html +17 -0
- package/lib/__templates__/phaser-static/scripts/serve.ps1 +7 -0
- package/lib/__templates__/phaser-static/src/assets.js +15 -0
- package/lib/__templates__/phaser-static/src/main.js +26 -0
- package/lib/__templates__/phaser-static/src/phaser.js +7 -0
- package/lib/__templates__/phaser-static/src/scene/BootScene.js +205 -0
- package/lib/__templates__/phaser-static/src/scene/DevLoadingScene.js +67 -0
- package/lib/__templates__/phaser-static/src/style.css +28 -0
- package/lib/__templates__/phaser-static/src/utils/asset-loader.js +267 -0
- package/lib/__templates__/phaser-static/src/utils/index.js +2 -0
- package/lib/__templates__/phaser-static/src/utils/mark-editable.js +3 -0
- package/lib/__templates__/phaser-static/template.config.js +35 -0
- package/lib/__templates__/pi-agent/package.json +1 -1
- package/lib/__templates__/pi-agent/pnpm-lock.yaml +5 -5
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +3 -2
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +1 -1
- package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +3 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +178 -68
- package/lib/__templates__/taro/.cozeproj/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/taro/AGENTS.md +11 -7
- package/lib/__templates__/taro/README.md +4 -4
- package/lib/__templates__/taro/config/index.ts +10 -2
- package/lib/__templates__/taro/pnpm-lock.yaml +5 -5
- package/lib/__templates__/taro/server/package.json +1 -1
- package/lib/__templates__/taro/server/src/main.ts +8 -2
- package/lib/__templates__/templates.json +51 -1
- package/lib/__templates__/vite/.coze +5 -0
- package/lib/__templates__/vite/package.json +1 -1
- package/lib/__templates__/vite/pnpm-lock.yaml +5 -5
- package/lib/__templates__/vite/scripts/build.ps1 +16 -0
- package/lib/__templates__/vite/scripts/build.sh +1 -1
- package/lib/__templates__/vite/scripts/dev.ps1 +63 -0
- package/lib/__templates__/vite/scripts/dev.sh +110 -1
- package/lib/__templates__/vite/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/vite/scripts/prepare.ps1 +18 -0
- package/lib/__templates__/vite/scripts/prepare.sh +1 -4
- package/lib/__templates__/vite/scripts/start.ps1 +11 -0
- package/lib/__templates__/vite/scripts/validate.ps1 +8 -0
- package/lib/__templates__/vite/template.config.js +0 -57
- package/lib/cli.js +3751 -222
- package/lib/deploy/package-project.js +244 -0
- package/lib/deploy/package-project.py +183 -0
- 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 "
|
|
36
|
-
|
|
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
|
|
@@ -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
|
|
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
|
|
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.
|
|
273
|
-
version: 0.7.
|
|
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.
|
|
2647
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
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
|
|
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.
|
|
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",
|
|
@@ -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:
|
|
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:
|
|
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 = [
|
|
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 = [
|
|
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"]
|
|
@@ -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.
|
|
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.
|
|
59
|
+
"next": "16.3.3",
|
|
60
60
|
"next-themes": "^0.4.6",
|
|
61
61
|
"pg": "^8.16.3",
|
|
62
62
|
"react": "19.2.3",
|