Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: update build scripts (#3085)
Lincoln Nogueira7c87c1ff7426
diff --git a/scripts/build.ps1 b/scripts/build.ps1index f19af3020..052b5c52e 100644--- a/scripts/build.ps1+++ b/scripts/build.ps1@@ -43,6 +43,7 @@ if ([string]::IsNullOrWhiteSpace($repoRoot)) {Write-Host "Repository root: " -NoNewlineWrite-Host $repoRoot -f Blue+Push-LocationSet-Location "$repoRoot/web"if (-not (Get-Command pnpm -ErrorAction SilentlyContinue)) {@@ -50,6 +51,7 @@ if (-not (Get-Command pnpm -ErrorAction SilentlyContinue)) {npm install -g pnpmif (!$?) {Write-Host -BackgroundColor red -ForegroundColor white "Could not install pnpm. See above."+ Pop-LocationExit 1}}@@ -58,39 +60,37 @@ Write-Host "`nInstalling frontend dependencies..." -f DarkYellowpnpm i --frozen-lockfileif (!$?) {Write-Host -BackgroundColor red -ForegroundColor white "Could not install frontend dependencies. See above."+ Pop-LocationExit 1}Write-Host "Frontend dependencies installed!" -f green+Write-Host "`nRemoving previous frontend build from ./build/dist ..." -f Magenta+Remove-Item "$repoRoot/build/dist" -Recurse -Force -ErrorAction SilentlyContinue+if (!$?) {+ Write-Host -BackgroundColor red -ForegroundColor white "Could not remove frontend from ./build/dist. See above."+ Pop-Location+ Exit 1+}+Write-Host "`nBuilding frontend..." -f DarkYellow$frontendTime = Measure-Command {&pnpm build | Out-Host}if (!$?) {Write-Host -BackgroundColor red -ForegroundColor white "Could not build frontend. See above."+ Pop-LocationExit 1-} else {- Write-Host "Frontend built!" -f green}--if (!$?) {- Write-Host -BackgroundColor red -ForegroundColor white "Could not generate buf types. See above."- Exit 1-} else {- Write-Host "buf types generated!" -f green-}--Write-Host "`nBacking up frontend placeholder..." -f Magenta-Move-Item "$repoRoot/server/frontend/dist" "$repoRoot/server/frontend/dist.bak" -Force -ErrorAction Stop-if (!$?) {- Write-Host -BackgroundColor red -ForegroundColor white "Could not backup frontend placeholder. See above."- Exit 1+else {+ Write-Host "Frontend built!" -f green}-Write-Host "Moving frontend build to ./server/frontend/dist..." -f Magenta-Move-Item "$repoRoot/web/dist" "$repoRoot/server/" -Force -ErrorAction Stop+Write-Host "Moving frontend build to ./build/dist..." -f Magenta+Move-Item "$repoRoot/web/dist" "$repoRoot/build/" -Force -ErrorAction Stopif (!$?) {- Write-Host -BackgroundColor red -ForegroundColor white "Could not move frontend build to /server/frontend/dist. See above."+ Write-Host -BackgroundColor red -ForegroundColor white "Could not move frontend build to ./build/dist. See above."+ Pop-LocationExit 1}@@ -122,20 +122,6 @@ Write-Host "Backend built!" -f greenWrite-Host "`nFrontend build took $($frontendTime.TotalSeconds) seconds." -f CyanWrite-Host "Backend builds took $($backendTime.TotalSeconds) seconds." -f Cyan-Write-Host "`nRemoving frontend from ./server/frontend/dist ..." -f Magenta-Remove-Item "$repoRoot/server/frontend/dist" -Recurse -Force -ErrorAction SilentlyContinue-if (!$?) {- Write-Host -BackgroundColor red -ForegroundColor white "Could not remove frontend from /server/frontend/dist. See above."- Exit 1-}--Write-Host "Restoring frontend placeholder..." -f Magenta-Move-Item "$repoRoot/server/frontend/dist.bak" "$repoRoot/server/frontend/dist" -Force -ErrorAction Stop-if (!$?) {- Write-Host -BackgroundColor red -ForegroundColor white "Could not restore frontend placeholder. See above."- Exit 1-}-Write-Host "`nBuilds:" -f Whiteforeach ($build in $goBuilds) {$output = [IO.Path]::Combine($repoRoot, "build", "memos-$os-$arch")diff --git a/scripts/build.sh b/scripts/build.shindex 15bcad97f..f03089464 100755--- a/scripts/build.sh+++ b/scripts/build.sh@@ -11,7 +11,7 @@# * node.js# * npm-# Usage:+# Usage:# chmod +x ./scripts/build.sh# ./scripts/build.sh#@@ -53,15 +53,15 @@ elseecho -e "Repository root: \033[0;34m$repo_root\033[0m"fi-+pushd $repo_rootcd "$repo_root/web"-if ! command -v pnpm &> /dev/null-then+if ! command -v pnpm &>/dev/null; thenecho -e "\n\033[35mInstalling pnpm...\033[0m"npm install -g pnpmif [ $? -ne 0 ]; thenecho -e "\033[0;31mFailed to install pnpm! Exiting.\033[0m"+ popdexit 1fifi@@ -70,31 +70,35 @@ echo -e "\n\033[33mInstalling frontend dependencies...\033[0m"pnpm i --frozen-lockfileif [ $? -ne 0 ]; thenecho -e "\033[0;31mFrontend dependencies failed to install! Exiting.\033[0m"+ popdexit 1fiecho -e "\033[32mFrontend dependencies installed!\033[0m"+echo -e "\n\033[35mRemoving previous frontend build from ./build/dist...\033[0m"+rm -rf $repo_root/build/dist+if [ $? -ne 0 ]; then+ echo -e "\033[93mCould not remove frontend from ./build/dist.\033[0m"+ popd+ exit 1+fi+echo -e "\n\033[33mBuilding frontend...\033[0m"pnpm buildif [ $? -ne 0 ]; thenecho -e "\033[0;31mFrontend build failed! Exiting.\033[0m"+ popdexit 1fiecho -e "\033[32mFrontend built!\033[0m"cd $repo_root-echo -e "\n\033[35mBacking up frontend placeholder...\033[0m"-mv -f "$repo_root/server/frontend/dist" "$repo_root/server/frontend/dist.bak"-if [ $? -ne 0 ]; then- echo -e "\033[0;31mFailed to backup frontend placeholder! Exiting.\033[0m"- exit 1-fi--echo -e "\033[35mMoving frontend build to ./server/frontend/dist...\033[0m"-mv -f "$repo_root/web/dist" "$repo_root/server/"+echo -e "\033[35mMoving frontend build to ./build/dist...\033[0m"+mv -f "$repo_root/web/dist" "$repo_root/build/"if [ $? -ne 0 ]; thenecho -e "\033[0;31mFailed to move frontend build! Exiting.\033[0m"+ popdexit 1fi@@ -109,7 +113,7 @@ for build in "${goBuilds[@]}"; doif [ "$os" = "windows" ]; thenoutput="$output.exe"fi-+CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -trimpath -ldflags="${ldFlags[*]}" -o "$output" ./bin/memos/main.goecho -e "\033[34mBuilding $os/$arch to $output...\033[0m"@@ -121,22 +125,6 @@ doneecho -e "\033[32mBackend built!\033[0m"-echo -e "\n\033[35mRemoving frontend from ./server/frontend/dist...\033[0m"-rm -rf $repo_root/server/frontend/dist-if [ $? -ne 0 ]-then- echo -e "\033[93mCould not remove frontend from /server/frontend/dist.\033[0m"- exit 1-fi--echo -e "\033[35mRestoring frontend placeholder...\033[0m"-mv $repo_root/server/frontend/dist.bak $repo_root/server/frontend/dist-if [ $? -ne 0 ]-then- echo -e "\033[93mCould not restore frontend placeholder.\033e[0m"- exit 1-fi-echo -e "\n\033[37mBuilds:\033[0m"for build in "${goBuilds[@]}"; doos=$(echo $build | cut -d'/' -f1)