mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-18 21:47:39 +02:00
Speed up frontend typecheck and lint, and fail test_frontend.sh on any error
tsc -b re-checked every file on every run: the configs named a tsBuildInfoFile but never switched incremental on, and with noEmit there are no outputs for -b to compare against. Enabling incremental in tsconfig.app.json and tsconfig.node.json makes later runs reuse the cache (28 s -> 0.5 s when nothing changed). eslint ran on one thread with no cache. The lint script now uses --concurrency auto and --cache in node_modules/.cache/eslint/ (42 s -> 14 s on a first run, 1.3 s after that). The config isn't type-aware, so the cache is safe. test_frontend.sh runs typecheck and lint in parallel, then the tests, and exits 1 if any step fails. Before, a type or lint error scrolled past and the exit code only reflected the tests.
This commit is contained in:
+25
-3
@@ -1,7 +1,29 @@
|
||||
#!/bin/sh
|
||||
# Typecheck and lint run in parallel (both are read-only and independent),
|
||||
# then the tests. Exits non-zero if any step fails, so a type or lint error
|
||||
# can't scroll past unnoticed behind a green test run.
|
||||
|
||||
cd frontend || exit 1
|
||||
|
||||
npm run typecheck > /tmp/bambuddy-typecheck.$$ 2>&1 &
|
||||
typecheck_pid=$!
|
||||
npm run lint > /tmp/bambuddy-lint.$$ 2>&1 &
|
||||
lint_pid=$!
|
||||
|
||||
wait $typecheck_pid
|
||||
typecheck_rc=$?
|
||||
wait $lint_pid
|
||||
lint_rc=$?
|
||||
|
||||
cat /tmp/bambuddy-typecheck.$$ /tmp/bambuddy-lint.$$
|
||||
rm -f /tmp/bambuddy-typecheck.$$ /tmp/bambuddy-lint.$$
|
||||
|
||||
cd frontend
|
||||
npm run typecheck
|
||||
npm run lint
|
||||
npm run test:run
|
||||
test_rc=$?
|
||||
|
||||
cd ..
|
||||
|
||||
if [ $typecheck_rc -ne 0 ] || [ $lint_rc -ne 0 ] || [ $test_rc -ne 0 ]; then
|
||||
echo "FAILED: typecheck=$typecheck_rc lint=$lint_rc tests=$test_rc"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user