1818# ------------------------------------------
1919# .PHONY: ensures target used rather than matching file name
2020# https://makefiletutorial.com/#phony
21- .PHONY : all lint deps dist pre-commit-check repl test clean
21+ .PHONY : all clean deps dist lint pre-commit-check repl test test-ci test-watch
2222
2323# ------- Makefile Variables --------- #
2424# run help if no target specified
@@ -29,10 +29,12 @@ OUTDATED_FILE := outdated-$(shell date +%y-%m-%d-%T).org
2929# Column the target description is printed from
3030HELP-DESCRIPTION-SPACING := 24
3131
32- MEGALINTER_RUNNER = npx mega-linter-runner --flavor java --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
33-
3432# Makefile file and directory name wildcard
3533# EDN-FILES := $(wildcard *.edn)
34+
35+ # Tool variables
36+ # MEGALINTER_RUNNER = npx mega-linter-runner --flavor documentation --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
37+ MEGALINTER_RUNNER = npx mega-linter-runner --flavor java --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
3638# ------------------------------------ #
3739
3840# ------- Help ----------------------- #
@@ -44,15 +46,37 @@ help: ## Describe available tasks in Makefile
4446 awk -F ' :.*?## ' ' NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
4547# ------------------------------------ #
4648
47- # ------- Clojure Development -------- #
48- repl : # # Run Clojure REPL with rich terminal UI (Rebel Readline)
49+ # ------- Clojure Projects -------- #
50+ project-service : # # New project with practicalli/service template
51+ $(info --------- Create Service Project ---------)
52+ clojure -T:project/create :template practicalli/service :name practicalli/gameboard
53+
54+ project-service-donut : # # New project with practicalli/service template & Donut
55+ $(info --------- Create Service Project with Donut ---------)
56+ clojure -T:project/create :template practicalli/service :name practicalli/gameboard :target-dir gameboard-donut
57+
58+ project-service-integrant : # # New project with practicalli/service template & Integrant
59+ $(info --------- Create Service Project with Integrant ---------)
60+ clojure -T:project/create :template practicalli/service :name practicalli/gameboard :target-dir gameboard-integrant
61+
62+ landing-page-local : # # New project with practicalli/landing-page template local
4963 $(info --------- Run Rebel REPL ---------)
50- clojure -M:test/env:repl/reloaded
64+ clojure -T:project/create-local :template practicalli/landing-page :name practicalli/landing-page-local
65+
66+ landing-page : # # New project with practicalli/landing-page template local
67+ $(info --------- Run Rebel REPL ---------)
68+ clojure -T:project/create :template practicalli/landing-page :name practicalli/landing-page
5169
5270outdated : # # Check deps.edn & GitHub actions for new versions
5371 $(info --------- Search for outdated libraries ---------)
5472 - clojure -T:search/outdated > $(OUTDATED_FILE )
5573
74+ # ------- Clojure Workflow -------- #
75+ repl : # # Run Clojure REPL with rich terminal UI (Rebel Readline)
76+ $(info --------- Run Rebel REPL ---------)
77+ clojure -M:test/env:repl/reloaded
78+
79+
5680# deps: deps.edn ## Prepare dependencies for test and dist targets
5781# $(info --------- Download test and service libraries ---------)
5882# clojure -P -X:build
@@ -64,39 +88,40 @@ outdated: ## Check deps.edn & GitHub actions for new versions
6488# `-` before the command ignores any errors returned
6589clean : # # Clean build temporary files
6690 $(info --------- Clean Clojure classpath cache ---------)
67- - rm -rf ./.cpcache .clj-kondo .lsp
91+ - rm -rf ./.cpcache ./. clj-kondo ./ .lsp
6892# ------------------------------------ #
6993
7094# ------- Testing -------------------- #
71- # test-config: ## Print Kaocha test runner configuration
72- # $(info --------- Runner Configuration ---------)
73- # clojure -M:test/env:test/run --print-config
95+ test-config : # # Print Kaocha test runner configuration
96+ $(info --------- Runner Configuration ---------)
97+ clojure -M:test/env:test/run --print-config
98+
99+ test-profile : # # Profile unit test speed, showing 3 slowest tests
100+ $(info --------- Runner Profile Tests ---------)
101+ clojure -M:test/env:test/run --plugin kaocha.plugin/profiling
74102
75- # test-profile : ## Profile unit test speed, showing 3 slowest tests
76- # $(info --------- Runner Profile Tests ---------)
77- # clojure -M :test/env:test/run --plugin kaocha.plugin/profiling
103+ test : # # Run unit tests - stoping on first error
104+ $(info --------- Runner for unit tests ---------)
105+ clojure -X :test/env:test/run
78106
79- # test: ## Run unit tests - stoping on first error
80- # $(info --------- Runner for unit tests ---------)
81- # clojure -X:test/env:test/run
107+ test-all : # # Run all unit tests regardless of failing tests
108+ $(info --------- Runner for all unit tests ---------)
109+ clojure -X:test/env:test/run :fail-fast ? false
82110
83- # test-all : ## Run all unit tests regardless of failing tests
84- # $(info --------- Runner for all unit tests ---------)
85- # clojure -X:test/env:test/run :fail-fast? false
111+ test-watch : # # Run tests when changes saved, stopping test run on first error
112+ $(info --------- Watcher for unit tests ---------)
113+ clojure -X:test/env:test/run :watch ? true
86114
87- # test-watch: ## Run tests when changes saved, stopping test run on first error
88- # $(info --------- Watcher for unit tests ---------)
89- # clojure -X:test/env:test/run :watch? true
115+ test-watch-all : # # Run all tests when changes saved, regardless of failing tests
116+ $(info --------- Watcher for unit tests ---------)
117+ clojure -X:test/env:test/run :fail-fast ? false :watch? true
90118
91- # test-watch-all: ## Run all tests when changes saved, regardless of failing tests
92- # $(info --------- Watcher for unit tests ---------)
93- # clojure -X:test/env:test/run :fail-fast? false :watch? true
94119# ------------------------------------ #
95120
96121# -------- Build tasks --------------- #
97- # build-config: ## Pretty print build configuration
98- # $(info --------- View current build config ---------)
99- # clojure -T:build config
122+ build-config : # # Pretty print build configuration
123+ $(info --------- View current build config ---------)
124+ clojure -T:build config
100125
101126# build-jar: ## Build a jar archive of Clojure project
102127# $(info --------- Build library jar ---------)
@@ -106,9 +131,10 @@ clean: ## Clean build temporary files
106131# $(info --------- Build service Uberjar ---------)
107132# clojure -T:build uberjar
108133
109- # build-clean: ## Clean build assets or given directory
110- # $(info --------- Clean Build ---------)
111- # clojure -T:build clean
134+ build-clean : # # Clean build assets or given directory
135+ $(info --------- Clean Build ---------)
136+ clojure -T:build clean
137+
112138# ------------------------------------ #
113139
114140# ------- Code Quality --------------- #
@@ -126,7 +152,7 @@ lint: ## Run MegaLinter with custom configuration (node.js required)
126152 $(info --------- MegaLinter Runner ---------)
127153 $(MEGALINTER_RUNNER )
128154
129- lint-fix : # # Run MegaLinter with custom configuration (node.js required)
155+ lint-fix : # # Run MegaLinter with applied fixes and custom configuration (node.js required)
130156 $(info --------- MegaLinter Runner ---------)
131157 $(MEGALINTER_RUNNER ) --fix
132158
@@ -140,17 +166,18 @@ megalinter-upgrade: ## Upgrade MegaLinter config to latest version
140166# ------------------------------------ #
141167
142168# ------- Docker Containers ---------- #
143- # docker-build: ## Build Clojure Service with docker compose
169+ # docker-build: ## Build Clojure project and run with docker compose
144170# $(info --------- Docker Compose Build ---------)
145- # docker compose up --build
171+ # docker compose up --build --detach
146172
147- # docker-build-clean: ## Build Clojure Service with docker compose, removing orphans
173+ # docker-build-clean: ## Build Clojure project and run with docker compose, removing orphans
148174# $(info --------- Docker Compose Build - remove orphans ---------)
149- # docker compose up --build --remove-orphans
175+ # docker compose up --build --remove-orphans --detach
150176
151- # docker-down: ## Shut down Clojure service using docker compose
177+ # docker-down: ## Shut down containers in docker compose
152178# $(info --------- Docker Compose Down ---------)
153- # docker-compose down
179+ # docker compose down
180+
154181
155182# swagger-editor: ## Start Swagger Editor in Docker
156183# $(info --------- Run Swagger Editor at locahost:8282 ---------)
@@ -172,6 +199,7 @@ megalinter-upgrade: ## Upgrade MegaLinter config to latest version
172199
173200# Run tests, build & package the Clojure code and clean up afterward
174201# `make all` used in Docker builder stage
175- # .DELETE_ON_ERROR:
176- # all: test-ci dist clean ## Call test-ci dist and clean targets, used for CI
202+ .DELETE_ON_ERROR :
203+ all : test-ci dist clean # # Call test-ci dist and clean targets, used for CI
204+
177205# ------------------------------------ #
0 commit comments