From d4c63b71909c07dc1915f755c5f54da0dd3e5737 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Wed, 12 Feb 2025 14:41:10 +0100 Subject: [PATCH 1/3] maint: Makefile: Define targets as phony, if they are. --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 4f55134..cfbca11 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ stamp-yarn install: touch stamp-yarn +.PHONY: clean clean-dist: rm -Rf dist/ @@ -46,6 +47,7 @@ check: stamp-yarn eslint $(YARN) run test +.PHONY: bundle-pre bundle-pre: @# Override this in your project to add some tasks before the bundle is built. @# Example: Unlink any linked dependencies. @@ -66,6 +68,7 @@ endif # Create a ZIP file from the bundle which is uploaded to the GitHub release tag. +.PHONY: release-zip release-zip: ifneq "$(PACKAGE_NAME)" "$(PACKAGE_DEV)" @# Do not create a zip release for @patternslib/dev @@ -79,6 +82,7 @@ endif # Prepare some necessary variables. +.PHONY: prepare-release prepare-release: ifeq ($(LEVEL),$(filter $(LEVEL), alpha beta)) @# case alpha or beta pre-release @@ -104,11 +108,13 @@ endif # Do the npm release. +.PHONY: release-npm release-npm: prepare-release npx release-it $(RELEASE_IT_LEVEL) # Do the GitHub release. +.PHONY: release-github release-github: prepare-release release-zip @# NOTE: PACKAGE_VERSION is defined in release-zip @@ -130,6 +136,7 @@ release-github: prepare-release release-zip -rm $(BUNDLE_NAME)-bundle-$(PACKAGE_VERSION).zip +.PHONY: release release: clean install check release-npm release-github @# Note: If you want to include the compiled bundle in your npm package you @# have to allow it in a .npmignore file. From 9de2d28d15601ec8c81527753ba480eac7bc720d Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Wed, 12 Feb 2025 14:51:40 +0100 Subject: [PATCH 2/3] maint: Makefile: Let the install target depend on yarn.lock file to allow reinstalls when yarn.lock changes. --- .gitignore | 1 - Makefile | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index fba2380..6452e51 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ .env dist/ node_modules/ -stamp-yarn stats.json yarn-error.log pat-* diff --git a/Makefile b/Makefile index cfbca11..3e3fd18 100644 --- a/Makefile +++ b/Makefile @@ -18,12 +18,11 @@ PACKAGE_DEV=@patternslib/dev PACKAGE_NAME := $(shell node -p "require('./package.json').name") BUNDLE_NAME := $(subst @patternslib/,,$(subst @plone/,,$(PACKAGE_NAME))) -.PHONY: install -stamp-yarn install: + +yarn.lock install: $(YARN) install # Install pre commit hook $(YARN) husky install - touch stamp-yarn .PHONY: clean @@ -33,17 +32,16 @@ clean-dist: .PHONY: clean clean: clean-dist - rm -f stamp-yarn rm -Rf node_modules/ .PHONY: eslint -eslint: stamp-yarn +eslint: install $(ESLINT) ./src .PHONY: check -check: stamp-yarn eslint +check: install eslint $(YARN) run test @@ -60,7 +58,7 @@ bundle-pre: # NOTE: When using the normal workflow - e.g. `make release-minor`, the # relase-it config runs `make bundle` after the version bump. .PHONY: bundle -bundle: clean-dist bundle-pre stamp-yarn +bundle: clean-dist bundle-pre install ifneq "$(PACKAGE_NAME)" "$(PACKAGE_DEV)" @# Do not build a bundle for @patternslib/dev $(YARN) run build @@ -166,7 +164,7 @@ prerelease-beta: .PHONY: serve -serve: stamp-yarn +serve: install $(YARN) run start From ae05dd37bc3df6261db4a5eecbaed3d789812300 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Wed, 12 Feb 2025 14:52:44 +0100 Subject: [PATCH 3/3] maint: Directly use git's commit hooks and remove dependency on husky. --- Makefile | 9 ++++++--- package.json | 1 - yarn.lock | 5 ----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 3e3fd18..db790a5 100644 --- a/Makefile +++ b/Makefile @@ -19,10 +19,13 @@ PACKAGE_NAME := $(shell node -p "require('./package.json').name") BUNDLE_NAME := $(subst @patternslib/,,$(subst @plone/,,$(PACKAGE_NAME))) -yarn.lock install: +yarn.lock install: .git/hooks/commit-msg $(YARN) install - # Install pre commit hook - $(YARN) husky install + + +.git/hooks/commit-msg: + echo "npx commitlint --edit" > .git/hooks/commit-msg + chmod u+x .git/hooks/commit-msg .PHONY: clean diff --git a/package.json b/package.json index c690638..2b0467c 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ "css-loader": "^7.1.2", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", - "husky": "^8.0.3", "identity-obj-proxy": "^3.0.0", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", diff --git a/yarn.lock b/yarn.lock index e955244..8f50dad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4497,11 +4497,6 @@ human-signals@^5.0.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-5.0.0.tgz#42665a284f9ae0dade3ba41ebc37eb4b852f3a28" integrity sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ== -husky@^8.0.3: - version "8.0.3" - resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184" - integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg== - hyperdyperid@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/hyperdyperid/-/hyperdyperid-1.2.0.tgz#59668d323ada92228d2a869d3e474d5a33b69e6b"