From e3680b338d95903f1835ece3ebe445c4e604f1f2 Mon Sep 17 00:00:00 2001 From: Tobias Leinss <7684178+leinss@users.noreply.github.com> Date: Tue, 18 Aug 2026 11:45:09 +0200 Subject: [PATCH] chore: one lint entry point, and a Makefile matching the sibling repos `pnpm lint` meant eslint only, while the spacing and link checks hid under `check:*` here and `lint:*` in astro-sassify: the same scripts under two prefixes, and no single command that runs them all. - `lint` now runs every static check; the eslint call moves to `lint:eslint` - `check:spacing` and `check:links` become `lint:spacing` and `lint:links` - CI drops its separate spacing step, so a check added to `lint` runs there without editing the workflow - `lint` excludes the link check on purpose: that one reads dist/ and exits 1 without it, so it belongs to the build, which already runs it - Add a Makefile with the same targets and help output as the sibling repos --- .github/workflows/deploy.yaml | 6 +++--- Makefile | 29 +++++++++++++++++++++++++++++ package.json | 7 ++++--- 3 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 0e2413071..0324f2500 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -37,12 +37,12 @@ jobs: - name: Install Dependencies run: pnpm install --frozen-lockfile + # One step, so a check added to `lint` runs in CI without editing this + # file. The link check is not part of `lint`: it reads dist/ and so + # belongs to the build, which runs it. - name: Lint run: pnpm run lint - - name: Check inline spacing - run: pnpm run check:spacing - - name: Build Astro run: pnpm run build diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..f8df9e79a --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +.DEFAULT_GOAL := help +.PHONY: help install dev build preview lint clean + +# Scripts are always invoked as `pnpm run `: several plausible script +# names (install, add, ...) collide with built-in pnpm commands, which take +# precedence and would run something else entirely. `pnpm lint` used to fall +# through to an unrelated `lint` binary on PATH for the same reason. + +help: ## Show this help + @grep -hE '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) \ + | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-9s\033[0m %s\n", $$1, $$2}' + +install: ## Install dependencies exactly as the lockfile pins them + pnpm install --frozen-lockfile + +dev: ## Dev server at localhost:4321 + pnpm run dev + +build: ## Production build to dist/, including the internal link check + pnpm run build + +preview: ## Build, then serve the production output + pnpm run preview + +lint: ## Every static check that does not need a build first + pnpm run lint + +clean: ## Remove build output + rm -rf dist .astro diff --git a/package.json b/package.json index 46da04e67..e2f091bec 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,11 @@ "preview": "astro preview", "preview:network": "astro preview --host", "astro": "astro", - "lint": "eslint .", + "lint": "pnpm run lint:eslint && pnpm run lint:spacing", + "lint:eslint": "eslint .", "lint:fix": "eslint . --fix", - "check:spacing": "node scripts/check-inline-spacing.mjs", - "check:links": "node scripts/check-internal-links.mjs" + "lint:spacing": "node scripts/check-inline-spacing.mjs", + "lint:links": "node scripts/check-internal-links.mjs" }, "dependencies": { "@astrojs/check": "^0.9.10",