11
This commit is contained in:
82
docs/update_app_config.sh
Executable file
82
docs/update_app_config.sh
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 自动更新 app.config.ts 页面路径的脚本
|
||||
|
||||
APP_CONFIG_PATH="/Users/gxwebsoft/VUE/template-10550/src/app.config.ts"
|
||||
SRC_PATH="/Users/gxwebsoft/VUE/template-10550/src"
|
||||
|
||||
echo "=== 自动更新 app.config.ts 页面路径 ==="
|
||||
echo ""
|
||||
|
||||
# 检查 app.config.ts 是否存在
|
||||
if [ ! -f "$APP_CONFIG_PATH" ]; then
|
||||
echo "❌ app.config.ts 文件不存在: $APP_CONFIG_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ 找到 app.config.ts 文件"
|
||||
|
||||
# 备份原文件
|
||||
cp "$APP_CONFIG_PATH" "$APP_CONFIG_PATH.backup.$(date +%Y%m%d_%H%M%S)"
|
||||
echo "✅ 已备份原文件"
|
||||
|
||||
# 查找所有生成的页面路径配置文件
|
||||
echo ""
|
||||
echo "🔍 查找生成的页面路径配置:"
|
||||
|
||||
# 查找 shop 模块的页面
|
||||
SHOP_PAGES=""
|
||||
if [ -d "$SRC_PATH/shop" ]; then
|
||||
for dir in "$SRC_PATH/shop"/*; do
|
||||
if [ -d "$dir" ] && [ -f "$dir/index.tsx" ] && [ -f "$dir/add.tsx" ]; then
|
||||
page_name=$(basename "$dir")
|
||||
echo " 找到 shop 页面: $page_name"
|
||||
SHOP_PAGES="$SHOP_PAGES '$page_name/index',\n '$page_name/add',\n"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# 查找 cms 模块的页面
|
||||
CMS_PAGES=""
|
||||
if [ -d "$SRC_PATH/cms" ]; then
|
||||
for dir in "$SRC_PATH/cms"/*; do
|
||||
if [ -d "$dir" ] && [ -f "$dir/index.tsx" ] && [ -f "$dir/add.tsx" ]; then
|
||||
page_name=$(basename "$dir")
|
||||
echo " 找到 cms 页面: $page_name"
|
||||
CMS_PAGES="$CMS_PAGES '$page_name/index',\n '$page_name/add',\n"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "📝 需要添加到 app.config.ts 的页面路径:"
|
||||
echo ""
|
||||
|
||||
if [ -n "$SHOP_PAGES" ]; then
|
||||
echo "Shop 模块页面:"
|
||||
echo -e "$SHOP_PAGES"
|
||||
fi
|
||||
|
||||
if [ -n "$CMS_PAGES" ]; then
|
||||
echo "CMS 模块页面:"
|
||||
echo -e "$CMS_PAGES"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "⚠️ 请手动将上述页面路径添加到 app.config.ts 的对应子包中"
|
||||
echo ""
|
||||
echo "示例:"
|
||||
echo "在 shop 子包的 pages 数组中添加:"
|
||||
if [ -n "$SHOP_PAGES" ]; then
|
||||
echo -e "$SHOP_PAGES"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "在 cms 子包的 pages 数组中添加:"
|
||||
if [ -n "$CMS_PAGES" ]; then
|
||||
echo -e "$CMS_PAGES"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== 完成 ==="
|
||||
echo "备份文件位置: $APP_CONFIG_PATH.backup.*"
|
||||
Reference in New Issue
Block a user