96 lines
2.5 KiB
Makefile
96 lines
2.5 KiB
Makefile
PORT?=8080
|
|
|
|
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 ./.
|
|
go run github.com/a-h/templ/cmd/templ@v0.2.707 fmt .
|
|
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:
|
|
go run github.com/a-h/templ/cmd/templ@v0.2.707 generate --watch \
|
|
--proxy=http://localhost:$(PORT) \
|
|
--proxybind="0.0.0.0" \
|
|
--open-browser=false
|
|
|
|
dev/server/web:
|
|
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 \
|
|
-- web -dev -port $(PORT)
|
|
|
|
dev/server/admin:
|
|
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 \
|
|
-- admin -dev -port $(PORT)
|
|
|
|
dev/sync_assets:
|
|
go run github.com/air-verse/air@v1.52.2 \
|
|
--build.cmd "go run github.com/a-h/templ/cmd/templ@v0.2.707 generate --notify-proxy" \
|
|
--build.bin "true" \
|
|
--build.delay "100" \
|
|
--build.exclude_dir "" \
|
|
--build.include_dir "assets" \
|
|
--build.include_ext "js,css"
|
|
|
|
dev/assets/css:
|
|
npm run unocss -- --watch
|
|
|
|
dev/web:
|
|
go run github.com/joho/godotenv/cmd/godotenv@v1.5.1 \
|
|
make -j4 dev/templ dev/server/web dev/sync_assets dev/assets/css
|
|
|
|
dev/admin:
|
|
go run github.com/joho/godotenv/cmd/godotenv@v1.5.1 \
|
|
make -j4 dev/templ dev/server/admin dev/sync_assets dev/assets/css
|
|
|
|
build/templ:
|
|
go run github.com/a-h/templ/cmd/templ@v0.2.707 generate
|
|
|
|
build/bin:
|
|
go build -o ./.dist/bin .
|
|
|
|
build/assets:
|
|
npm run unocss
|
|
|
|
build: build/templ build/assets build/bin
|
|
|
|
run/web: build
|
|
go run github.com/joho/godotenv/cmd/godotenv@v1.5.1 \
|
|
./.dist/bin web -port $(PORT)
|
|
|
|
run/admin: build
|
|
go run github.com/joho/godotenv/cmd/godotenv@v1.5.1 \
|
|
./.dist/bin admin -port $(PORT)
|
|
|
|
|
|
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
|