0011. A pre-push hook builds and smoke-tests every app
Context
The user asked for a pre-push hook that builds the apps and checks they aren't crashing.
Options
- CI (e.g. GitHub Actions): runs on the server, but only after the push, and needs setup and a remote.
- Husky or lefthook: popular, but adds a dependency and a root
package.jsonfor one hook. - Plain git hook in a versioned
.githooks/folder, enabled withgit config core.hooksPath .githooks: no dependencies, and the logic lives in a script that can also be run by hand.
Decision
Option 3. .githooks/pre-push runs scripts/check-apps.sh. For every app in apps/ it:
- installs dependencies if they're missing;
- lints;
- runs a production build;
- starts the production server and requests key routes, each of which must return the expected status (including a 404 for an unknown page). The server must not crash or log errors.
The website check takes about 8 seconds. git push --no-verify skips it once.
Consequences
- Each clone must run
git config core.hooksPath .githooksonce; this is inAGENTS.mdand the README. - Because the site is built from
docs/, a doc edit that breaks the site's parsers also blocks the push. - When the project gets CI, the same script can run there.