-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
139 lines (109 loc) · 3.44 KB
/
Makefile
File metadata and controls
139 lines (109 loc) · 3.44 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Systemix Monorepo Makefile
# pnpm workspace + Turborepo
# Variables
PNPM := pnpm
TURBO := pnpm turbo
# Resolve turbo filter: demos uses "demos", others use @systemix/<name>
pkg_filter = $(if $(filter demos,$(1)),demos,@systemix/$(1))
# Discovery
PACKAGES := $(shell ls packages 2>/dev/null)
CONFIGS := $(shell ls configs 2>/dev/null)
WORKSPACES := $(PACKAGES) $(CONFIGS) demos
.PHONY: help install i dev test build lint format typecheck clean clean-all
.PHONY: build-% lint-% format-% typecheck-% test-%
.PHONY: add add-pkg update list ls changeset version publish
help:
@echo "Systemix Monorepo — pnpm workspace + Turborepo"
@echo "=============================================="
@echo ""
@echo "Workspace Commands:"
@echo " make install, make i Install all dependencies"
@echo " make dev Start dev servers (turbo dev)"
@echo " make test Run tests in all packages"
@echo " make update Update dependencies across workspace"
@echo " make list, make ls List workspace packages"
@echo ""
@echo "Global Commands:"
@echo " make build Build all packages"
@echo " make lint Lint all packages"
@echo " make format Format all files (prettier + turbo)"
@echo " make typecheck Typecheck all packages"
@echo " make clean Clean build artifacts"
@echo " make clean-all Deep clean (node_modules, dist, turbo cache)"
@echo ""
@echo "Package Commands (use pkg name, e.g. password, demos):"
@echo " make build-<pkg> Build a specific package"
@echo " make lint-<pkg> Lint a specific package"
@echo " make format-<pkg> Format a specific package"
@echo " make typecheck-<pkg> Typecheck a specific package"
@echo " make test-<pkg> Test a specific package"
@echo ""
@echo "Dependency Commands:"
@echo " make add PKG=<name> Add package to root (e.g. make add PKG=lodash)"
@echo " make add-pkg PKG=<name> TARGET=<pkg> Add to specific workspace"
@echo ""
@echo "Changeset Commands:"
@echo " make changeset Add a changeset"
@echo " make version Apply version bumps"
@echo " make publish Publish packages"
@echo ""
@echo "Packages: $(PACKAGES)"
@echo "Configs: $(CONFIGS)"
@echo "Workspaces: $(WORKSPACES)"
# --- pnpm Workspace Commands ---
install i:
$(PNPM) install
dev:
$(TURBO) dev
test:
$(TURBO) test
update:
$(PNPM) update -r
list ls:
$(PNPM) ls -r --depth -1
add:
ifndef PKG
$(error Usage: make add PKG=<package-name>)
endif
$(PNPM) add $(PKG) -w
add-pkg:
ifndef PKG
$(error Usage: make add-pkg PKG=<pkg> TARGET=<workspace>)
endif
ifndef TARGET
$(error Usage: make add-pkg PKG=<pkg> TARGET=<workspace>)
endif
$(PNPM) add $(PKG) --filter $(call pkg_filter,$(TARGET))
# --- Global Targets ---
build:
$(TURBO) build
lint:
$(TURBO) lint
format:
$(PNPM) format:fix
typecheck:
$(TURBO) typecheck
clean:
$(TURBO) clean
rm -rf dist
clean-all:
$(TURBO) clean:turbo
$(PNPM) exec rimraf node_modules '**/node_modules' dist '**/dist' .turbo
# --- Changeset Commands ---
changeset:
$(PNPM) changelog
version:
$(PNPM) version
publish:
$(PNPM) publish
# --- Dynamic Package Targets ---
build-%:
$(TURBO) build --filter=$(call pkg_filter,$*)
lint-%:
$(TURBO) lint --filter=$(call pkg_filter,$*)
format-%:
$(TURBO) format:fix --filter=$(call pkg_filter,$*)
typecheck-%:
$(TURBO) typecheck --filter=$(call pkg_filter,$*)
test-%:
$(TURBO) test --filter=$(call pkg_filter,$*)