-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
176 lines (137 loc) · 5.41 KB
/
Makefile
File metadata and controls
176 lines (137 loc) · 5.41 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
.PHONY: build build-ts check test test-integrations test-types test-namespace-js types generated-check public-namespace-api update-public-namespace-api docs-examples-check coverage coverage-check coverage-update-baseline coverage-open setup ensure-deps ensure-docs-deps lint lint-check lint-fix underscore-property-key-check wasm-parity hugo
BUILD_DIR = ./dist
TS_BUILD_DIR = ./.build
MIN_JS := dist/angular-ts.umd.min.js
GZ_JS := $(MIN_JS).gz
CLOSURE_EXTERNS := integrations/closure/externs/angular.js
DIST_CLOSURE_EXTERNS := $(BUILD_DIR)/externs/angular.js
setup:
@rm -rf ./node_modules/
@npm ci
@npx playwright install
ensure-deps:
@if [ ! -d ./node_modules ]; then \
echo "Installing dependencies..."; \
npm ci; \
fi
ensure-docs-deps:
@if [ ! -d ./docs/node_modules ]; then \
echo "Installing docs dependencies..."; \
cd docs && npm ci; \
fi
build: ensure-deps
@node integrations/closure/scripts/validate-externs.mjs
@if [ -d "$(BUILD_DIR)" ]; then \
echo "Removing $(BUILD_DIR)..."; \
rm -r "$(BUILD_DIR)"; \
fi
@./node_modules/.bin/tsc --project tsconfig.build.json
@./node_modules/.bin/rollup -c
@mkdir -p "$(BUILD_DIR)/externs"
@cp "$(CLOSURE_EXTERNS)" "$(DIST_CLOSURE_EXTERNS)"
@node -e 'const fs=require("fs"); const pkg=JSON.parse(fs.readFileSync("package.json","utf8")); const file="$(DIST_CLOSURE_EXTERNS)"; fs.writeFileSync(file, fs.readFileSync(file,"utf8").replaceAll("[VI]{version}[/VI]", pkg.version));'
build-ts: ensure-deps
@./node_modules/.bin/tsc --project tsconfig.build.json
size:
@$(MAKE) build >/dev/null
@echo "Minified build output: $$(stat -c %s dist/angular-ts.umd.min.js) ~ $$(stat -c %s dist/angular-ts.umd.min.js | numfmt --to=iec)"
@echo "Expected gzip: $$(gzip -c dist/angular-ts.umd.min.js | wc -c) ~ $$(gzip -c dist/angular-ts.umd.min.js | wc -c | numfmt --to=iec)"
@git checkout -q $(BUILD_DIR)
@git checkout -q ./docs
@echo "Current build output: $$(stat -c %s dist/angular-ts.umd.min.js) ~ $$(stat -c %s dist/angular-ts.umd.min.js | numfmt --to=iec)"
@echo "Current gzip: $$(gzip -c dist/angular-ts.umd.min.js | wc -c) ~ $$(gzip -c dist/angular-ts.umd.min.js | wc -c | numfmt --to=iec)"
$(GZ_JS): $(MIN_JS)
@gzip -9 -c $< > $@
gzip: $(GZ_JS)
@echo "Created gzipped file: $(GZ_JS)"
size-html:
@printf 'Bundle size: <b>%s</b> Gzip size: <b>%s</b>' \
"$(shell stat -c %s dist/angular-ts.umd.min.js | numfmt --to=iec)" \
"$(shell gzip -c dist/angular-ts.umd.min.js | wc -c | numfmt --to=iec)" \
> docs/layouts/shortcodes/size-report.html
version:
@node utils/version.cjs
format:
@npx prettier ./src --write --cache --log-level=silent
lint:
@$(MAKE) lint-check
lint-check: ensure-deps
@npx eslint ./src --max-warnings=0
lint-fix: ensure-deps
@npx eslint ./src --fix
underscore-property-key-check:
@node ./utils/check-underscore-property-keys.mjs
check: ensure-deps
@$(MAKE) lint-check
@$(MAKE) underscore-property-key-check
@$(MAKE) generated-check
@echo "Typechecking source"
./node_modules/.bin/tsc
@$(MAKE) test-types
@$(MAKE) test-namespace-js
@$(MAKE) wasm-parity
@$(MAKE) docs-examples-check
test-types: ensure-deps
@echo "Typechecking tests"
./node_modules/.bin/tsc --project tsconfig.test.json
test-namespace-js: types
@echo "Typechecking JavaScript namespace consumer"
./node_modules/.bin/tsc --project tsconfig.namespace-js.json
docs-examples-check: ensure-deps
@echo "Checking docs example API references"
@node ./utils/check-docs-examples.mjs
include utils/benchmarks/benchmarks.mk
types: ensure-deps
@echo "Generating *.d.ts"
@rm -rf @types
@./node_modules/.bin/tsc --project tsconfig.types.json
@npx prettier ./@types --write --cache --log-level=silent
generated-check: types
@$(MAKE) -f integrations/closure/Makefile generate-check
@$(MAKE) -C integrations/dart generate-check
@$(MAKE) -C integrations/gleam generate-check
@$(MAKE) -C integrations/kotlin generate-check
@$(MAKE) -C integrations/wasm/go generate-check
public-namespace-api: types
@$(MAKE) -f integrations/closure/Makefile closure-generate
update-public-namespace-api: public-namespace-api
TYPEDOC_DIR = docs/static/typedoc
doc: ensure-deps
@rm -rf $(TYPEDOC_DIR)
@node_modules/.bin/typedoc
@npx prettier ./typedoc --write
@mv typedoc $(TYPEDOC_DIR)
serve: ensure-deps
@node_modules/.bin/vite --config utils/vite.config.js & \
(cd utils/server && go run .) & \
wait
prepare-release: build test check types doc format gzip version size-html
PLAYWRIGHT_TEST := npx playwright test
test: ensure-deps
@echo $(INFO) "Playwright test JS"
@$(PLAYWRIGHT_TEST)
@$(MAKE) test-integrations
test-integrations: ensure-deps
@echo $(INFO) "Playwright integration tests"
@$(MAKE) -f integrations/closure/Makefile closure-test
@$(MAKE) -C integrations/kotlin check
@$(MAKE) wasm-parity
wasm-parity: ensure-deps
@$(MAKE) -C integrations/wasm/rust parity
test-ui: ensure-deps
@echo $(INFO) "Playwright test JS with ui"
@$(PLAYWRIGHT_TEST) --ui
coverage: ensure-deps
@echo $(INFO) "Playwright coverage"
@node ./utils/run-coverage.mjs --check
coverage-check:
@echo $(INFO) "Playwright coverage threshold check"
@$(MAKE) coverage
coverage-update-baseline: ensure-deps
@echo $(INFO) "Playwright coverage baseline update"
@node ./utils/run-coverage.mjs --update-baseline
coverage-open: ensure-deps
@echo $(INFO) "Open coverage report"
@node ./utils/open-coverage.mjs
hugo: ensure-docs-deps
cd docs && npm run _hugo-dev -- serve --disableFastRender --ignoreCache --noHTTPCache