feat(dev): add Air config and Makefile dev target

Add .air.toml for live reload development with Air. Update Makefile to
include a 'dev' target that starts Air with custom cache directories.
Improve .gitignore to exclude 'tmp' directory used by Air.

Refactor frontend JS to use querySelector for robustness. Update HTML
template to fix form method, script loading, and message div syntax.
c
This commit is contained in:
Ruidy 2025-09-28 14:16:18 +02:00
parent 9814dc5e30
commit aaf1289f6b
No known key found for this signature in database
GPG key ID: 705C24D202990805
3 changed files with 58 additions and 1 deletions

52
.air.toml Normal file
View file

@ -0,0 +1,52 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[build]
args_bin = []
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ./cmd/payit/"
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
pre_cmd = []
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false
[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
main_only = false
silent = false
time = false
[misc]
clean_on_exit = false
[proxy]
app_port = 0
enabled = false
proxy_port = 0
[screen]
clear_on_rebuild = false
keep_scroll = true

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
*cache
*env*
tmp

View file

@ -4,7 +4,11 @@ GOCACHE ?= $(CURDIR)/.cache
GOMODCACHE ?= $(CURDIR)/.modcache
GOFLAGS ?= -count=1
.PHONY: fmt lint test clean tidy
.PHONY: dev fmt lint test clean tidy
dev:
@echo "Starting development environment"
@GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) air -c .air.toml
fmt:
@echo "Formatting Go files"