@coze-arch/cli 0.1.3-alpha.8d71d5 → 0.1.3-alpha.b37ec0
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/.cozeproj/scripts/dev_build.sh +7 -3
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +2 -0
- 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__/nextjs/next.config.ts +1 -0
- package/lib/__templates__/nextjs/package.json +2 -2
- package/lib/__templates__/nextjs/pnpm-lock.yaml +15 -15
- package/lib/__templates__/nextjs/scripts/build.ps1 +1 -1
- package/lib/__templates__/nextjs/scripts/build.sh +2 -2
- package/lib/__templates__/nextjs/scripts/dev.sh +2 -0
- package/lib/__templates__/nextjs/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/nextjs/scripts/prepare.sh +1 -4
- package/lib/__templates__/nextjs/src/server.ts +1 -1
- package/lib/__templates__/nextjs/template.config.js +0 -59
- package/lib/__templates__/nuxt-vue/scripts/build.sh +1 -1
- package/lib/__templates__/nuxt-vue/scripts/dev.sh +2 -0
- package/lib/__templates__/nuxt-vue/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/nuxt-vue/scripts/prepare.sh +1 -4
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +3 -2
- package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +3 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +3 -1
- package/lib/__templates__/taro/.cozeproj/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/vite/scripts/build.sh +1 -1
- package/lib/__templates__/vite/scripts/dev.sh +2 -0
- package/lib/__templates__/vite/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/vite/scripts/prepare.sh +1 -4
- package/lib/__templates__/vite/template.config.js +0 -59
- package/lib/cli.js +34 -12
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
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
|
PREVIEW_DIR="/source/preview"
|
|
6
|
+
SOURCE_DIR="/source"
|
|
6
7
|
|
|
7
8
|
# ==================== 配置项 ====================
|
|
8
9
|
SERVER_DIR="app"
|
|
@@ -33,13 +34,16 @@ echo "==================== 安装项目依赖 ===================="
|
|
|
33
34
|
if [ ! -f "package.json" ]; then
|
|
34
35
|
echo "项目目录下无 package.json,不是合法的 Node.js 项目"
|
|
35
36
|
fi
|
|
36
|
-
# 步骤 2.1/2.2
|
|
37
|
-
|
|
37
|
+
# 步骤 2.1/2.2:通过受管入口安装项目依赖
|
|
38
|
+
bash "$ROOT_DIR/.cozeproj/scripts/prepare-node-modules.sh" --registry=https://registry.npmmirror.com
|
|
38
39
|
|
|
39
40
|
echo "检查根目录 post_install.py"
|
|
40
41
|
if [ -f "$PREVIEW_DIR/post_install.py" ]; then
|
|
41
42
|
echo "执行:python $PREVIEW_DIR/post_install.py"
|
|
42
43
|
python "$PREVIEW_DIR/post_install.py" || echo "post_install.py 执行失败"
|
|
44
|
+
elif [ -f "$SOURCE_DIR/post_app_install.py" ]; then
|
|
45
|
+
echo "执行:python $SOURCE_DIR/post_app_install.py $ROOT_DIR"
|
|
46
|
+
python "$SOURCE_DIR/post_app_install.py" "$ROOT_DIR" || echo "post_app_install.py 执行失败"
|
|
43
47
|
fi
|
|
44
48
|
|
|
45
49
|
echo "==================== 依赖安装完成!====================\n"
|
|
@@ -135,6 +135,7 @@ shift
|
|
|
135
135
|
child_pid=$!
|
|
136
136
|
|
|
137
137
|
# 先忽略 TERM,才能在向整组发 TERM(自己也在组里)之后存活下来补一发 KILL。
|
|
138
|
+
if [[ -z "${COZE_EVAL:-}" && -z "${COZE_PROJECT_TYPE:-}" ]]; then
|
|
138
139
|
( trap "" TERM
|
|
139
140
|
sleep "${timeout_seconds}"
|
|
140
141
|
echo "[dev] 后台进程运行超过 ${timeout_seconds}s,回收进程组 $$。"
|
|
@@ -142,6 +143,7 @@ child_pid=$!
|
|
|
142
143
|
sleep 5
|
|
143
144
|
kill -KILL -- "-$$" 2>/dev/null || true
|
|
144
145
|
) &
|
|
146
|
+
fi
|
|
145
147
|
|
|
146
148
|
wait "${child_pid}"
|
|
147
149
|
kill -KILL -- "-$$" 2>/dev/null || true
|
|
@@ -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
|
|
@@ -3,6 +3,7 @@ import type { NextConfig } from 'next';
|
|
|
3
3
|
const nextConfig: NextConfig = {
|
|
4
4
|
// outputFileTracingRoot: path.resolve(__dirname, '../../'), // Uncomment and add 'import path from "path"' if needed
|
|
5
5
|
/* config options here */
|
|
6
|
+
serverExternalPackages: ['coze-coding-dev-sdk'],
|
|
6
7
|
allowedDevOrigins: ['*.dev.coze.site'],
|
|
7
8
|
images: {
|
|
8
9
|
remotePatterns: [
|
|
@@ -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.1.1",
|
|
60
60
|
"next-themes": "^0.4.6",
|
|
61
61
|
"pg": "^8.16.3",
|
|
62
62
|
"react": "19.2.3",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@types/react": "^19",
|
|
82
82
|
"@types/react-dom": "^19",
|
|
83
83
|
"eslint": "^9",
|
|
84
|
-
"eslint-config-next": "16.
|
|
84
|
+
"eslint-config-next": "16.1.1",
|
|
85
85
|
"only-allow": "^1.2.2",
|
|
86
86
|
"react-dev-inspector": "^2.0.1",
|
|
87
87
|
"shadcn": "latest",
|
|
@@ -205,8 +205,8 @@ importers:
|
|
|
205
205
|
specifier: ^9
|
|
206
206
|
version: 9.39.2(jiti@2.6.1)
|
|
207
207
|
eslint-config-next:
|
|
208
|
-
specifier: 16.
|
|
209
|
-
version: 16.
|
|
208
|
+
specifier: 16.1.1
|
|
209
|
+
version: 16.1.1(@typescript-eslint/parser@8.54.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)
|
|
210
210
|
only-allow:
|
|
211
211
|
specifier: ^1.2.2
|
|
212
212
|
version: 1.2.2
|
|
@@ -641,11 +641,11 @@ packages:
|
|
|
641
641
|
|
|
642
642
|
'@esbuild-kit/core-utils@3.3.2':
|
|
643
643
|
resolution: {integrity: sha512-sPRAnw9CdSsRmEtnsl2WXWdyquogVpB3yZ3dgwJfe8zrOzTsV7cJvmwrKVa+0ma5BoiGJ+BoqkMvawbayKUsqQ==}
|
|
644
|
-
deprecated: 'Merged into tsx: https://tsx.
|
|
644
|
+
deprecated: 'Merged into tsx: https://tsx.hirok.io'
|
|
645
645
|
|
|
646
646
|
'@esbuild-kit/esm-loader@2.6.5':
|
|
647
647
|
resolution: {integrity: sha512-FxEMIkJKnodyA1OaCUoEvbYRkoZlLZ4d/eXFu9Fh8CbBBgP5EmZxrfTRyN0qpXZ4vOvqnE5YdRdcrmUUXuU+dA==}
|
|
648
|
-
deprecated: 'Merged into tsx: https://tsx.
|
|
648
|
+
deprecated: 'Merged into tsx: https://tsx.hirok.io'
|
|
649
649
|
|
|
650
650
|
'@esbuild/aix-ppc64@0.25.12':
|
|
651
651
|
resolution: {integrity: sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==}
|
|
@@ -1583,8 +1583,8 @@ packages:
|
|
|
1583
1583
|
'@next/env@16.1.1':
|
|
1584
1584
|
resolution: {integrity: sha512-3oxyM97Sr2PqiVyMyrZUtrtM3jqqFxOQJVuKclDsgj/L728iZt/GyslkN4NwarledZATCenbk4Offjk1hQmaAA==}
|
|
1585
1585
|
|
|
1586
|
-
'@next/eslint-plugin-next@16.
|
|
1587
|
-
resolution: {integrity: sha512-
|
|
1586
|
+
'@next/eslint-plugin-next@16.1.1':
|
|
1587
|
+
resolution: {integrity: sha512-Ovb/6TuLKbE1UiPcg0p39Ke3puyTCIKN9hGbNItmpQsp+WX3qrjO3WaMVSi6JHr9X1NrmthqIguVHodMJbh/dw==}
|
|
1588
1588
|
|
|
1589
1589
|
'@next/swc-darwin-arm64@16.1.1':
|
|
1590
1590
|
resolution: {integrity: sha512-JS3m42ifsVSJjSTzh27nW+Igfha3NdBOFScr9C80hHGrWx55pTrVL23RJbqir7k7/15SKlrLHhh/MQzqBBYrQA==}
|
|
@@ -3955,8 +3955,8 @@ packages:
|
|
|
3955
3955
|
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
|
|
3956
3956
|
engines: {node: '>=10'}
|
|
3957
3957
|
|
|
3958
|
-
eslint-config-next@16.
|
|
3959
|
-
resolution: {integrity: sha512-
|
|
3958
|
+
eslint-config-next@16.1.1:
|
|
3959
|
+
resolution: {integrity: sha512-55nTpVWm3qeuxoQKLOjQVciKZJUphKrNM0fCcQHAIOGl6VFXgaqeMfv0aKJhs7QtcnlAPhNVqsqRfRjeKBPIUA==}
|
|
3960
3960
|
peerDependencies:
|
|
3961
3961
|
eslint: '>=9.0.0'
|
|
3962
3962
|
typescript: '>=3.3.1'
|
|
@@ -4048,6 +4048,7 @@ packages:
|
|
|
4048
4048
|
eslint@9.39.2:
|
|
4049
4049
|
resolution: {integrity: sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==}
|
|
4050
4050
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
|
4051
|
+
deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options.
|
|
4051
4052
|
hasBin: true
|
|
4052
4053
|
peerDependencies:
|
|
4053
4054
|
jiti: '*'
|
|
@@ -4354,7 +4355,7 @@ packages:
|
|
|
4354
4355
|
|
|
4355
4356
|
glob@7.2.3:
|
|
4356
4357
|
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
|
|
4357
|
-
deprecated:
|
|
4358
|
+
deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
|
|
4358
4359
|
|
|
4359
4360
|
global-modules@2.0.0:
|
|
4360
4361
|
resolution: {integrity: sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==}
|
|
@@ -5626,6 +5627,7 @@ packages:
|
|
|
5626
5627
|
recharts@2.15.4:
|
|
5627
5628
|
resolution: {integrity: sha512-UT/q6fwS3c1dHbXv2uFgYJ9BMFHu3fwnd7AYZaEQhXuYQ4hgsxLvsUXzGdKeZrW5xopzDCvuA2N41WJ88I7zIw==}
|
|
5628
5629
|
engines: {node: '>=14'}
|
|
5630
|
+
deprecated: 1.x and 2.x branches are no longer active. Bump to Recharts v3 to receive latest features and bugfixes. See https://github.com/recharts/recharts/wiki/3.0-migration-guide
|
|
5629
5631
|
peerDependencies:
|
|
5630
5632
|
react: ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
|
5631
5633
|
react-dom: ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
|
@@ -6247,6 +6249,7 @@ packages:
|
|
|
6247
6249
|
|
|
6248
6250
|
uuid@10.0.0:
|
|
6249
6251
|
resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==}
|
|
6252
|
+
deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).
|
|
6250
6253
|
hasBin: true
|
|
6251
6254
|
|
|
6252
6255
|
validate-npm-package-name@7.0.2:
|
|
@@ -7879,12 +7882,9 @@ snapshots:
|
|
|
7879
7882
|
|
|
7880
7883
|
'@next/env@16.1.1': {}
|
|
7881
7884
|
|
|
7882
|
-
'@next/eslint-plugin-next@16.
|
|
7885
|
+
'@next/eslint-plugin-next@16.1.1':
|
|
7883
7886
|
dependencies:
|
|
7884
|
-
'@eslint-community/eslint-utils': 4.9.1(eslint@9.39.2(jiti@2.6.1))
|
|
7885
7887
|
fast-glob: 3.3.1
|
|
7886
|
-
transitivePeerDependencies:
|
|
7887
|
-
- eslint
|
|
7888
7888
|
|
|
7889
7889
|
'@next/swc-darwin-arm64@16.1.1':
|
|
7890
7890
|
optional: true
|
|
@@ -10364,9 +10364,9 @@ snapshots:
|
|
|
10364
10364
|
|
|
10365
10365
|
escape-string-regexp@4.0.0: {}
|
|
10366
10366
|
|
|
10367
|
-
eslint-config-next@16.
|
|
10367
|
+
eslint-config-next@16.1.1(@typescript-eslint/parser@8.54.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3):
|
|
10368
10368
|
dependencies:
|
|
10369
|
-
'@next/eslint-plugin-next': 16.
|
|
10369
|
+
'@next/eslint-plugin-next': 16.1.1
|
|
10370
10370
|
eslint: 9.39.2(jiti@2.6.1)
|
|
10371
10371
|
eslint-import-resolver-node: 0.3.9
|
|
10372
10372
|
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.39.2(jiti@2.6.1))
|
|
@@ -8,7 +8,7 @@ Write-Host "Installing dependencies..."
|
|
|
8
8
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
9
9
|
|
|
10
10
|
Write-Host "Building the Next.js project..."
|
|
11
|
-
& pnpm next build
|
|
11
|
+
& pnpm next build --webpack
|
|
12
12
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
13
13
|
|
|
14
14
|
Write-Host "Bundling server with tsup..."
|
|
@@ -6,10 +6,10 @@ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
|
|
|
6
6
|
cd "${COZE_WORKSPACE_PATH}"
|
|
7
7
|
|
|
8
8
|
echo "Installing dependencies..."
|
|
9
|
-
|
|
9
|
+
bash "$COZE_WORKSPACE_PATH/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
10
10
|
|
|
11
11
|
echo "Building the Next.js project..."
|
|
12
|
-
pnpm next build
|
|
12
|
+
pnpm next build --webpack
|
|
13
13
|
|
|
14
14
|
echo "Bundling server with tsup..."
|
|
15
15
|
pnpm tsup src/server.ts --format cjs --platform node --target node20 --outDir dist --no-splitting --no-minify
|
|
@@ -77,6 +77,7 @@ shift
|
|
|
77
77
|
child_pid=$!
|
|
78
78
|
|
|
79
79
|
# 先忽略 TERM,才能在向整组发 TERM(自己也在组里)之后存活下来补一发 KILL。
|
|
80
|
+
if [[ -z "${COZE_EVAL:-}" && -z "${COZE_PROJECT_TYPE:-}" ]]; then
|
|
80
81
|
( trap "" TERM
|
|
81
82
|
sleep "${timeout_seconds}"
|
|
82
83
|
echo "[dev] 后台进程运行超过 ${timeout_seconds}s,回收进程组 $$。"
|
|
@@ -84,6 +85,7 @@ child_pid=$!
|
|
|
84
85
|
sleep 5
|
|
85
86
|
kill -KILL -- "-$$" 2>/dev/null || true
|
|
86
87
|
) &
|
|
88
|
+
fi
|
|
87
89
|
|
|
88
90
|
wait "${child_pid}"
|
|
89
91
|
kill -KILL -- "-$$" 2>/dev/null || true
|
|
@@ -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"
|
|
@@ -6,7 +6,4 @@ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
|
|
|
6
6
|
cd "${COZE_WORKSPACE_PATH}"
|
|
7
7
|
|
|
8
8
|
echo "Installing dependencies..."
|
|
9
|
-
|
|
10
|
-
if command -v coze-dev > /dev/null 2>&1 && coze-dev check-bins --help > /dev/null 2>&1; then
|
|
11
|
-
coze-dev check-bins --fix
|
|
12
|
-
fi
|
|
9
|
+
bash "$COZE_WORKSPACE_PATH/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
@@ -7,7 +7,7 @@ const hostname = process.env.HOSTNAME || 'localhost';
|
|
|
7
7
|
const port = parseInt(process.env.PORT || '<%= port %>', 10);
|
|
8
8
|
|
|
9
9
|
// Create Next.js app
|
|
10
|
-
const app = next({ dev, hostname, port });
|
|
10
|
+
const app = next({ dev, hostname, port, webpack: true });
|
|
11
11
|
const handle = app.getRequestHandler();
|
|
12
12
|
|
|
13
13
|
app.prepare().then(() => {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import { spawn } from 'child_process';
|
|
4
|
-
import { resolve, join, basename } from 'path';
|
|
5
|
-
import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
|
|
6
|
-
import { homedir } from 'os';
|
|
7
3
|
|
|
8
4
|
|
|
9
5
|
|
|
@@ -57,61 +53,6 @@ const config = {
|
|
|
57
53
|
onAfterRender: async (_context, _outputPath) => {
|
|
58
54
|
// 输出由 init 命令统一处理
|
|
59
55
|
},
|
|
60
|
-
|
|
61
|
-
onComplete: async (_context, outputPath) => {
|
|
62
|
-
// Skip pnpm update in test environment to avoid monorepo workspace issues
|
|
63
|
-
if (process.env.NODE_ENV === 'test') {
|
|
64
|
-
console.log('⊘ Skipping dependency update in test environment');
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const cmd = 'pnpm';
|
|
69
|
-
const args = ['update', 'coze-coding-dev-sdk@^0.7.25'];
|
|
70
|
-
console.log(
|
|
71
|
-
`\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
try {
|
|
75
|
-
const projectRoot = resolve(outputPath);
|
|
76
|
-
|
|
77
|
-
// Determine log directory
|
|
78
|
-
const cozeHome = process.env.COZE_HOME || join(homedir(), '.coze');
|
|
79
|
-
const logDir = process.env.COZE_LOG_DIR || join(cozeHome, 'logs');
|
|
80
|
-
mkdirSync(logDir, { recursive: true });
|
|
81
|
-
|
|
82
|
-
// Use project name in log file to avoid conflicts
|
|
83
|
-
const projectName = basename(projectRoot);
|
|
84
|
-
const logFile = join(logDir, `${projectName}-init.log`);
|
|
85
|
-
|
|
86
|
-
// Write log header
|
|
87
|
-
const timestamp = new Date().toISOString();
|
|
88
|
-
appendFileSync(
|
|
89
|
-
logFile,
|
|
90
|
-
`\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
// Open log file for appending
|
|
94
|
-
const logFd = openSync(logFile, 'a');
|
|
95
|
-
|
|
96
|
-
// Spawn in detached mode
|
|
97
|
-
const child = spawn(cmd, args, {
|
|
98
|
-
cwd: projectRoot,
|
|
99
|
-
detached: true,
|
|
100
|
-
stdio: ['ignore', logFd, logFd],
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
child.unref();
|
|
104
|
-
closeSync(logFd);
|
|
105
|
-
|
|
106
|
-
console.log(
|
|
107
|
-
'✓ coze-coding-dev-sdk update triggered (running in background)',
|
|
108
|
-
);
|
|
109
|
-
console.log(` Log file: ${logFile}`);
|
|
110
|
-
} catch (error) {
|
|
111
|
-
console.error('✗ Failed to trigger coze-coding-dev-sdk update:', error);
|
|
112
|
-
console.log(' You can manually run: pnpm update coze-coding-dev-sdk');
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
56
|
};
|
|
116
57
|
|
|
117
58
|
export default config;
|
|
@@ -6,7 +6,7 @@ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
|
|
|
6
6
|
cd "${COZE_WORKSPACE_PATH}"
|
|
7
7
|
|
|
8
8
|
echo "Installing dependencies..."
|
|
9
|
-
|
|
9
|
+
bash "$COZE_WORKSPACE_PATH/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
10
10
|
|
|
11
11
|
echo "Building the Nuxt.js project..."
|
|
12
12
|
pnpm nuxt build
|
|
@@ -77,6 +77,7 @@ shift
|
|
|
77
77
|
child_pid=$!
|
|
78
78
|
|
|
79
79
|
# 先忽略 TERM,才能在向整组发 TERM(自己也在组里)之后存活下来补一发 KILL。
|
|
80
|
+
if [[ -z "${COZE_EVAL:-}" && -z "${COZE_PROJECT_TYPE:-}" ]]; then
|
|
80
81
|
( trap "" TERM
|
|
81
82
|
sleep "${timeout_seconds}"
|
|
82
83
|
echo "[dev] 后台进程运行超过 ${timeout_seconds}s,回收进程组 $$。"
|
|
@@ -84,6 +85,7 @@ child_pid=$!
|
|
|
84
85
|
sleep 5
|
|
85
86
|
kill -KILL -- "-$$" 2>/dev/null || true
|
|
86
87
|
) &
|
|
88
|
+
fi
|
|
87
89
|
|
|
88
90
|
wait "${child_pid}"
|
|
89
91
|
kill -KILL -- "-$$" 2>/dev/null || true
|