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",