Skip to content

armgit / memos

Public Imported from GitHub
0

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.

chore: update dev scripts (#2427)

Lincoln Nogueira331f4dcc1ba0
diff --git a/scripts/.air-windows.toml b/scripts/.air-windows.toml
index 7c1e7f69e..dcdd77994 100644
--- a/scripts/.air-windows.toml
+++ b/scripts/.air-windows.toml
@@ -6,10 +6,10 @@ bin = "./.air/memos.exe --mode dev"
cmd = "go build -o ./.air/memos.exe ./main.go"
delay = 1000
exclude_dir = [".air", "web", "build"]
+include_ext = ["go", "mod", "sum"]
exclude_file = []
exclude_regex = []
-exclude_unchanged = false
+exclude_unchanged = true
follow_symlink = false
-full_bin = ""
-send_interrupt = true
kill_delay = 2000
+stop_on_error = true
diff --git a/scripts/.air.toml b/scripts/.air.toml
index 232b10d07..9a39fb390 100644
--- a/scripts/.air.toml
+++ b/scripts/.air.toml
@@ -6,11 +6,11 @@ bin = "./.air/memos --mode dev"
cmd = "go build -o ./.air/memos ./main.go"
delay = 1000
exclude_dir = [".air", "web", "build"]
+include_ext = ["go", "mod", "sum"]
exclude_file = []
exclude_regex = []
-exclude_unchanged = false
+exclude_unchanged = true
follow_symlink = false
-full_bin = ""
send_interrupt = true
kill_delay = 2000
stop_on_error = true
diff --git a/scripts/build.ps1 b/scripts/build.ps1
index 7e171ae83..59991c550 100644
--- a/scripts/build.ps1
+++ b/scripts/build.ps1
@@ -73,6 +73,17 @@ if (!$?) {
Write-Host "Frontend built!" -f green
}
+Write-Host "`nGenerating buf types..." -f DarkYellow
+$frontendTime = Measure-Command {
+ &pnpm type-gen | Out-Host
+}
+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/dist" "$repoRoot/server/dist.bak" -Force -ErrorAction Stop
if (!$?) {
diff --git a/scripts/build.sh b/scripts/build.sh
index eeb1434c1..91c768435 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -74,6 +74,14 @@ if [ $? -ne 0 ]; then
fi
echo -e "\033[32mFrontend dependencies installed!\033[0m"
+echo -e "\n\033[33mGenerating buf types...\033[0m"
+pnpm type-gen
+if [ $? -ne 0 ]; then
+ echo -e "\033[0;31mCould not generate buf types! Exiting.\033[0m"
+ exit 1
+fi
+echo -e "\033[32mbuf types generated!\033[0m"
+
echo -e "\n\033[33mBuilding frontend...\033[0m"
pnpm build
if [ $? -ne 0 ]; then
diff --git a/scripts/start.ps1 b/scripts/start.ps1
index a1c8f423b..f03b5942c 100644
--- a/scripts/start.ps1
+++ b/scripts/start.ps1
@@ -18,24 +18,43 @@ foreach ($dir in @(".", "../")) {
$frontendPort = 3001
# Tasks to run, in order
$runTasks = @(
+ @{
+ Desc = "install frontend dependencies";
+ Exe = "powershell.exe";
+ Args = (
+ "-Command",
+ "pnpm i"
+ );
+ Dir = "$repoRoot/web"
+ Wait = $true;
+ },
+ @{
+ Desc = "generate buf types";
+ Exe = "powershell.exe";
+ Args = (
+ "-Command",
+ "pnpm type-gen"
+ );
+ Dir = "$repoRoot/web"
+ Wait = $true;
+ },
@{
Desc = "start backend with live reload";
Exe = "air.exe";
- Args = "-c .\scripts\.air-windows.toml";
+ Args = (
+ "-c",
+ ".\scripts\.air-windows.toml"
+ );
Dir = "$repoRoot";
Wait = $false;
},
- @{
- Desc = "install frontend dependencies";
- Exe = "pnpm.exe";
- Args = "i";
- Dir = "$repoRoot/web"
- Wait = $true;
- }
@{
Desc = "start frontend with live reload";
- Exe = "pnpm.exe";
- Args = "dev";
+ Exe = "powershell.exe";
+ Args = (
+ "-Command",
+ "pnpm dev"
+ );
Dir = "$repoRoot/web";
Wait = $false;
}