@patternslib/dev 4.5.0 → 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 +57 -0
- package/Makefile +49 -3
- package/README.md +116 -22
- package/docs/adr/0000-README.md +9 -0
- package/docs/adr/0001-run-upgrades-from-make-update.md +45 -0
- package/package.json +1 -2
package/CHANGES.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
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
|
+
|
|
31
|
+
## [4.5.1](https://github.com/Patternslib/dev/compare/4.5.0...4.5.1) (2026-11-30)
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
- **Makefile:** Upgrade targets to remove build:stats and ignore stats files. ([a5f63f8](https://github.com/Patternslib/dev/commit/a5f63f8766b4cebaf82a6b27ce592a73627d22f2))
|
|
36
|
+
|
|
37
|
+
Add upgrade-remove-build-stats, which removes the obsolete build:stats
|
|
38
|
+
script from package.json in favor of make stats.json, and
|
|
39
|
+
upgrade-gitignore-stats, which adds stats.json and stats.html to
|
|
40
|
+
.gitignore. Both commit their change and skip files with uncommitted
|
|
41
|
+
changes, so that unrelated work is never committed.
|
|
42
|
+
|
|
43
|
+
Assisted-by: Claude Opus 5.5
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
- **Makefile:** Fall back to webpack-cli config discovery for bundle analysis. ([fd4918d](https://github.com/Patternslib/dev/commit/fd4918de0dbce20be20aa1f8fc4a7b50ec9793f0))
|
|
48
|
+
|
|
49
|
+
Assisted-by: Claude Opus 5.5
|
|
50
|
+
|
|
51
|
+
### Maintenance
|
|
52
|
+
|
|
53
|
+
- **docs:** Update README with recent changes. ([92ad74b](https://github.com/Patternslib/dev/commit/92ad74ba9ad7192b14342b29a9c8d64c1ad8509e))
|
|
54
|
+
- **Makefile:** Add a guard to stats.json to not analyze dev directly. ([c3a451d](https://github.com/Patternslib/dev/commit/c3a451d20f481113b5266134c70468c9d38a8b61))
|
|
55
|
+
|
|
56
|
+
@patternslib/dev has no build script, so it cannot be analyzed directly.
|
|
57
|
+
Print a informational message if the stats.json targed is called from
|
|
58
|
+
within @patternslib/dev.
|
|
59
|
+
|
|
3
60
|
## [4.5.0](https://github.com/Patternslib/dev/compare/4.4.0...4.5.0) (2026-11-30)
|
|
4
61
|
|
|
5
62
|
### Features
|
package/Makefile
CHANGED
|
@@ -25,7 +25,12 @@ BUILDABLE := $(shell node -p "Boolean(require('./package.json').scripts?.build)"
|
|
|
25
25
|
PACKAGE_NAME := $(shell node -p "require('./package.json').name")
|
|
26
26
|
BUNDLE_NAME := $(subst @patternslib/,,$(subst @plone/,,$(PACKAGE_NAME)))
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
# Webpack config for the bundle analysis targets.
|
|
29
|
+
# Patternslib keeps it in webpack/webpack.config.js, most add-ons in the
|
|
30
|
+
# project root. If webpack/webpack.config.js doesn't exist, this is empty and
|
|
31
|
+
# no --config is passed. webpack-cli then uses its own discovery, which finds
|
|
32
|
+
# webpack.config.{js,mjs,cjs,ts,...} in the root or in .webpack/.
|
|
33
|
+
WEBPACK_CONFIG ?= $(wildcard webpack/webpack.config.js)
|
|
29
34
|
# Resolve webpack-cli relative to @patternslib/dev. webpack is a dependency of
|
|
30
35
|
# @patternslib/dev and pnpm doesn't link binaries of indirect dependencies
|
|
31
36
|
# into the consuming project's node_modules/.bin.
|
|
@@ -61,6 +66,10 @@ update:
|
|
|
61
66
|
$(PNPM) update --latest --interactive
|
|
62
67
|
-git commit package.json -m"maint: Update dependencies."
|
|
63
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
|
|
64
73
|
|
|
65
74
|
.PHONY: clean-dist
|
|
66
75
|
clean-dist:
|
|
@@ -138,8 +147,15 @@ prerelease-beta:
|
|
|
138
147
|
# broken but up-to-date stats.json behind.
|
|
139
148
|
# With --json, webpack reports compilation errors only within the JSON output.
|
|
140
149
|
# On failure, print them before removing the temporary file.
|
|
150
|
+
# Packages without a build script (like @patternslib/dev itself) have no
|
|
151
|
+
# bundle to analyze. Stop early with a clear message instead of failing
|
|
152
|
+
# with a webpack configuration error.
|
|
141
153
|
stats.json: pnpm-lock.yaml
|
|
142
|
-
|
|
154
|
+
ifneq ($(BUILDABLE),true)
|
|
155
|
+
@echo "$(PACKAGE_NAME) has no build script in package.json - nothing to analyze." >&2
|
|
156
|
+
@exit 1
|
|
157
|
+
endif
|
|
158
|
+
NODE_ENV=production $(WEBPACK_CLI) $(if $(WEBPACK_CONFIG),--config $(WEBPACK_CONFIG)) --json > $@.tmp \
|
|
143
159
|
|| { \
|
|
144
160
|
node -e "try { for (const e of JSON.parse(require('fs').readFileSync('$@.tmp')).errors || []) console.error(e.message || e) } catch {}"; \
|
|
145
161
|
rm -f $@.tmp; \
|
|
@@ -266,9 +282,39 @@ endif
|
|
|
266
282
|
upgrade:\
|
|
267
283
|
.git/hooks/commit-msg\
|
|
268
284
|
upgrade-remove-husky\
|
|
269
|
-
upgrade-eslint
|
|
285
|
+
upgrade-eslint\
|
|
286
|
+
upgrade-remove-build-stats\
|
|
287
|
+
upgrade-gitignore-stats
|
|
270
288
|
@# Upgrade target, depends on other upgrades
|
|
271
289
|
|
|
290
|
+
# The following upgrades only touch files without uncommitted changes, so
|
|
291
|
+
# that they never commit unrelated work. They run again on the next upgrade.
|
|
292
|
+
|
|
293
|
+
# The build:stats script is replaced by the stats.json target.
|
|
294
|
+
upgrade-remove-build-stats:
|
|
295
|
+
@if node -e "process.exit(require('./package.json').scripts?.['build:stats'] ? 0 : 1)"; then \
|
|
296
|
+
if git diff --quiet HEAD -- package.json 2>/dev/null; then \
|
|
297
|
+
npm pkg delete "scripts.build:stats" \
|
|
298
|
+
&& git commit package.json -m"maint: @patternslib/dev upgrade - remove build:stats script in favor of make stats.json."; \
|
|
299
|
+
else \
|
|
300
|
+
echo "Skipping removal of the build:stats script: package.json has uncommitted changes." >&2; \
|
|
301
|
+
fi; \
|
|
302
|
+
fi
|
|
303
|
+
|
|
304
|
+
# Ignore the generated bundle analysis files.
|
|
305
|
+
upgrade-gitignore-stats:
|
|
306
|
+
@if [ -f .gitignore ] && ! { grep -qxF stats.json .gitignore && grep -qxF stats.html .gitignore; }; then \
|
|
307
|
+
if git diff --quiet HEAD -- .gitignore 2>/dev/null; then \
|
|
308
|
+
[ -z "$$(tail -c1 .gitignore)" ] || echo >> .gitignore; \
|
|
309
|
+
for f in stats.json stats.html; do \
|
|
310
|
+
grep -qxF $$f .gitignore || echo $$f >> .gitignore; \
|
|
311
|
+
done \
|
|
312
|
+
&& git commit .gitignore -m"maint: @patternslib/dev upgrade - ignore stats.json and stats.html."; \
|
|
313
|
+
else \
|
|
314
|
+
echo "Skipping the stats.json/stats.html .gitignore update: .gitignore has uncommitted changes." >&2; \
|
|
315
|
+
fi; \
|
|
316
|
+
fi
|
|
317
|
+
|
|
272
318
|
upgrade-remove-husky:
|
|
273
319
|
test -d .husky\
|
|
274
320
|
&& rm -R .husky\
|
package/README.md
CHANGED
|
@@ -2,25 +2,128 @@
|
|
|
2
2
|
|
|
3
3
|
This repository includes base files which are extended in Patternslib, Mockup or other projects.
|
|
4
4
|
|
|
5
|
-
It includes a Makefile which helps in installing and releasing packages.
|
|
5
|
+
It includes a Makefile which helps in installing, testing, building and releasing packages.
|
|
6
|
+
The Makefile uses [pnpm](https://pnpm.io/) as package manager.
|
|
7
|
+
|
|
8
|
+
## Using the Makefile in your project
|
|
9
|
+
|
|
10
|
+
Include the shared Makefile from your project's `Makefile` and repeat the `install` target there.
|
|
11
|
+
On a fresh checkout, `@patternslib/dev` and its Makefile are not installed yet, so your project needs its own `install` target to bootstrap:
|
|
12
|
+
|
|
13
|
+
```makefile
|
|
14
|
+
PNPM ?= npx pnpm
|
|
15
|
+
|
|
16
|
+
-include node_modules/@patternslib/dev/Makefile
|
|
17
|
+
|
|
18
|
+
.PHONY: install
|
|
19
|
+
pnpm-lock.yaml install:
|
|
20
|
+
$(PNPM) install
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Then run `make install`.
|
|
24
|
+
|
|
25
|
+
## Makefile targets
|
|
26
|
+
|
|
27
|
+
### User targets
|
|
28
|
+
|
|
29
|
+
| Target | Description |
|
|
30
|
+
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
31
|
+
| `make install` | Install the dependencies with pnpm and set up the commitlint `commit-msg` git hook. |
|
|
32
|
+
| `make update` | Update pnpm and the project dependencies on a new `dependencies-update` branch. See [Updating dependencies](#updating-dependencies). |
|
|
33
|
+
| `make clean-dist` | Remove the `dist/` directory. |
|
|
34
|
+
| `make clean` | Remove `dist/`, `node_modules/` and the bundle analysis files `stats.json` and `stats.html`. |
|
|
35
|
+
| `make lint`, `make eslint` | Lint the `src/` directory with ESLint. |
|
|
36
|
+
| `make format`, `make prettier` | Format all files with Prettier. |
|
|
37
|
+
| `make check`, `make test` | Run ESLint, then the `test` script from `package.json`. |
|
|
38
|
+
| `make serve`, `make start` | Run the `start` script from `package.json`, e.g. a webpack dev server. |
|
|
39
|
+
| `make watch` | Run the `watch` script from `package.json`. |
|
|
40
|
+
| `make bundle`, `make build` | Clean `dist/` and run the `build` script from `package.json`, if there is one. Runs the `bundle-pre` target first. |
|
|
41
|
+
| `make release-major` | Release a new major version. |
|
|
42
|
+
| `make release-minor` | Release a new minor version. |
|
|
43
|
+
| `make release-patch` | Release a new patch version. |
|
|
44
|
+
| `make prerelease-alpha` | Release a new alpha pre-release. |
|
|
45
|
+
| `make prerelease-beta` | Release a new beta pre-release. |
|
|
46
|
+
|
|
47
|
+
The `test`, `start`, `watch` and `build` scripts are not provided by `@patternslib/dev`.
|
|
48
|
+
Define them in your project's `package.json`.
|
|
49
|
+
|
|
50
|
+
#### Releasing
|
|
51
|
+
|
|
52
|
+
The release targets clean and reinstall the project, run `make check` and then use [release-it](https://github.com/release-it/release-it) to bump the version, generate the changelog, tag, publish to npm and create a GitHub release.
|
|
53
|
+
|
|
54
|
+
- To create GitHub releases, add a `GITHUB_TOKEN` to a `.env` file in your project.
|
|
55
|
+
The Makefile reads `.env` automatically.
|
|
56
|
+
See [release-it GitHub releases](https://github.com/release-it/release-it/blob/master/docs/github-releases.md#automated) and [GitHub tokens](https://github.com/settings/tokens).
|
|
57
|
+
- If your project has a `build` script, the bundle is built after the version bump and attached to the GitHub release as `BUNDLENAME-bundle-VERSION.zip`.
|
|
58
|
+
Include `dist/` in the `files` list of your `package.json`, so that the bundle is also published to npm.
|
|
59
|
+
|
|
60
|
+
To run tasks before the bundle is built, extend the `bundle-pre` target in your Makefile.
|
|
61
|
+
Use double colons, so that the base `bundle-pre` target is also run:
|
|
62
|
+
|
|
63
|
+
```makefile
|
|
64
|
+
bundle-pre::
|
|
65
|
+
-pnpm unlink --recursive
|
|
66
|
+
pnpm install
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Bundle analysis targets
|
|
70
|
+
|
|
71
|
+
These targets build the bundle with webpack and analyze the resulting `stats.json`.
|
|
72
|
+
They need a `build` script in your project's `package.json`.
|
|
73
|
+
|
|
74
|
+
| Target | Description |
|
|
75
|
+
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
76
|
+
| `make analyze-bundle-dependencies` | Show why each package was included in the bundle, using [whybundled](https://github.com/d4rkr00t/whybundled). |
|
|
77
|
+
| `make analyze-bundle-treemap` | Show the bundle as treemap, using [webpack-bundle-analyzer](https://github.com/webpack/webpack-bundle-analyzer). |
|
|
78
|
+
| `make analyze-bundle-sunburst` | Render the bundle as sunburst chart into `stats.html` and open it in the browser, using [webpack-visualizer](https://github.com/jonamat/webpack-visualizer). |
|
|
79
|
+
|
|
80
|
+
`stats.json` is rebuilt when `pnpm-lock.yaml` changes.
|
|
81
|
+
To rebuild it after source changes, run `make clean` or delete `stats.json`.
|
|
82
|
+
|
|
83
|
+
### Configuration variables
|
|
84
|
+
|
|
85
|
+
Override these variables in your Makefile or on the command line, e.g. `make analyze-bundle-sunburst OPEN=firefox`.
|
|
86
|
+
|
|
87
|
+
| Variable | Default | Description |
|
|
88
|
+
| ---------------- | ---------------------------------------------- | --------------------------------------------------- |
|
|
89
|
+
| `PNPM` | `npx pnpm` | Command to run pnpm. |
|
|
90
|
+
| `ESLINT` | `npx eslint` | Command to run ESLint. |
|
|
91
|
+
| `PRETTIER` | `npx prettier` | Command to run Prettier. |
|
|
92
|
+
| `WEBPACK_CONFIG` | `webpack/webpack.config.js`, if it exists (\*) | Webpack config used by the bundle analysis targets. |
|
|
93
|
+
| `OPEN` | `xdg-open`, `open` on macOS | Command to open `stats.html` in the browser. |
|
|
94
|
+
|
|
95
|
+
(\*) Otherwise no `--config` is passed and webpack-cli finds the config itself, e.g. `webpack.config.js` in the project root.
|
|
6
96
|
|
|
7
97
|
## Updating dependencies
|
|
8
98
|
|
|
9
99
|
Run `make update` to update the dependencies in this or your dependent project.
|
|
10
100
|
|
|
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
|
+
The dependencies are updated interactively with `pnpm update --latest --interactive`.
|
|
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`.
|
|
105
|
+
|
|
11
106
|
## Upgrading
|
|
12
107
|
|
|
13
|
-
|
|
108
|
+
`make update` runs the upgrade steps automatically.
|
|
109
|
+
If you updated `@patternslib/dev` in another way, run `make upgrade` in your project.
|
|
110
|
+
|
|
111
|
+
Each upgrade step creates its own commit. Current upgrades:
|
|
14
112
|
|
|
15
|
-
|
|
113
|
+
- Remove the `.husky` directory in favor of git hooks.
|
|
114
|
+
- Create `eslint.config.js` and remove the old `.eslintrc.js`.
|
|
115
|
+
- Remove the `build:stats` script from `package.json`, replaced by `make stats.json`.
|
|
116
|
+
- Add `stats.json` and `stats.html` to `.gitignore`.
|
|
16
117
|
|
|
17
|
-
|
|
118
|
+
The last two steps skip files with uncommitted changes and run again on the next upgrade.
|
|
18
119
|
|
|
19
|
-
|
|
20
|
-
If you choose to migrate, update the consuming project's configuration and workflows explicitly.
|
|
21
|
-
The shared Makefile uses pnpm for installation and for running build, test, and start scripts.
|
|
120
|
+
## Migrating a consuming package from Yarn to pnpm
|
|
22
121
|
|
|
23
|
-
|
|
122
|
+
`@patternslib/dev` switched from Yarn to pnpm in version 4.3.0.
|
|
123
|
+
The shared Makefile uses pnpm for installation and for running the build, test and start scripts.
|
|
124
|
+
Projects which still use Yarn should migrate:
|
|
125
|
+
|
|
126
|
+
1. Pin the pnpm version you intend to use in your project's `package.json`:
|
|
24
127
|
|
|
25
128
|
```json
|
|
26
129
|
"packageManager": "pnpm@12.3.4",
|
|
@@ -45,23 +148,14 @@ The shared Makefile uses pnpm for installation and for running build, test, and
|
|
|
45
148
|
|
|
46
149
|
For more information, see the [pnpm configuration reference](https://pnpm.io/settings).
|
|
47
150
|
|
|
48
|
-
3. Change the `yarn` references in
|
|
49
|
-
|
|
50
|
-
```makefile
|
|
51
|
-
PNPM ?= npx pnpm
|
|
52
|
-
|
|
53
|
-
-include node_modules/@patternslib/dev/Makefile
|
|
54
|
-
|
|
55
|
-
.PHONY: install
|
|
56
|
-
pnpm-lock.yaml install:
|
|
57
|
-
$(PNPM) install
|
|
58
|
-
```
|
|
151
|
+
3. Change the `yarn` references in your Makefile to use `pnpm`, as shown in [Using the Makefile in your project](#using-the-makefile-in-your-project).
|
|
59
152
|
|
|
60
|
-
If you use `yarn link` or `yarn unlink` in your Makefile, update it to fit the new [pnpm syntax](https://pnpm.io/cli/link).
|
|
153
|
+
If you use `yarn link` or `yarn unlink` in your Makefile, update it to fit the new [pnpm syntax](https://pnpm.io/cli/link).
|
|
61
154
|
|
|
62
|
-
4. You might need to include pnpm
|
|
155
|
+
4. You might need to include pnpm in the `transformIgnorePatterns` field of your Jest configuration to make the tests pass.
|
|
156
|
+
See this project's `jest.config.js` for an example.
|
|
63
157
|
|
|
64
|
-
5. Update the CI configuration to use
|
|
158
|
+
5. Update the CI configuration to use pnpm and its cache - see this project's `.github/workflows/test.yml`.
|
|
65
159
|
|
|
66
160
|
6. Run `make install`, add `pnpm-lock.yaml` to the git repository and remove `yarn.lock`.
|
|
67
161
|
|
|
@@ -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.
|
|
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": {
|