Files
guz.one/makefile

60 lines
1.3 KiB
Makefile
Raw Permalink Normal View History

2024-05-23 11:21:00 -03:00
PORT?=8080
2024-06-17 16:37:03 -03:00
build: templ
2024-06-17 16:28:19 -03:00
pnpm unocss
go build -o bin/www
2024-06-17 16:37:03 -03:00
build/static: templ
2024-06-17 16:34:02 -03:00
pnpm unocss
go run ./cmd/build
2024-06-17 16:28:19 -03:00
dev/templ:
templ generate --watch \
--proxy=http://localhost:$(PORT) \
--open-browser=false
dev/server:
go run github.com/air-verse/air@v1.52.2 \
--build.cmd "go build -o tmp/bin/main" \
--build.bin "tmp/bin/main" \
--build.exclude_dir "node_modules" \
--build.include_ext "go" \
--build.stop_on_error "false" \
--misc.clean_on_exit true \
2024-05-24 11:29:44 -03:00
-- -p $(PORT) -d
2024-05-23 11:21:00 -03:00
2024-06-17 16:28:19 -03:00
dev/unocss:
pnpm unocss -w
2024-05-23 10:45:27 -03:00
2024-06-17 16:28:19 -03:00
dev/sync_assets:
go run github.com/air-verse/air@v1.52.2 \
--build.cmd "templ generate --notify-proxy" \
--build.bin "true" \
--build.delay "100" \
--build.exclude_dir "" \
--build.include_dir "static" \
--build.include_ext "js,css"
2024-05-23 10:45:27 -03:00
2024-06-17 16:28:19 -03:00
dev:
make -j4 dev/templ dev/server dev/unocss dev/sync_assets
2024-05-23 10:45:27 -03:00
2024-06-17 16:28:19 -03:00
run: build
./bin/www
2024-05-23 10:45:27 -03:00
2024-06-17 16:28:19 -03:00
all: build
2024-05-23 10:45:27 -03:00
clean:
if [[ -d "dist" ]]; then rm -r ./dist; fi
if [[ -d "tmp" ]]; then rm -r ./tmp; fi
if [[ -d "bin" ]]; then rm -r ./bin; fi
2024-05-23 16:30:37 -03:00
rm ./static/uno.css
2024-05-23 10:45:27 -03:00
rm $(TEMPL_FILES)
2024-06-17 16:37:03 -03:00
# For some reason "templ generate" does not detect the files in CI,
# so this is a workaround.
TEMPL_FILES=$(patsubst %.templ, %_templ.go, $(wildcard **/*.templ))
templ: $(TEMPL_FILES)
@echo Generating templ files
%_templ.go: %.templ
templ generate -f $^ > /dev/null