Files
qwerty-learner/scripts/pre-check.sh

47 lines
1.4 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.

cd "$(dirname "$0")" || exit
# 判断是否安装了 Node
if ! type node >/dev/null 2>&1; then
echo "未检测到 nodejs 环境尝试使用homebrew安装..."
# 检测homebrew是否存在
if ! type brew >/dev/null 2>&1; then
echo "未检测到 homebrew无法完成安装请安装 homebrew 后进行尝试 (https://brew.sh/)"
else
brew install node
echo "node 安装完成,版本为: "
node --version
fi
else
echo "检测到 NodeJS 环境,版本为:"
node -v
fi
if ! type git >/dev/null 2>&1; then
echo "未检测到 git 环境,尝试使用 homebrew 安装..."
# 检测 homebrew 是否存在
if ! type brew >/dev/null 2>&1; then
echo "未检测到 homebrew请手动安装 homebrew 后进行尝试 (https://brew.sh/)"
else
brew install git
echo "git 安装完成,版本为: "
git --version
fi
else
echo "检测到 git 环境,版本为:"
git --version
fi
if ! type yarn >/dev/null 2>&1; then
echo "未检测到 yarn 环境,尝试使用 homebrew 进行安装"
# 检测 homebrew 是否存在
if ! type brew >/dev/null 2>&1; then
echo "未检测到 homebrew ,请手动安装 homebrew 后进行尝试 (https://brew.sh/)"
else
brew install yarn
echo "yarn 安装完成,版本为: "
yarn --version
fi
else
echo "检测到 yarn 环境,版本为:"
yarn -v
fi