Skip to content

Commit 8f79ecf

Browse files
authored
Improving the Makefile.
1 parent e9d23cf commit 8f79ecf

File tree

1 file changed

+55
-7
lines changed

1 file changed

+55
-7
lines changed

Makefile

+55-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,58 @@
1-
.PHONY: lint format check
1+
.PHONY: all help lint format check test build clean install
22

3-
lint:
4-
npm run-script lint
3+
# Default target
4+
all: lint check build
55

6-
format:
7-
npm run-script format
6+
# Help command
7+
help:
8+
@echo "Available commands:"
9+
@echo " make Run lint, check, and build"
10+
@echo " make help Show this help message"
11+
@echo " make lint Run ESLint"
12+
@echo " make format Format code with Prettier"
13+
@echo " make check Check formatting with Prettier"
14+
@echo " make test Run tests"
15+
@echo " make build Build the project"
16+
@echo " make clean Remove build artifacts"
17+
@echo " make install Install dependencies"
818

9-
check:
10-
npm run-script format-check
19+
# Check if Node and npm are installed
20+
check-node:
21+
@which node > /dev/null || (echo "Node.js is not installed. Please install it first." && exit 1)
22+
@which npm > /dev/null || (echo "npm is not installed. Please install it first." && exit 1)
23+
24+
# Install dependencies
25+
install: check-node
26+
@echo "📦 Installing dependencies..."
27+
@npm install
28+
29+
# Lint code
30+
lint: check-node
31+
@echo "🔍 Linting code..."
32+
@npm run lint
33+
34+
# Format code
35+
format: check-node
36+
@echo "✨ Formatting code..."
37+
@npm run format
38+
39+
# Check formatting
40+
check: check-node
41+
@echo "🔎 Checking formatting..."
42+
@npm run format-check
43+
44+
# Run tests
45+
test: check-node
46+
@echo "🧪 Running tests..."
47+
@npm test || echo "⚠️ No tests available. Consider adding tests."
48+
49+
# Build the project
50+
build: check-node
51+
@echo "🏗️ Building project..."
52+
@npm run build
53+
54+
# Clean build artifacts
55+
clean:
56+
@echo "🧹 Cleaning build artifacts..."
57+
@rm -rf dist/ || true
58+
@echo "✅ Clean complete"

0 commit comments

Comments
 (0)