From be496d2d2464789b1c90b6b3675bedac7953df55 Mon Sep 17 00:00:00 2001 From: naskya Date: Thu, 21 Sep 2023 07:58:12 +0900 Subject: [PATCH] dev: update upgrading script --- {packages => neko}/index.js | 0 update.sh | 28 +++++++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) rename {packages => neko}/index.js (100%) diff --git a/packages/index.js b/neko/index.js similarity index 100% rename from packages/index.js rename to neko/index.js diff --git a/update.sh b/update.sh index 081c8109..37f98c4f 100755 --- a/update.sh +++ b/update.sh @@ -13,7 +13,7 @@ function running { tput setaf 7 } -say "Start updating!" +say "Start upgrading Firefish!" say "Did you stop your server?" read -r -p "[Y/n] > " yn case "${yn}" in @@ -55,8 +55,8 @@ fi ## write version info say "Writing version info to package.json..." -running "sed -i -r 's/\"version\": \"([^+]+).*\",$/\"version\": \"\\1+neko:${NEW_COMMIT}\",/' package.json" -sed -i -r "s/\"version\": \"([^+]+).*\",$/\"version\": \"\\1+neko:${NEW_COMMIT}\",/" package.json +running "sed -i -r 's/\"version\": \"([^+]+).*\",$/\"version\": \"\\1+neko:${NEW_COMMIT:0:7}\",/' package.json" +sed -i -r "s/\"version\": \"([^+]+).*\",$/\"version\": \"\\1+neko:${NEW_COMMIT:0:7}\",/" package.json say "Done!\n" @@ -67,8 +67,8 @@ say "Upgrading dependencies..." running "corepack prepare pnpm@latest --activate" corepack prepare pnpm@latest --activate -running "pnpm install" -pnpm install +running "pnpm install --frozen-lockfile" +pnpm install --frozen-lockfile say "Done!\n" @@ -76,23 +76,25 @@ say "Done!\n" say "Start building Firefish." say "It takes some time! Why not brew a cup of cofe?" -running "NODE_ENV=production pnpm run rebuild" -NODE_ENV=production pnpm run rebuild +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 say "Done! We're almost there.\n" ## prevent migration errors if [[ ! -f packages/backend/native-utils/built/index.js ]]; then say "Something went wrong orz... Gonnya try fixing that." - running "pushd packages/backend/native-utils; NODE_ENV=production pnpm build; popd" + running "pushd packages/backend/native-utils" pushd packages/backend/native-utils - NODE_ENV=production pnpm build + running "NODE_OPTIONS=--max_old_space_size=3072 NODE_ENV=production pnpm build" + NODE_OPTIONS=--max_old_space_size=3072 NODE_ENV=production pnpm build + running "popd" popd if [[ ! -f packages/backend/native-utils/built/index.js ]]; then say "Something is still broken... I'll take another measure." - running "cp packages/index.js packages/backend/native-utils/built/index.js" - cp packages/index.js packages/backend/native-utils/built/index.js + running "cp neko/index.js packages/backend/native-utils/built/index.js" + cp neko/index.js packages/backend/native-utils/built/index.js say "Let's see if it works...\n" else say "The issue seems to be fixed!\n" @@ -104,8 +106,8 @@ fi ## migrate say "Database migration time!" -running "pnpm run migrate" -pnpm run migrate +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 say "Done!\n"