Update fumadocs-install.sh

This commit is contained in:
CanbiZ 2025-03-31 14:16:46 +02:00
parent f8925a9b21
commit 71ceeb490d

View File

@ -16,7 +16,8 @@ update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get install -y \ $STD apt-get install -y \
gnupg \ gnupg \
ca-certificates ca-certificates \
expect
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing Node.js" msg_info "Installing Node.js"
@ -25,19 +26,30 @@ curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dea
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
$STD apt-get update $STD apt-get update
$STD apt-get install -y nodejs $STD apt-get install -y nodejs
$STD npm install -g bun $STD npm install -g pnpm
msg_ok "Installed Node.js" msg_ok "Installed Node.js"
msg_info "Installing Fumadocs" msg_info "Installing Fumadocs"
temp_file=$(mktemp) temp_file=$(mktemp)
RELEASE=$(curl -s https://api.github.com/repos/fuma-nama/fumadocs/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -s https://api.github.com/repos/fuma-nama/fumadocs/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
export NODE_OPTIONS="--max-old-space-size=2048" export NODE_OPTIONS="--max-old-space-size=4096"
wget -q https://github.com/fuma-nama/fumadocs/archive/refs/tags/${RELEASE}.tar.gz -O $temp_file wget -q https://github.com/fuma-nama/fumadocs/archive/refs/tags/${RELEASE}.tar.gz -O $temp_file
tar zxf $temp_file tar -xzf $temp_file
mv fumadocs-* "${PWD}/fumadocs" mv fumadocs-* "/opt/fumadocs"
cd /opt/fumadocs cd /opt/fumadocs
$STD bun install $STD pnpm install
bun create fumadocs-app spawn pnpm create fumadocs-app
expect "Project name"
send "my-app\r"
expect "Choose a template"
send "Next.js: Fumadocs MDX\r"
expect "Use \`/src\` directory?"
send "No\r"
expect "Add default ESLint configuration?"
send "No\r"
expect "Do you want to install packages automatically?*"
send "Yes\r"
expect eof
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Installed Fumadocs" msg_ok "Installed Fumadocs"
@ -49,7 +61,7 @@ After=network.target
[Service] [Service]
WorkingDirectory=/opt/fumadocs WorkingDirectory=/opt/fumadocs
ExecStart=/usr/bin/bun run dev ExecStart=/usr/bin/pnpm run dev
Restart=always Restart=always
[Install] [Install]
@ -61,6 +73,7 @@ motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm -f $temp_file
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"