Skip to content

Commit 05906ba

Browse files
committed
chore: standardize Makefile npm scripts
Signed-off-by: Bhumika Garg <bhumikatech2024@gmail.com>
1 parent 694d002 commit 05906ba

3 files changed

Lines changed: 1251 additions & 83 deletions

File tree

Makefile

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@
1515
include .github/build/Makefile.core.mk
1616
include .github/build/Makefile.show-help.mk
1717

18-
#----------------------------------------------------------------------------
18+
# ---------------------------------------------------------------------------
1919
# Academy
2020
# ---------------------------------------------------------------------------
2121

22-
## ------------------------------------------------------------
23-
----LOCAL_BUILDS: Show help for available targets
24-
25-
## Local: Install site dependencies
26-
setup:
27-
npm i
22+
# ---------------------------------------------------------------------------
23+
# MAINTENANCE: Show help for available targets
24+
# ---------------------------------------------------------------------------
2825

2926
## Verify required commands and local dependencies are present.
3027
check-deps:
@@ -33,50 +30,62 @@ check-deps:
3330
@test -x node_modules/.bin/hugo || { echo "Error: Hugo binary not found in node_modules. Please run 'make setup' first."; exit 1; }
3431
@echo "Dependencies check passed."
3532

36-
## Build site for production (no drafts, no future, no expired content).
37-
build: check-deps check-go
33+
## Validate Go is installed
34+
check-go:
35+
@echo "Checking if Go is installed..."
36+
@command -v go > /dev/null || { echo "Go is not installed. Please install it before proceeding."; exit 1; }
37+
@echo "Go is installed."
38+
39+
## Update the academy-theme package to latest version
40+
theme-update: check-go check-deps
41+
@echo "Updating to latest academy-theme..."
42+
npm run update:theme
43+
44+
#----------------------------------------------------------------------------
45+
# LOCAL_BUILDS: Show help for available targets
46+
#----------------------------------------------------------------------------
47+
48+
## Install site dependencies
49+
setup:
50+
npm install
51+
52+
## Build site for local consumption
53+
build: check-go check-deps
3854
npm run build:production
3955

40-
## Build site for preview (includes drafts, future, and expired content) with dynamically set baseURL.
41-
build-preview: check-deps check-go
56+
## Build site for local consumption
57+
build-preview: check-go check-deps
4258
npm run build:preview
4359

44-
## Local: Build and run site locally with draft and future content enabled.
45-
site: check-deps check-go
60+
## Build and run site locally with draft and future content enabled.
61+
site: check-go check-deps
4662
npm run dev:site
4763

48-
## Local: Run site locally in serve mode (without file watching).
49-
serve: check-deps check-go
64+
## Build and run site locally
65+
serve: check-go check-deps
5066
npm run dev:serve
5167

5268
## Empty build cache and run on your local machine.
5369
clean:
5470
npm run clean
55-
$(MAKE) setup
56-
$(MAKE) site
71+
72+
## Format code using Prettier
73+
format:
74+
npm run format
5775

5876
## Fix Markdown linting issues
5977
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
71-
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."
76-
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
78+
npm run lint:fix
8179

82-
.PHONY: setup check-deps check-go build build-preview site serve clean lint-fix theme-update
80+
.PHONY: \
81+
setup \
82+
build \
83+
build-preview \
84+
serve \
85+
site \
86+
clean \
87+
format \
88+
lint-fix \
89+
check-deps \
90+
check-go \
91+
theme-update

0 commit comments

Comments
 (0)