@patternslib/dev 4.5.1 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGES.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.6.0](https://github.com/Patternslib/dev/compare/4.5.1...4.6.0) (2026-11-30)
4
+
5
+ ### Features
6
+
7
+ - **Makefile:** Run make upgrade from make update and drop the postinstall script. ([90211cc](https://github.com/Patternslib/dev/commit/90211ccf5ebe1a4c51566572dac0b62ffd6b07aa))
8
+
9
+ The postinstall script did not run reliably: pnpm's side-effects cache
10
+ skips it when a dev version is already built in the store, and pnpm
11
+ update overwrote package.json changes from the upgrade steps afterwards.
12
+ It would also create commits in CI.
13
+
14
+ make update now runs make upgrade in a sub-make as its last step, which
15
+ reads the newly installed Makefile.
16
+
17
+ Ref: ADR 0001
18
+
19
+ Assisted-by: Claude Opus 5.5
20
+
21
+ ### Maintenance
22
+
23
+ - **docs:** Add ADR 0001 about running upgrades from make update. ([7931180](https://github.com/Patternslib/dev/commit/7931180ac80e4195647b9aa0e82f776ba7943520))
24
+
25
+ Ref: ADR 0001
26
+
27
+ Assisted-by: Claude Opus 5.5
28
+
29
+ - **docs:** Start with ADR records. ([c7add1e](https://github.com/Patternslib/dev/commit/c7add1e6e6923ed436b6d2853e5b00b4a49996b4))
30
+
3
31
  ## [4.5.1](https://github.com/Patternslib/dev/compare/4.5.0...4.5.1) (2026-11-30)
4
32
 
5
33
  ### Features
package/Makefile CHANGED
@@ -66,6 +66,10 @@ update:
66
66
  $(PNPM) update --latest --interactive
67
67
  -git commit package.json -m"maint: Update dependencies."
68
68
  -git commit pnpm-lock.yaml -m"pnpm-lock.yaml: Update." -n
69
+ @# Run the upgrades of a possibly updated @patternslib/dev.
70
+ @# A sub-make reads its newly installed Makefile, while this make still
71
+ @# uses the old one.
72
+ $(MAKE) upgrade
69
73
 
70
74
  .PHONY: clean-dist
71
75
  clean-dist:
package/README.md CHANGED
@@ -101,12 +101,12 @@ Run `make update` to update the dependencies in this or your dependent project.
101
101
  It creates a `dependencies-update` branch and makes up to three separate commits: one for the pnpm update, one for the updated dependencies in `package.json`, and one for `pnpm-lock.yaml`.
102
102
  The dependencies are updated interactively with `pnpm update --latest --interactive`.
103
103
  `package.json` must not have uncommitted changes.
104
+ Finally, `make update` runs `make upgrade` to apply the upgrade steps of a possibly updated `@patternslib/dev`.
104
105
 
105
106
  ## Upgrading
106
107
 
107
- Run `make upgrade` in your project.
108
-
109
- Alternatively, if there is a new `@patternslib/dev` version installed, the `postinstall` package.json script will automatically run `make upgrade` in the directory where package installer was invoked, that is your project directory which depends on `@patternslib/dev`.
108
+ `make update` runs the upgrade steps automatically.
109
+ If you updated `@patternslib/dev` in another way, run `make upgrade` in your project.
110
110
 
111
111
  Each upgrade step creates its own commit. Current upgrades:
112
112
 
@@ -0,0 +1,9 @@
1
+ # Architecture Decision Records
2
+
3
+ This directory contains Architecture Decision Records.
4
+
5
+ ## References
6
+
7
+ - https://www.heise.de/hintergrund/Gut-dokumentiert-Architecture-Decision-Records-4664988.html
8
+ - https://martinfowler.com/bliki/ArchitectureDecisionRecord.html
9
+ - https://adr.github.io/
@@ -0,0 +1,45 @@
1
+ # Run upgrades from `make update` instead of a postinstall script
2
+
3
+ Status: Accepted (2026-11-30)
4
+
5
+ ## Context
6
+
7
+ `@patternslib/dev` provides `make upgrade`, which brings a consuming project up to date with the current dev package.
8
+ Examples are creating `eslint.config.js`, removing the `build:stats` script from `package.json` and adding `stats.json` and `stats.html` to `.gitignore`.
9
+ Each upgrade step commits its change.
10
+
11
+ Until now, a `postinstall` script in `@patternslib/dev`'s `package.json` ran `cd $INIT_CWD && make upgrade || true` whenever the package was installed.
12
+ After the 4.5.1 release, the upgrades ran in only one of several add-ons updated with `make update`.
13
+ We found two causes:
14
+
15
+ 1. **pnpm's side-effects cache.**
16
+ pnpm caches the result of a dependency's build scripts in the store.
17
+ When another project installs the same package version, pnpm restores the cached result and does not run the scripts again.
18
+ The `postinstall` changes nothing inside the package, so restoring the cache counts as done.
19
+ As a result, `make upgrade` ran only once per machine and dev version, in whichever project installed it first.
20
+ The pnpm store had such a cache entry for every dev version installed.
21
+
22
+ 2. **`pnpm update` writes `package.json` after running install scripts.**
23
+ In the one add-on where the upgrade did run, `upgrade-remove-build-stats` removed the `build:stats` script and committed.
24
+ `pnpm update --latest` then wrote its in-memory copy of `package.json`, which still had the script, so the following "Update dependencies" commit added it back.
25
+
26
+ Also, a `postinstall` that commits also runs in CI or any other place where dependencies are installed, and we don't want automatic commits there.
27
+
28
+ ## Decision
29
+
30
+ Drop the `postinstall` script.
31
+ The `update` target of the shared Makefile runs `$(MAKE) upgrade` as its last step, after the pnpm, `package.json` and `pnpm-lock.yaml` commits.
32
+
33
+ The upgrade runs in a sub-make so that it reads the newly installed `node_modules/@patternslib/dev/Makefile`.
34
+ The make running `update` has already parsed the old one.
35
+
36
+ Developers who update `@patternslib/dev` in another way run `make upgrade` by hand.
37
+
38
+ ## Consequences
39
+
40
+ - Upgrades run every time `make update` runs, regardless of the pnpm store cache.
41
+ - Upgrades run after pnpm has finished writing `package.json`, so their changes are not overwritten.
42
+ - Installing dependencies, including in CI, never creates commits.
43
+ - A plain `pnpm install` or `pnpm update` no longer upgrades the project. Developers need to use `make update` or run `make upgrade`.
44
+ - Upgrade steps must stay idempotent, because `make update` runs all of them every time.
45
+ - Consuming projects still allow builds for `@patternslib/dev` in `pnpm-workspace.yaml` (`allowBuilds`). That entry is no longer needed, but it does no harm.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternslib/dev",
3
- "version": "4.5.1",
3
+ "version": "4.6.0",
4
4
  "description": "Development base files for working with Patternslib and add-ons.",
5
5
  "license": "MIT",
6
6
  "packageManager": "pnpm@12.23.0",
@@ -36,7 +36,6 @@
36
36
  "node": "^22.18.0 || >=24.11.0"
37
37
  },
38
38
  "scripts": {
39
- "postinstall": "cd $INIT_CWD && make upgrade || true",
40
39
  "test": "jest"
41
40
  },
42
41
  "author": {