1
- # ------------------------------------------
2
- # Practicalli: Makefile
1
+ # -------------------------------------- #
2
+ # Practicalli Makefile
3
3
#
4
4
# Consistent set of targets to support local book development
5
- # ------------------------------------------
5
+ # -------------------------------------- #
6
6
7
+ # -- Makefile task config -------------- #
7
8
# .PHONY: ensures target used rather than matching file name
8
9
# https://makefiletutorial.com/#phony
9
10
.PHONY : all clean docs lint pre-commit-check test
11
+ # -------------------------------------- #
10
12
11
- # ------- Makefile Variables --------- #
13
+ # -- Makefile Variables ------- --------- #
12
14
# run help if no target specified
13
15
.DEFAULT_GOAL := help
14
- SHELL := /usr/bin/zsh
15
-
16
16
# Column the target description is printed from
17
17
HELP-DESCRIPTION-SPACING := 24
18
18
19
+ SHELL := /usr/bin/zsh
20
+
19
21
# Tool Commands
20
22
MEGALINTER_RUNNER := npx mega-linter-runner --flavor documentation --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --env "'VALIDATE_ALL_CODEBASE=true'" --remove-container
21
23
MKDOCS_SERVER := mkdocs serve --dev-addr localhost:7777
22
24
OUTDATED_FILE := outdated-$(shell date +% y-% m-% d-% T) .md
25
+ # -------------------------------------- #
23
26
24
- # Makefile file and directory name wildcard
25
- EDN-FILES := $(wildcard * .edn)
26
- # ------------------------------------ #
27
-
28
- # ------ Quality Checks ------------ #
27
+ # -- Quality Checks ------------------ #
29
28
pre-commit-check : lint
30
29
31
30
lint : # # Run MegaLinter with custom configuration (node.js required)
32
- $(info --------- MegaLinter Runner ---------)
31
+ $(info -- MegaLinter Runner ------------ ---------)
33
32
$(MEGALINTER_RUNNER )
34
33
35
- lint-fix : # # Run MegaLinter with custom configuration (node.js required)
36
- $(info --------- MegaLinter Runner ---------)
34
+ lint-fix : # # Run MegaLinter with applied fixes and custom configuration (node.js required)
35
+ $(info -- MegaLinter Runner fix errors - ---------)
37
36
$(MEGALINTER_RUNNER ) --fix
38
37
39
38
lint-clean : # # Clean MegaLinter report information
40
- $(info --------- MegaLinter Clean Reports ---------)
39
+ $(info -- MegaLinter Clean Reports ----- ---------)
41
40
- rm -rf ./megalinter-reports
42
41
43
42
megalinter-upgrade : # # Upgrade MegaLinter config to latest version
44
- $(info --------- MegaLinter Upgrade Config ---------)
43
+ $(info -- MegaLinter Upgrade Config ---- ---------)
45
44
npx mega-linter-runner@latest --upgrade
46
45
47
46
dependencies-outdated : # # Report new versions of library dependencies and GitHub action
@@ -51,31 +50,59 @@ dependencies-outdated: ## Report new versions of library dependencies and GitHub
51
50
dependencies-update : # # Update all library dependencies and GitHub action
52
51
$(info -- Search for outdated libraries ---------)
53
52
- clojure -T:update/dependency-versions > $(OUTDATED_FILE )
54
- # ------------------------------------ #
53
+ # -------------------------------------- #
54
+
55
+ # --- Documentation Generation -------- #
56
+ python-venv : # # Create Python Virtual Environment
57
+ $(info -- Create Python Virtual Environment --)
58
+ python3 -m venv ~ /.local/venv
55
59
56
- # --- Documentation Generation ------ #
57
- python-venv : # # Enable Python Virtual Environment for MkDocs
58
- $(info --------- Mkdocs Local Server ---------)
60
+ python-activate : # # Activate Python Virtual Environment for MkDocs
61
+ $(info -- Mkdocs Local Server ----------------)
59
62
source ~ /.local/venv/bin/activate
60
63
64
+ mkdocs-install :
65
+ $(info -- Install Material for MkDocs -----------)
66
+ source ~ /.local/venv/bin/activate && pip install mkdocs-material mkdocs-callouts mkdocs-glightbox mkdocs-git-revision-date-localized-plugin mkdocs-redirects mkdocs-rss-plugin pillow cairosvg --upgrade
67
+
61
68
docs : # # Build and run mkdocs in local server (python venv)
62
- $(info --------- Mkdocs Local Server ---------)
69
+ $(info -- MkDocs Local Server ---------- ---------)
63
70
source ~ /.local/venv/bin/activate && $(MKDOCS_SERVER )
64
71
65
72
docs-changed : # # Build only changed files and run mkdocs in local server (python venv)
66
- $(info --------- Mkdocs Local Server ---------)
73
+ $(info -- Mkdocs Local Server ---------- ---------)
67
74
source ~ /.local/venv/bin/activate && $(MKDOCS_SERVER ) --dirtyreload
68
75
69
76
docs-build : # # Build mkdocs (python venv)
70
- $(info --------- Mkdocs Local Server ---------)
77
+ $(info -- Mkdocs Build Website --------- ---------)
71
78
source ~ /.local/venv/bin/activate && mkdocs build
72
- # ------------------------------------ #
73
79
74
- # ------------ Help ------------------ #
80
+ docs-debug : # # Run mkdocs local server in debug mode (python venv)
81
+ $(info -- Mkdocs Local Server Debug -------------)
82
+ . ~ /.local/venv/bin/activate; $(MKDOCS_SERVER ) -v
83
+
84
+ docs-staging : # # Deploy to staging repository
85
+ $(info -- Mkdocs Staging Deploy ---------------)
86
+ source ~ /.local/venv/bin/activate && mkdocs gh-deploy --force --no-history --config-file mkdocs-staging.yml
87
+ # -------------------------------------- #
88
+
89
+ # ------- Version Control -------------- #
90
+ git-sr : # # status list of git repos under current directory
91
+ $(info -- Multiple Git Repo Status --------------)
92
+ mgitstatus -e --flatten
93
+
94
+ git-status : # # status details of git repos under current directory
95
+ $(info -- Multiple Git Status -------------------)
96
+ mgitstatus
97
+ # -------------------------------------- #
98
+
99
+ # ------------ Help -------------------- #
75
100
# Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
76
101
77
102
help : # # Describe available tasks in Makefile
78
103
@grep ' ^[a-zA-Z]' $(MAKEFILE_LIST ) | \
79
104
sort | \
80
105
awk -F ' :.*?## ' ' NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
81
- # ------------------------------------ #
106
+ # -------------------------------------- #
107
+
108
+ dist : deps-build # # Build mkdocs website
0 commit comments