Files
SCGL/init-frontend.sh

38 lines
931 B
Bash
Raw Permalink Normal View History

#!/bin/bash
# ================================================
# PMS 前端项目初始化脚本
# ================================================
echo ">>> 创建 Vue 3 + Vite + TypeScript 项目..."
# 使用 pnpm推荐或 npm
if command -v pnpm &> /dev/null; then
PACKAGE_MANAGER="pnpm"
elif command -v yarn &> /dev/null; then
PACKAGE_MANAGER="yarn"
else
PACKAGE_MANAGER="npm"
fi
echo ">>> 使用: $PACKAGE_MANAGER"
# 初始化项目
$PACKAGE_MANAGER create vite@latest pms-frontend -- --template vue-ts
cd pms-frontend
# 安装依赖
$PACKAGE_MANAGER install
# 安装 Element Plus、Axios、Vue Router、Pinia、vuedraggable
$PACKAGE_MANAGER add element-plus @element-plus/icons-vue axios vue-router pinia vuedraggable@next
# 安装类型定义
$PACKAGE_MANAGER add -D @types/node
echo ">>> 项目初始化完成!"
echo ""
echo ">>> 下一步:"
echo " cd pms-frontend"
echo " $PACKAGE_MANAGER run dev"