-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
114 lines (96 loc) · 4.4 KB
/
Copy pathMakefile
File metadata and controls
114 lines (96 loc) · 4.4 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# agent-pmo:76596cb
# =============================================================================
# Standard Makefile — dart_node
# Dart packages for building Node.js apps. Cross-platform (Linux, macOS, Windows).
# =============================================================================
.PHONY: build test lint fmt clean ci setup \
pub-get test-tier1 test-tier2 test-tier3 install-vsix help
# ---------------------------------------------------------------------------
# OS Detection ([MAKE-CROSS-PLATFORM])
# ---------------------------------------------------------------------------
ifeq ($(OS),Windows_NT)
SHELL := powershell.exe
.SHELLFLAGS := -NoProfile -Command
RM = Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
MKDIR = New-Item -ItemType Directory -Force
HOME ?= $(USERPROFILE)
else
RM = rm -rf
MKDIR = mkdir -p
endif
# Coverage — single source of truth is coverage-thresholds.json
# ([COVERAGE-THRESHOLDS-JSON]). No env vars, no GitHub repo variables.
COVERAGE_THRESHOLDS_FILE := coverage-thresholds.json
# =============================================================================
# Standard Targets (canonical names — do not rename or add synonyms)
# =============================================================================
## build: Compile/assemble all artifacts
build:
@echo "==> Building..."
@echo "Dart library packages — no standalone build artifacts"
## test: Fail-fast tests + coverage + threshold enforcement ([TEST-RULES]).
## Threshold is read from coverage-thresholds.json.
test:
@echo "==> Testing (fail-fast + coverage + threshold)..."
MIN_COVERAGE=$$(jq -r '.default_threshold' $(COVERAGE_THRESHOLDS_FILE)) ./tools/test.sh
## lint: Run all linters/analyzers (read-only). Does NOT format.
lint:
@echo "==> Linting..."
cspell "**/*.md" "**/*.dart" "**/*.ts" --no-progress
@find packages examples signal_mesh -name pubspec.yaml \
-not -path '*/node_modules/*' -not -path '*/.dart_tool/*' \
-not -path '*/build/*' | sort | while read -r pub; do \
grep -qE 'sdk:[[:space:]]*flutter' "$$pub" && continue; \
dir=$$(dirname "$$pub"); \
echo "Analyzing $$dir..."; \
(cd "$$dir" && dart analyze --no-fatal-warnings) || exit 1; \
done
## fmt: Format all code in-place. Pass CHECK=1 for read-only check (CI use).
fmt:
@echo "==> Formatting$(if $(CHECK), (check mode),)..."
dart format$(if $(CHECK), --set-exit-if-changed,) packages/ examples/ signal_mesh/
## clean: Remove all build artifacts
clean:
@echo "==> Cleaning..."
$(RM) logs
@for pkg in packages/*/; do \
[ -d "$$pkg/build" ] && $(RM) "$$pkg/build" || true; \
[ -d "$$pkg/coverage" ] && $(RM) "$$pkg/coverage" || true; \
done
## ci: lint + test + build (full CI simulation)
ci: lint test build
## setup: Install all Dart and npm dependencies (devcontainer hook)
setup: pub-get
# =============================================================================
# Repo-Specific Targets
# Owned by the repo. Preserved verbatim per [MAKE-REPO-SPECIFIC].
# =============================================================================
pub-get: ## Run dart pub get on all packages in dependency order
./tools/pub_get.sh
test-tier1: ## Run tier 1 tests only (core packages)
./tools/test.sh --tier 1
test-tier2: ## Run tier 2 tests only (dependent packages)
./tools/test.sh --tier 2
test-tier3: ## Run tier 3 tests only (examples)
./tools/test.sh --tier 3
install-vsix: ## Build and install the VS Code extension locally
./tools/run_todo_backend.sh
# =============================================================================
# HELP
# =============================================================================
help:
@echo "Standard targets:"
@echo " build - Compile/assemble all artifacts"
@echo " test - Fail-fast tests + coverage + threshold enforcement"
@echo " lint - All linters/analyzers (read-only, no formatting)"
@echo " fmt - Format all code in-place (CHECK=1 for read-only CI check)"
@echo " clean - Remove build artifacts"
@echo " ci - lint + test + build (full CI simulation)"
@echo " setup - Install all Dart and npm dependencies"
@echo ""
@echo "Repo-specific:"
@echo " pub-get - Run dart pub get in dependency order"
@echo " test-tier1 - Run tier 1 tests only"
@echo " test-tier2 - Run tier 2 tests only"
@echo " test-tier3 - Run tier 3 tests only"
@echo " install-vsix - Build and install VS Code extension"