From 51cd1c223b2020aee720d3fcfaed93f611977689 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Sat, 28 Nov 2026 21:32:56 +0100 Subject: [PATCH 1/4] maint(Makefile): Restructure and move all user-targeted targets on top. --- Makefile | 92 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 40 deletions(-) diff --git a/Makefile b/Makefile index fa0fdd3..fbd2e2f 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,9 @@ BUILDABLE := $(shell node -p "Boolean(require('./package.json').scripts?.build)" PACKAGE_NAME := $(shell node -p "require('./package.json').name") BUNDLE_NAME := $(subst @patternslib/,,$(subst @plone/,,$(PACKAGE_NAME))) + ## +## User targets +# # Repeat this install target in consuming packages' Makefiles: on a fresh # checkout, @patternslib/dev and this shared Makefile are not installed yet. @@ -47,10 +50,6 @@ update: -git commit package.json -m"maint: Update dependencies." -git commit pnpm-lock.yaml -m"pnpm-lock.yaml: Update." -n -.git/hooks/commit-msg: - echo "npx commitlint --edit" > .git/hooks/commit-msg - chmod u+x .git/hooks/commit-msg - .PHONY: clean-dist clean-dist: @@ -76,16 +75,9 @@ prettier: install check: install eslint $(PNPM) run test - -.PHONY: bundle-pre -bundle-pre:: - @# Override this in your project to add some tasks before the bundle is built. - @# Please use double-colons `::` so that the base bundle-pre is also run. - @# Example: Unlink any linked dependencies. - @# bundle-pre:: - @# -pnpm unlink --recursive - @# pnpm install - npx update-browserslist-db@latest +.PHONY: serve +serve: install + $(PNPM) run start # Compile the bundle. @@ -97,6 +89,49 @@ ifeq ($(BUILDABLE),true) $(PNPM) run build endif +.PHONY: release-major +release-major: + $(MAKE) LEVEL=major release + + +.PHONY: release-minor +release-minor: + $(MAKE) LEVEL=minor release + + +.PHONY: release-patch +release-patch: + $(MAKE) LEVEL=patch release + +.PHONY: prerelease-alpha +prerelease-alpha: + $(MAKE) LEVEL=alpha release + +.PHONY: prerelease-beta +prerelease-beta: + $(MAKE) LEVEL=beta release + + + ## +## Helper targets +# + + +.git/hooks/commit-msg: + echo "npx commitlint --edit" > .git/hooks/commit-msg + chmod u+x .git/hooks/commit-msg + + +.PHONY: bundle-pre +bundle-pre:: + @# Override this in your project to add some tasks before the bundle is built. + @# Please use double-colons `::` so that the base bundle-pre is also run. + @# Example: Unlink any linked dependencies. + @# bundle-pre:: + @# -pnpm unlink --recursive + @# pnpm install + npx update-browserslist-db@latest + # Create a ZIP file from the bundle which is uploaded to the GitHub release tag. # NOTE: When using the normal workflow - e.g. `make release-minor`, the @@ -153,32 +188,9 @@ endif -rm $(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION).zip -.PHONY: release-major -release-major: - $(MAKE) LEVEL=major release - - -.PHONY: release-minor -release-minor: - $(MAKE) LEVEL=minor release - - -.PHONY: release-patch -release-patch: - $(MAKE) LEVEL=patch release - -.PHONY: prerelease-alpha -prerelease-alpha: - $(MAKE) LEVEL=alpha release - -.PHONY: prerelease-beta -prerelease-beta: - $(MAKE) LEVEL=beta release - - -.PHONY: serve -serve: install - $(PNPM) run start + ## +## Upgrades +# upgrade:\ From 151324bca0ff1aa6a480214c6c51bfd49ed89f9d Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Sat, 28 Nov 2026 21:39:18 +0100 Subject: [PATCH 2/4] feat(Makefile): Add new target name aliases. - start (alias for: serve) - build (alias for: bundle) - test (alias for: check) - lint (alias for: eslint) - format (alias for: prettier) --- Makefile | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index fbd2e2f..186f3e6 100644 --- a/Makefile +++ b/Makefile @@ -61,29 +61,38 @@ clean: clean-dist rm -Rf node_modules/ -.PHONY: eslint +.PHONY: lint eslint +lint: eslint eslint: install $(ESLINT) ./src -.PHONY: prettier +.PHONY: format prettier +format: prettier prettier: install $(PRETTIER) --write . -.PHONY: check +# NOTE: Needs a package.json script. Not implemented here. +.PHONY: test check +test: check check: install eslint $(PNPM) run test -.PHONY: serve + +# NOTE: Needs a package.json script. Not implemented here. +.PHONY: start serve +start: serve serve: install $(PNPM) run start # Compile the bundle. +# NOTE: Needs a package.json script. Not implemented here. # NOTE: When using the normal workflow - e.g. `make release-minor`, the # relase-it config runs `make bundle` after the version bump. -.PHONY: bundle +.PHONY: build bundle +build: bundle bundle: clean-dist bundle-pre install ifeq ($(BUILDABLE),true) $(PNPM) run build From 366cf3af46cb15e6fbde1ce3cfca7341505f3d2a Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Sat, 28 Nov 2026 21:47:32 +0100 Subject: [PATCH 3/4] feat(Makefile): Add watch target - needs to be implemented in package.json. --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 186f3e6..e4c79f5 100644 --- a/Makefile +++ b/Makefile @@ -87,6 +87,12 @@ serve: install $(PNPM) run start +# NOTE: Needs a package.json script. Not implemented here. +.PHONY: watch +watch: install + $(PNPM) run watch + + # Compile the bundle. # NOTE: Needs a package.json script. Not implemented here. # NOTE: When using the normal workflow - e.g. `make release-minor`, the From b90dc102adde0e3c35dbe97f781e34c4aae4a0de Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Sat, 28 Nov 2026 22:27:26 +0100 Subject: [PATCH 4/4] fix(Makefile): Fix missing version in release bundle name when not logged in to npm. `release-it --release-version` runs in CI mode, where the npm plugin cannot do the interactive login. When not logged in to npm it failed silently, leaving PACKAGE_VERSION empty. The GitHub release asset was then looked up as `-bundle-.zip` and not uploaded. Skip the npm checks when determining the version - they are still run in the actual release run. Also abort if the version cannot be determined. Assisted-by: Claude Opus 5.5 --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e4c79f5..30f193a 100644 --- a/Makefile +++ b/Makefile @@ -186,7 +186,12 @@ endif release: clean install check prepare-release @# Note: The consuming package must include dist/ in its package.json files list. - $(eval PACKAGE_VERSION := $(shell npx release-it $(RELEASE_IT_LEVEL) --release-version)) + @# Get the version to be released. + @# `--release-version` implies CI mode, where release-it cannot do the + @# interactive npm login and would fail with no output if not logged in. + @# Skip the npm checks here - they are done in the real release run below. + $(eval PACKAGE_VERSION := $(shell npx release-it $(RELEASE_IT_LEVEL) --release-version --npm.skipChecks)) + $(if $(PACKAGE_VERSION),,$(error Could not determine the release version via release-it)) ifeq ($(BUILDABLE),true) $(eval RELEASE_IT_GITHUB_OPTIONS += --github.assets=$(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION).zip) endif