Field Notes

A tiny Makefile that replaced my shell scripts

· Alex Moreno

Every project of mine used to accumulate a scripts/ directory: build.sh, deploy.sh, reset-db.sh, and a few I no longer remembered writing.

I replaced most of them with a Makefile that is short enough to read in one glance:

.PHONY: dev test lint build clean help

dev:   ; npm run dev
test:  ; npm test
lint:  ; npx eslint .
build: ; npm run build
clean: ; rm -rf dist .cache
help:  ; @grep -E '^[a-z]+:' Makefile | cut -d: -f1

Why it works for me

It is not a build system in the original sense of the word, and that is fine. It is a table of contents for the project.

← All posts