Files
admin_core/build.sh
张成 2e1cd65b07 init
2025-10-08 15:10:33 +08:00

66 lines
1.5 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Admin Framework 构建脚本
echo "================================"
echo " Admin Framework 构建工具"
echo "================================"
echo ""
# 检查 Node.js 是否安装
if ! command -v node &> /dev/null
then
echo "❌ 错误: 未检测到 Node.js请先安装 Node.js"
exit 1
fi
echo "✅ Node.js 版本: $(node -v)"
echo "✅ NPM 版本: $(npm -v)"
echo ""
# 检查是否已安装依赖
if [ ! -d "node_modules" ]; then
echo "📦 正在安装依赖..."
npm install
if [ $? -ne 0 ]; then
echo "❌ 依赖安装失败"
exit 1
fi
echo "✅ 依赖安装成功"
echo ""
else
echo "✅ 依赖已安装"
echo ""
fi
# 执行打包
echo "🔨 正在打包框架..."
npm run build
if [ $? -eq 0 ]; then
echo ""
echo "================================"
echo " ✅ 打包成功!"
echo "================================"
echo ""
echo "📦 输出文件: dist/admin-framework.js"
# 显示文件大小
if [ -f "dist/admin-framework.js" ]; then
SIZE=$(du -h dist/admin-framework.js | cut -f1)
echo "📊 文件大小: $SIZE"
fi
echo ""
echo "📚 下一步:"
echo " 1. 将 dist/admin-framework.js 复制到你的项目"
echo " 2. 查看 QUICK_START.md 了解如何使用"
echo " 3. 查看 USAGE_EXAMPLE.md 了解详细示例"
echo ""
else
echo ""
echo "❌ 打包失败,请检查错误信息"
exit 1
fi