2024-10-31 10:12:38 -03:00
|
|
|
PORT?=8080
|
2025-01-03 10:26:04 -03:00
|
|
|
TEMPL_VERSION=v0.3.819
|
2024-10-31 10:12:38 -03:00
|
|
|
|
|
|
|
|
lint: build/templ
|
|
|
|
|
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1 run
|
|
|
|
|
# npx eslint .
|
|
|
|
|
|
|
|
|
|
lint/fix: build/templ
|
|
|
|
|
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1 run
|
|
|
|
|
# npx eslint --fix .
|
|
|
|
|
|
|
|
|
|
fmt: build/templ
|
|
|
|
|
go fmt ./.
|
2025-01-03 10:26:04 -03:00
|
|
|
go run github.com/a-h/templ/cmd/templ@$(TEMPL_VERSION) fmt .
|
2024-10-31 10:12:38 -03:00
|
|
|
go run mvdan.cc/gofumpt@v0.7.0 -l -w .
|
|
|
|
|
go run github.com/segmentio/golines@v0.12.2 -w .
|
|
|
|
|
go run golang.org/x/tools/cmd/goimports@v0.26.0 -w -l .
|
|
|
|
|
|
|
|
|
|
dev/templ:
|
2025-01-03 10:26:04 -03:00
|
|
|
go run github.com/a-h/templ/cmd/templ@$(TEMPL_VERSION) generate --watch \
|
2024-10-31 10:12:38 -03:00
|
|
|
--proxy=http://localhost:$(PORT) \
|
|
|
|
|
--proxybind="0.0.0.0" \
|
|
|
|
|
--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 \
|
|
|
|
|
-- -dev -port $(PORT)
|
|
|
|
|
|
|
|
|
|
dev/sync_assets:
|
|
|
|
|
go run github.com/air-verse/air@v1.52.2 \
|
2025-01-03 10:26:04 -03:00
|
|
|
--build.cmd "go run github.com/a-h/templ/cmd/templ@$(TEMPL_VERSION) generate --notify-proxy" \
|
2024-10-31 10:12:38 -03:00
|
|
|
--build.bin "true" \
|
|
|
|
|
--build.delay "100" \
|
|
|
|
|
--build.exclude_dir "" \
|
2024-11-01 17:09:09 -03:00
|
|
|
--build.include_dir "assets" \
|
2024-10-31 10:12:38 -03:00
|
|
|
--build.include_ext "js,css"
|
|
|
|
|
|
|
|
|
|
dev/assets/css:
|
|
|
|
|
npx unocss --watch
|
|
|
|
|
|
2024-07-03 00:27:44 -03:00
|
|
|
dev:
|
2024-10-31 10:12:38 -03:00
|
|
|
go run github.com/joho/godotenv/cmd/godotenv@v1.5.1 \
|
|
|
|
|
make -j4 dev/templ dev/server dev/sync_assets dev/assets/css
|
|
|
|
|
|
|
|
|
|
build/templ:
|
2025-01-03 10:26:04 -03:00
|
|
|
go run github.com/a-h/templ/cmd/templ@$(TEMPL_VERSION) generate
|
2024-10-31 10:12:38 -03:00
|
|
|
|
|
|
|
|
build/app:
|
|
|
|
|
go build -o ./.dist/app .
|
|
|
|
|
|
|
|
|
|
build/assets:
|
|
|
|
|
npx unocss
|
|
|
|
|
|
|
|
|
|
build: build/templ build/assets build/app
|
|
|
|
|
|
|
|
|
|
run: build
|
|
|
|
|
./.dist/app
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
|
# Remove templ generated files
|
|
|
|
|
find -type f -iname '*_templ.go' -delete \
|
|
|
|
|
-o -type f -iname '*_templ.txt' -delete
|
|
|
|
|
|
|
|
|
|
# Remove UnoCSS generated file
|
|
|
|
|
rm ./assets/css/uno.css
|
|
|
|
|
|
|
|
|
|
# Remove generated directories
|
|
|
|
|
if [[ -d ".dist" ]]; then rm -r ./.dist; fi
|
|
|
|
|
if [[ -d "tmp" ]]; then rm -r ./tmp; fi
|
|
|
|
|
if [[ -d "bin" ]]; then rm -r ./bin; fi
|