49 lines
		
	
	
	
		
			1,012 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
	
		
			1,012 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
# Build the application
 | 
						|
all: deps build
 | 
						|
 | 
						|
 | 
						|
deps:
 | 
						|
	go mod tidy
 | 
						|
	go install github.com/a-h/templ/cmd/templ@latest
 | 
						|
 | 
						|
build:
 | 
						|
	echo "Building..."
 | 
						|
	tailwindcss -o server/web/assets/styles.css
 | 
						|
	templ generate
 | 
						|
	go build -o main.out server/main.go
 | 
						|
 | 
						|
# Run the application
 | 
						|
run:
 | 
						|
	go run main.go
 | 
						|
 | 
						|
# Test the application
 | 
						|
test:
 | 
						|
	echo "Testing..."
 | 
						|
	go test ./tests/... -v
 | 
						|
 | 
						|
# Clean the binary
 | 
						|
clean:
 | 
						|
	echo "Cleaning..."
 | 
						|
	rm -f main.out
 | 
						|
	rm -rf db.sqlite
 | 
						|
	rm -rf sessions/*
 | 
						|
	rm -rf storage/*
 | 
						|
 | 
						|
# Live Reload
 | 
						|
watch:
 | 
						|
	@if command -v air > /dev/null; then \
 | 
						|
	    air; \
 | 
						|
	    echo "Watching...";\
 | 
						|
	else \
 | 
						|
	    read -p "Go's 'air' is not installed on your machine. Do you want to install it? [Y/n] " choice; \
 | 
						|
	    if [ "$$choice" != "n" ] && [ "$$choice" != "N" ]; then \
 | 
						|
	                                go install github.com/air-verse/air@latest; \
 | 
						|
	        air; \
 | 
						|
	        echo "Watching...";\
 | 
						|
	    else \
 | 
						|
	        echo "You chose not to install air. Exiting..."; \
 | 
						|
	        exit 1; \
 | 
						|
	    fi; \
 | 
						|
	fi
 | 
						|
 | 
						|
.PHONY: all build run test clean
 |