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# ---------------------------------------------------------------------------
21- # # ------------------------------------------------------------
22- ----LOCAL_BUILDS : Show help for available targets
23-
24- # # Local: Install site dependencies
28+
29+ # ---------------------------------------------------------------------------
30+ # MAINTENANCE: Show help for available targets
31+ # ---------------------------------------------------------------------------
32+
33+ # # Verify required commands and local dependencies are present.
34+ check-deps :
35+ @echo " Checking if 'npm' and local 'hugo' binary are present..."
36+ @command -v npm > /dev/null || { echo " Error: 'npm' not found. Please install Node.js and npm." ; exit 1; }
37+ @test -x node_modules/.bin/hugo || { echo " Error: Hugo binary not found in node_modules. Please run 'make setup' first." ; exit 1; }
38+ @echo " Dependencies check passed."
39+
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
2556setup :
2657 npm install
2758
28- # # Local: Build and run site locally with draft and future content enabled.
29- site : check-go
30- hugo server -D -F
59+ # # Build the site locally with draft and future content enabled.
60+ build : check-go check-deps
61+ npm run build
3162
32- # # Local: Build site for local consumption
33- build :
34- hugo build
63+ # # Build the site for a deploy preview.
64+ build-preview : check-go check-deps
65+ npm run build:preview
3566
36- # # Build site for local consumption
37- build-preview :
38- hugo --baseURL= $( BASEURL )
67+ # # Build the site for production.
68+ build-production : check-go check-deps
69+ npm run build:production
3970
40- # # Empty build cache and run on your local machine.
41- clean :
42- hugo --cleanDestinationDir
43- make setup
44- make site
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
4574
46- # # Fix Markdown linting issues
47- lint-fix :
48- @echo " Checking for markdownlint-cli2..."
49- @command -v markdownlint-cli2 > /dev/null || { \
50- echo " markdownlint-cli2 not found. Attempting to install globally..." ; \
51- command -v npm > /dev/null || { echo " npm is not installed. Please install Node.js/npm and re-run 'make lint-fix'." ; exit 1; }; \
52- npm install -g markdownlint-cli2; \
53- }
54- @echo " Running markdownlint-cli2 --fix..."
55- @markdownlint-cli2 --fix " **/*.md" " #node_modules" " #public" " #resources"
56-
57- # # ------------------------------------------------------------
58- ----MAINTENANCE : Show help for available targets
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
5978
60- check-go :
61- @echo " Checking if Go is installed..."
62- @command -v go > /dev/null || (echo " Go is not installed. Please install it before proceeding." ; exit 1)
63- @echo " Go is installed."
79+ # # Empty the build cache, reinstall dependencies, and run the site locally.
80+ clean :
81+ npm run clean
82+ $(MAKE ) setup
83+ $(MAKE ) site
6484
65- # # Update the academy-theme package to latest version
66- theme-update :
67- echo " Updating to latest academy-theme..." && \
68- hugo mod get github.com/layer5io/academy-theme
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
88+
89+ # # Format code using Prettier
90+ format :
91+ npm run format
92+
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"
69100
70- .PHONY : setup build build-preview site clean lint-fix check-go 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