Create Install.sh for MacOS (#674)

This commit is contained in:
Iewnfod
2023-10-14 19:48:10 +08:00
committed by GitHub
parent b25221cf33
commit fb6efe21e1
2 changed files with 47 additions and 12 deletions

27
scripts/install.sh Executable file
View File

@@ -0,0 +1,27 @@
cd `dirname $0`
# 判断是否安装了 Node
if ! type node >/dev/null 2>&1; then
echo "未检测到nodejs环境尝试使用homebrew安装..."
# 检测homebrew是否存在
if ! type brew >/dev/null 2>&1; then
echo "未检测到homebrew无法完成安装请安装homebrew或直接安装nodejs"
else
brew install node
fi
fi
cd ..
echo "开始安装依赖..."
yarn install --registry=https://registry.npm.taobao.org
echo "依赖安装完成,启动程序..."
# 在浏览器中打开
open http://localhost:5173/
# 本地开启服务
npm run start
# 返回原始目录并退出
cd `dirname $0`
exit