chore: update dev scripts (#2427)

- add type-gen
- remove some unused air settings
- restrict air monitoring to changed go files
This commit is contained in:
Lincoln Nogueira 2023-10-22 11:09:25 -03:00 committed by GitHub
parent 055b246857
commit 331f4dcc1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 15 deletions

View File

@ -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

View File

@ -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

View File

@ -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 (!$?) {

View File

@ -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

View File

@ -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;
}