1515include .github/build/Makefile.core.mk
1616include .github/build/Makefile.show-help.mk
1717
18- # ----------------------------------------------------------------------------
18+ # Changes to any main recipe in this Makefile, require a corresponding change in all other repositories subscribed to the 'meshery-academy' topic.
19+
20+ # htmltest is fetched and run on demand via 'go run' (no install step). Pin it for
21+ # reproducible link checks; leave as 'latest' to always use the newest release.
22+ HTMLTEST_VERSION ?= latest
23+ export HTMLTEST_VERSION
24+
25+ # ---------------------------------------------------------------------------
1926# Academy
2027# ---------------------------------------------------------------------------
2128
22- # # ------------------------------------------------------------
23- ----LOCAL_BUILDS : Show help for available targets
24-
25- # # Local: Install site dependencies
26- setup :
27- npm i
29+ # ---------------------------------------------------------------------------
30+ # MAINTENANCE: Show help for available targets
31+ # ---------------------------------------------------------------------------
2832
2933# # Verify required commands and local dependencies are present.
3034check-deps :
@@ -33,50 +37,79 @@ check-deps:
3337 @test -x node_modules/.bin/hugo || { echo " Error: Hugo binary not found in node_modules. Please run 'make setup' first." ; exit 1; }
3438 @echo " Dependencies check passed."
3539
36- # # Build site for production (no drafts, no future, no expired content).
37- build : check-deps check-go
38- npm run build:production
40+ # # Validate Go is installed
41+ check-go :
42+ @echo " Checking if Go is installed..."
43+ @command -v go > /dev/null || { echo " Go is not installed. Please install it before proceeding." ; exit 1; }
44+ @echo " Go is installed."
45+
46+ # # Update the academy-theme package to latest version
47+ theme-update : check-go check-deps
48+ @echo " Updating to latest academy-theme..."
49+ npm run update:theme
50+
51+ # ---------------------------------------------------------------------------
52+ # LOCAL BUILDS: Show help for available targets
53+ # ---------------------------------------------------------------------------
54+
55+ # # Install site dependencies
56+ setup :
57+ npm install
3958
40- # # Build site for preview (includes drafts, future, and expired content) with dynamically set baseURL.
41- build-preview : check-deps check-go
59+ # # Build the site locally with draft and future content enabled.
60+ build : check-go check-deps
61+ npm run build
62+
63+ # # Build the site for a deploy preview.
64+ build-preview : check-go check-deps
4265 npm run build:preview
4366
44- # # Local: Build and run site locally with draft and future content enabled .
45- site : check-deps check-go
46- npm run dev:site
67+ # # Build the site for production .
68+ build-production : check-go check-deps
69+ npm run build:production
4770
48- # # Local: Run site locally in serve mode (without file watching ).
49- serve : check-deps check-go
50- npm run dev:serve
71+ # # Build and run the site locally with live reload (draft and future content enabled ).
72+ site : check-go check-deps
73+ npm run site
5174
52- # # Empty build cache and run on your local machine.
75+ # # Build and serve the site once with the file-watcher off (no live reload).
76+ site-no-watch : check-go check-deps
77+ npm run site:no-watch
78+
79+ # # Empty the build cache, reinstall dependencies, and run the site locally.
5380clean :
5481 npm run clean
5582 $(MAKE ) setup
5683 $(MAKE ) site
5784
58- # # Fix Markdown linting issues
59- lint-fix :
60- @echo " Checking for markdownlint-cli2..."
61- @command -v markdownlint-cli2 > /dev/null || { \
62- echo " markdownlint-cli2 not found. Attempting to install globally..." ; \
63- command -v npm > /dev/null || { echo " npm is not installed. Please install Node.js/npm and re-run 'make lint-fix'." ; exit 1; }; \
64- npm install -g markdownlint-cli2; \
65- }
66- @echo " Running markdownlint-cli2 --fix..."
67- @markdownlint-cli2 --fix " **/*.md" " #node_modules" " #public" " #resources"
68-
69- # # ------------------------------------------------------------
70- ----MAINTENANCE : Show help for available targets
85+ # # Check internal links in the built site (htmltest is fetched on demand via 'go run').
86+ check-links : check-go check-deps
87+ npm run check:links
7188
72- check-go :
73- @echo " Checking if Go is installed..."
74- @command -v go > /dev/null || (echo " Go is not installed. Please install it before proceeding." ; exit 1)
75- @echo " Go is installed."
89+ # # Format code using Prettier
90+ format :
91+ npm run format
7692
77- # # Update the academy-theme package to latest version
78- theme-update : check-deps check-go
79- @echo " Updating to latest academy-theme..."
80- npm run update:theme
93+ # # Check formatting without writing changes.
94+ format-check :
95+ npm run format:check
96+
97+ # # Fix Markdown linting issues
98+ lint-fix :
99+ npx --yes markdownlint-cli2 --fix " content/**/*.md"
81100
82- .PHONY : setup check-deps check-go build build-preview site serve clean lint-fix theme-update
101+ .PHONY : \
102+ setup \
103+ build \
104+ build-preview \
105+ build-production \
106+ site \
107+ site-no-watch \
108+ clean \
109+ check-links \
110+ format \
111+ format-check \
112+ lint-fix \
113+ check-deps \
114+ check-go \
115+ theme-update
0 commit comments