Skip to content

Commit eec2589

Browse files
committed
fix: proxy ctx
1 parent 8e74716 commit eec2589

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

change_tag.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
# 目标版本和标签
3+
TARGET_VERSION="3.53.0"
4+
TAG="latest" # 如果需自定义标签名,修改这里
5+
6+
# 核心目录和插件目录
7+
DIRS=("core" "plugin" "standalone")
8+
9+
# 遍历所有目录
10+
for dir in "${DIRS[@]}"; do
11+
echo "Processing directory: $dir"
12+
13+
# 递归查找所有子目录(忽略node_modules)
14+
find "$dir" -maxdepth 1 -type d \( -name "node_modules" -prune \) -o -print | while read -r project_dir; do
15+
# 跳过根目录自身(避免重复处理)
16+
if [ "$project_dir" = "$dir" ]; then
17+
continue
18+
fi
19+
20+
# 检查是否是npm项目(包含package.json)
21+
if [ -f "$project_dir/package.json" ]; then
22+
echo "Updating npm tag in: $project_dir"
23+
24+
package_name=$(cd "$project_dir" && node -pe "try { require('./package.json').name } catch(e) {}" 2>/dev/null)
25+
26+
if [ -z "$package_name" ]; then
27+
echo "错误: $project_dir 中未找到有效的 package.json name 字段"
28+
continue
29+
fi
30+
31+
# 进入目录并更新npm标签
32+
(cd "$project_dir" && npm dist-tag add "$package_name@$TARGET_VERSION" "$TAG")
33+
34+
# 检查命令是否成功
35+
if [ $? -ne 0 ]; then
36+
echo "Failed to update tag in $project_dir"
37+
fi
38+
fi
39+
done
40+
done
41+
42+
echo "All done!"

0 commit comments

Comments
 (0)