mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +00:00
feat: Add justfile to replace Makefile with Just task runner
This commit is contained in:
parent
7b0d63855f
commit
150e8380e6
2 changed files with 50 additions and 33 deletions
33
Makefile
33
Makefile
|
|
@ -1,33 +0,0 @@
|
||||||
NAME=rentease
|
|
||||||
PORT=8000
|
|
||||||
DB_USER=ruidy
|
|
||||||
DB_NAME=villafleurie
|
|
||||||
|
|
||||||
build: format lint ## Build the binary
|
|
||||||
@docker build -t ${NAME}:latest .
|
|
||||||
run: build ## Run the binary
|
|
||||||
@docker run -p ${PORT}:${PORT} -e DATABASE_URL="host=docker.for.mac.host.internal user=${DB_USER} database=${DB_NAME}" -e PORT=${PORT} ${NAME}
|
|
||||||
dev: ## Run the binary in dev mode
|
|
||||||
@docker build -t ${NAME}:dev -f Dockerfile.dev .
|
|
||||||
@docker run -p ${PORT}:${PORT} --rm -v `pwd`:/app -v /app/tmp --name ${NAME} -e DATABASE_URL="host=docker.for.mac.host.internal user=${DB_USER} database=${DB_NAME}" -e PORT=${PORT} ${NAME}:dev
|
|
||||||
test: ## Run the tests
|
|
||||||
@go test ./...
|
|
||||||
up-deps: ## Update dependencies
|
|
||||||
@go get -u ./...
|
|
||||||
cron: ## Run the cron
|
|
||||||
@go run cmd/cron/main.go
|
|
||||||
format: ## Format the code
|
|
||||||
@templ generate internal/views
|
|
||||||
@templ fmt .
|
|
||||||
@go fmt ./...
|
|
||||||
lint: ## Lint the code
|
|
||||||
@golangci-lint run ./...
|
|
||||||
|
|
||||||
help: ## Display this help message
|
|
||||||
@echo "Usage: make [command]"
|
|
||||||
@echo
|
|
||||||
@echo "Commands:"
|
|
||||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-15s %s\n", $$1, $$2}'
|
|
||||||
|
|
||||||
.DEFAULT_GOAL := help
|
|
||||||
.PHONY: build run dev templ format lint
|
|
||||||
50
justfile
Normal file
50
justfile
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
# Set default values
|
||||||
|
name := "rentease"
|
||||||
|
port := "8000"
|
||||||
|
db_user := "ruidy"
|
||||||
|
db_name := "villafleurie"
|
||||||
|
|
||||||
|
# List available recipes
|
||||||
|
default:
|
||||||
|
@just --list
|
||||||
|
|
||||||
|
# Build the binary
|
||||||
|
build: format lint
|
||||||
|
@docker build -t {{name}}:latest .
|
||||||
|
|
||||||
|
# Run the binary
|
||||||
|
run: build
|
||||||
|
@docker run -p {{port}}:{{port}} \
|
||||||
|
-e DATABASE_URL="host=docker.for.mac.host.internal user={{db_user}} database={{db_name}}" \
|
||||||
|
-e PORT={{port}} {{name}}
|
||||||
|
|
||||||
|
# Run the binary in dev mode
|
||||||
|
dev:
|
||||||
|
@docker build -t {{name}}:dev -f Dockerfile.dev .
|
||||||
|
@docker run -p {{port}}:{{port}} --rm \
|
||||||
|
-v `pwd`:/app -v /app/tmp \
|
||||||
|
--name {{name}} \
|
||||||
|
-e DATABASE_URL="host=docker.for.mac.host.internal user={{db_user}} database={{db_name}}" \
|
||||||
|
-e PORT={{port}} {{name}}:dev
|
||||||
|
|
||||||
|
# Run the tests
|
||||||
|
test:
|
||||||
|
@go test ./...
|
||||||
|
|
||||||
|
# Update dependencies
|
||||||
|
up-deps:
|
||||||
|
@go get -u ./...
|
||||||
|
|
||||||
|
# Run the cron
|
||||||
|
cron:
|
||||||
|
@go run cmd/cron/main.go
|
||||||
|
|
||||||
|
# Format the code
|
||||||
|
format:
|
||||||
|
@templ generate internal/views
|
||||||
|
@templ fmt .
|
||||||
|
@go fmt ./...
|
||||||
|
|
||||||
|
# Lint the code
|
||||||
|
lint:
|
||||||
|
@golangci-lint run ./...
|
||||||
Loading…
Reference in a new issue