2023-11-14 23:04:56 +09:00
|
|
|
#!/bin/sh
|
2023-11-12 05:31:20 +09:00
|
|
|
set -eu
|
|
|
|
|
2023-11-14 23:04:56 +09:00
|
|
|
. neko/update/utils
|
2023-11-12 05:31:20 +09:00
|
|
|
|
|
|
|
# Confirm that the server is stopped
|
|
|
|
if [ $# != 1 ] || [ "$1" != "--skip-all-confirmations" ]; then
|
|
|
|
say "Did you stop your server?"
|
2023-11-14 23:04:56 +09:00
|
|
|
printf "[Y/n] > "
|
|
|
|
read -r yn
|
|
|
|
|
2023-11-12 05:31:20 +09:00
|
|
|
case "${yn}" in
|
|
|
|
[Nn]|[Nn][Oo])
|
|
|
|
say "You must stop your server first!"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
2023-11-14 23:04:56 +09:00
|
|
|
say "uwu~ erai erai!"
|
|
|
|
br
|
2023-11-12 05:31:20 +09:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
# write version info
|
|
|
|
say "Writing version info to package.json..."
|
|
|
|
|
2023-11-15 13:50:54 +09:00
|
|
|
running "sed \"s/\\\"version\\\": \\\"\\([^+][^+]*\\).*\\\",$/\\\"version\\\": \\\"\\\\1+neko:$(version)\\\",/\" package.json > package.json.new && mv -- package.json.new package.json"
|
|
|
|
sed "s/\"version\": \"\([^+][^+]*\).*\",$/\"version\": \"\\1+neko:$(version)\",/" package.json > package.json.new && mv -- package.json.new package.json
|
2023-11-12 05:31:20 +09:00
|
|
|
|
2023-11-14 23:04:56 +09:00
|
|
|
say "Done!"
|
|
|
|
br
|
2023-11-12 05:31:20 +09:00
|
|
|
|
|
|
|
# install dependencies
|
|
|
|
say "Upgrading dependencies..."
|
|
|
|
|
|
|
|
running "corepack prepare pnpm@latest --activate"
|
|
|
|
corepack prepare pnpm@latest --activate
|
|
|
|
|
2023-11-18 15:18:44 +09:00
|
|
|
running "pnpm install --frozen-lockfile"
|
|
|
|
pnpm install --frozen-lockfile
|
2023-11-12 05:31:20 +09:00
|
|
|
|
2023-11-14 23:04:56 +09:00
|
|
|
say "Done!"
|
|
|
|
br
|
2023-11-12 05:31:20 +09:00
|
|
|
|
|
|
|
# build
|
|
|
|
say "Start building Firefish."
|
|
|
|
say "It takes some time! Why not brew a cup of cofe?"
|
|
|
|
|
|
|
|
running "NODE_OPTIONS=\"--max_old_space_size=3072\" NODE_ENV=\"production\" pnpm run rebuild"
|
|
|
|
NODE_OPTIONS="--max_old_space_size=3072" NODE_ENV="production" pnpm run rebuild
|
|
|
|
|
2023-11-14 23:04:56 +09:00
|
|
|
say "Done! We're almost there."
|
|
|
|
br
|
2023-11-12 05:31:20 +09:00
|
|
|
|
|
|
|
# prevent migration errors
|
|
|
|
if [ ! -f packages/backend/native-utils/built/index.js ]; then
|
|
|
|
say "Something went wrong orz... Gonnya try fixing that."
|
|
|
|
running "cp neko/index.js packages/backend/native-utils/built/index.js"
|
|
|
|
cp neko/index.js packages/backend/native-utils/built/index.js
|
|
|
|
else
|
2023-11-14 23:04:56 +09:00
|
|
|
say "It's going well so far!"
|
|
|
|
br
|
2023-11-12 05:31:20 +09:00
|
|
|
fi
|
|
|
|
|
|
|
|
# migrate
|
|
|
|
say "Database migration time!"
|
|
|
|
|
|
|
|
running "NODE_OPTIONS=\"--max_old_space_size=3072\" NODE_ENV=\"production\" pnpm run migrate"
|
|
|
|
NODE_OPTIONS="--max_old_space_size=3072" NODE_ENV="production" pnpm run migrate
|
|
|
|
|
2023-11-14 23:04:56 +09:00
|
|
|
say "Done!"
|
|
|
|
br
|