Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
100 lines (80 loc) · 2.84 KB
/
Copy pathMakefile
File metadata and controls
100 lines (80 loc) · 2.84 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
SHELL := /usr/bin/env bash
.DEFAULT_GOAL := help
NPM ?= npm
TREE_IGNORE := node_modules|.svelte-kit|build|dist|.vercel|.netlify|.turbo|.parcel-cache|.cache|.vite|coverage|.nyc_output|.eslintcache|.DS_Store|.idea|.vscode|.git|.pnpm-store|.yarn|.pnp|.pnp.cjs|package-lock.json|pnpm-lock.yaml|yarn.lock
.PHONY: help \
install clean deep-clean \
dev build preview \
check check-watch lint format \
tree routes pkg-overview overview \
search
help: ## Show available targets
@echo "Repo root: $$(pwd)"
@echo ""
@echo "Targets:"
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'
@echo ""
@echo "Examples:"
@echo " make install"
@echo " make dev"
@echo " make build"
@echo " make overview"
@echo " make search PATTERN='prerender|trailingSlash|adapter-static'"
install: ## Install deps (uses lockfile if present)
$(NPM) ci
dev: ## Run dev server
$(NPM) run dev
build: ## Build site
$(NPM) run build
preview: ## Preview built site locally
$(NPM) run preview
check: ## Type-check / svelte-check (if configured)
$(NPM) run check
check-watch: ## Watch mode for check (if configured)
$(NPM) run check:watch
lint: ## Lint (if configured)
$(NPM) run lint
format: ## Format (if configured)
$(NPM) run format
clean: ## Remove generated build artifacts
rm -rf .svelte-kit build dist
deep-clean: clean ## Also remove dependencies
rm -rf node_modules
tree: ## Print repo tree (ignoring common dirs)
tree -a --dirsfirst -I "$(TREE_IGNORE)" .
routes: ## List SvelteKit route files
find src/routes -type f \
\( -name '+*.svelte' -o -name '+*.ts' -o -name '+*.js' -o -name '+*.server.ts' -o -name '+layout*' -o -name '+page*' \) \
-print | sort
pkg-overview: ## Show package + key config snapshots
@echo "===== package.json (top) ====="
sed -n '1,220p' package.json
@echo ""
@echo "===== svelte.config.* ====="
@ls -1 svelte.config.* 2>/dev/null || true
@for f in svelte.config.*; do \
[ -f "$$f" ] && echo "--- $$f ---" && sed -n '1,260p' "$$f" && echo ""; \
done
@echo "===== vite.config.* ====="
@ls -1 vite.config.* 2>/dev/null || true
@for f in vite.config.*; do \
[ -f "$$f" ] && echo "--- $$f ---" && sed -n '1,260p' "$$f" && echo ""; \
done
@echo "===== tsconfig.json ====="
@[ -f tsconfig.json ] && sed -n '1,260p' tsconfig.json || true
overview: ## Quick repo overview (tree + routes + pkg-overview)
@$(MAKE) tree
@echo ""
@$(MAKE) routes
@echo ""
@$(MAKE) pkg-overview
search: ## Grep the repo: make search PATTERN="..."
@if [ -z "$(PATTERN)" ]; then \
echo "Usage: make search PATTERN='something'"; \
exit 2; \
fi
grep -RIn \
--exclude-dir=node_modules --exclude-dir=.svelte-kit --exclude-dir=build --exclude-dir=dist --exclude-dir=.git \
-- "$(PATTERN)" src
deps.check: ## Checks dependency usage
npx knip