-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathMakefile
58 lines (48 loc) · 1.51 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.PHONY: all help lint format check test build clean install
# Default target
all: lint check build
# Help command
help:
@echo "Available commands:"
@echo " make Run lint, check, and build"
@echo " make help Show this help message"
@echo " make lint Run ESLint"
@echo " make format Format code with Prettier"
@echo " make check Check formatting with Prettier"
@echo " make test Run tests"
@echo " make build Build the project"
@echo " make clean Remove build artifacts"
@echo " make install Install dependencies"
# Check if Node and npm are installed
check-node:
@which node > /dev/null || (echo "Node.js is not installed. Please install it first." && exit 1)
@which npm > /dev/null || (echo "npm is not installed. Please install it first." && exit 1)
# Install dependencies
install: check-node
@echo "📦 Installing dependencies..."
@npm install
# Lint code
lint: check-node
@echo "🔍 Linting code..."
@npm run lint
# Format code
format: check-node
@echo "✨ Formatting code..."
@npm run format
# Check formatting
check: check-node
@echo "🔎 Checking formatting..."
@npm run format-check
# Run tests
test: check-node
@echo "🧪 Running tests..."
@npm test || echo "⚠️ No tests available. Consider adding tests."
# Build the project
build: check-node
@echo "🏗️ Building project..."
@npm run build
# Clean build artifacts
clean:
@echo "🧹 Cleaning build artifacts..."
@rm -rf dist/ || true
@echo "✅ Clean complete"