-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
96 lines (73 loc) · 2.22 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
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
SRCS = $(wildcard lib/**/*.ts)
.DEFAULT_GOAL := all
.PHONY: all
all: build dist build/global.scss build/global.css lib/generated/open-props-tokens.ts
node_modules: package.json pnpm-lock.yaml
pnpm install
touch $@
dist/bin/token.js: dist
dist/bin/open-props-tokens.js: lib/generated/open-props-tokens.ts
pnpm exec tsc -b
lib/generated/open-props-tokens.ts:
node dist/bin/open-props-tokens.js > $@
pnpm exec prettier --write $@
# SCSS
build/global.scss: node_modules dist/bin/token.js
node dist/bin/token.js -t scss > $@
pnpm exec prettier --write $@
# CSS
build/global.css: node_modules dist/bin/token.js
node dist/bin/token.js -t css > $@
pnpm exec prettier --write $@
tsconfig.json: node_modules tsconfig-vite.src.json
pnpm exec tsc -p tsconfig-vite.src.json --showConfig 1> $@
build: $(SRCS) node_modules vite.config.ts vite-env.d.ts
NODE_ENV=production pnpm exec vite build
touch $@
.PHONY: build-watch
build-watch: node_modules vite.config.ts vite-env.d.ts
pnpm exec vite build --mode=development --clearScreen false
touch -c build
.PHONY: dev-server
dev-server: node_modules vite.config.ts
pnpm exec vite dev --mode=development --clearScreen false
PHONY: typecheck
typecheck: node_modules tsconfig.json
pnpm exec tsc -w --preserveWatchOutput
.PHONY: dev
dev:
NODE_ENV=development $(MAKE) -j 3 build-watch dev-server typecheck
.PHONY: debug
debug:
DEBUG_BUILD=1 $(MAKE)
dist: $(SRCS) node_modules tsconfig.json
pnpm exec tsc -b
touch $@
.PHONY: clean
clean: node_modules tsconfig.json
pnpm exec tsc -b --clean
pnpm exec tsc -b tsconfig.node.json --clean
rm -rf build dist
.PHONY: clean
distclean: clean
rm -rf node_modules
.PHONY: test
test: node_modules lint dist build
DEBUG_BUILD=true pnpm vitest run
DEBUG_BUILD=true pnpm vitest run
pnpm exec bundlesize
$(MAKE) smoketest
.PHONY: lint
lint: node_modules
pnpm exec eslint .
pnpm exec prettier --check .
.PHONY: pretty
pretty: node_modules
pnpm exec eslint --fix .
pnpm exec prettier --write .
.PHONY: smoketest
smoketest: all
node -e 'import("@block65/react-design-system")'
node -e 'import("@block65/react-design-system/vanilla-extract")'
node -e 'import("@block65/react-design-system/hooks")'
node -e 'import("@block65/react-design-system/open-props")'