feat: support air reload
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
root = "."
|
||||||
|
testdata_dir = "testdata"
|
||||||
|
tmp_dir = "bin"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
args_bin = []
|
||||||
|
bin = "./bin/baihu"
|
||||||
|
cmd = ":"
|
||||||
|
full_bin = "go run main.go"
|
||||||
|
delay = 1000
|
||||||
|
exclude_dir = ["assets", "tmp", "vendor", "testdata", "web", "data", "envs", "configs", "bin"]
|
||||||
|
exclude_file = []
|
||||||
|
exclude_regex = ["_test.go"]
|
||||||
|
exclude_unchanged = false
|
||||||
|
follow_symlink = false
|
||||||
|
include_dir = []
|
||||||
|
include_ext = ["go", "tpl", "tmpl", "html"]
|
||||||
|
include_file = []
|
||||||
|
kill_delay = "0s"
|
||||||
|
log = "build-errors.log"
|
||||||
|
poll = false
|
||||||
|
poll_interval = 0
|
||||||
|
rerun = false
|
||||||
|
rerun_delay = 500
|
||||||
|
send_interrupt = false
|
||||||
|
stop_on_error = true
|
||||||
|
|
||||||
|
[color]
|
||||||
|
app = ""
|
||||||
|
build = "yellow"
|
||||||
|
main = "magenta"
|
||||||
|
runner = "green"
|
||||||
|
watcher = "cyan"
|
||||||
|
|
||||||
|
[log]
|
||||||
|
main_only = false
|
||||||
|
time = false
|
||||||
|
|
||||||
|
[misc]
|
||||||
|
clean_on_exit = false
|
||||||
|
|
||||||
|
[screen]
|
||||||
|
clear_on_rebuild = false
|
||||||
|
keep_scroll = true
|
||||||
@@ -49,3 +49,6 @@ __pycache__/
|
|||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
.stfolder
|
.stfolder
|
||||||
|
|
||||||
|
bin/
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Variables
|
# Variables
|
||||||
BINARY=baihu
|
BINARY=bin/baihu
|
||||||
GOBUILD=go build
|
GOBUILD=go build
|
||||||
GOCLEAN=go clean
|
GOCLEAN=go clean
|
||||||
GOGET=go get
|
GOGET=go get
|
||||||
@@ -19,6 +19,7 @@ build-web:
|
|||||||
|
|
||||||
# Build the application (requires frontend to be built first)
|
# Build the application (requires frontend to be built first)
|
||||||
build:
|
build:
|
||||||
|
@mkdir -p bin
|
||||||
CGO_ENABLED=0 $(GOBUILD) $(LDFLAGS) -o $(BINARY) main.go
|
CGO_ENABLED=0 $(GOBUILD) $(LDFLAGS) -o $(BINARY) main.go
|
||||||
|
|
||||||
# Build all (frontend + backend)
|
# Build all (frontend + backend)
|
||||||
@@ -59,20 +60,24 @@ build-agent-darwin-arm64:
|
|||||||
# Clean built files
|
# Clean built files
|
||||||
clean:
|
clean:
|
||||||
$(GOCLEAN)
|
$(GOCLEAN)
|
||||||
rm -f $(BINARY)
|
rm -rf bin/
|
||||||
rm -rf internal/static/dist
|
rm -rf internal/static/dist
|
||||||
mkdir -p internal/static/dist
|
mkdir -p internal/static/dist
|
||||||
touch internal/static/dist/.gitkeep
|
touch internal/static/dist/.gitkeep
|
||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
run:
|
run:
|
||||||
|
@mkdir -p bin
|
||||||
$(GOBUILD) -o $(BINARY) main.go
|
$(GOBUILD) -o $(BINARY) main.go
|
||||||
./$(BINARY)
|
./$(BINARY)
|
||||||
|
|
||||||
# Development run (without embedding frontend)
|
# Development run with hot reload (both frontend and backend)
|
||||||
dev:
|
dev:
|
||||||
$(GOBUILD) -o $(BINARY) main.go
|
@command -v air > /dev/null 2>&1 || go install github.com/air-verse/air@latest
|
||||||
./$(BINARY)
|
@command -v concurrently > /dev/null 2>&1 || npm install -g concurrently
|
||||||
|
concurrently --kill-others \
|
||||||
|
"air" \
|
||||||
|
"cd web && npm run dev"
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
deps:
|
deps:
|
||||||
|
|||||||
Reference in New Issue
Block a user