feat: run prettier after npm updates so format bumps stay green

A prettier version bump changes prettier's canonical output, so files
that were correctly formatted under the old version now fail
`prettier --check` in CI — the update PR goes red and never automerges.
This happened on castaway with prettier 3.8.3 -> 3.9.6 (two files
reformatted: a union type collapsed to one line, a Svelte closing tag
pulled onto the attribute line).

Add a npm-scoped postUpgradeTasks that runs `npm run format` once per
branch after the upgrade and commits the result. `--if-present` makes it
a no-op in npm repos without a format script; matchManagers npm keeps it
away from the gradle/maven and firmware repos that share this preset.

Requires the self-hosted Renovate instance to whitelist the command via
allowedCommands (e.g. RENOVATE_ALLOWED_COMMANDS='^npm run format') — that
is a global/self-hosted-only option and cannot be set from this preset.

Signed-off-by: Peter Siegmund <peter.siegmund@entwicklung.eq-3.de>
This commit was merged in pull request #1.
This commit is contained in:
Peter Siegmund
2026-07-25 01:59:24 +02:00
parent e0fa116ae6
commit 200f660205
+9
View File
@@ -18,6 +18,15 @@
"automerge": true
},
"packageRules": [
{
"description": "Nach npm-Updates Prettier laufen lassen: Formatierungs-Bumps (z.B. prettier selbst) formatieren bestehende Dateien um, sonst schlaegt prettier --check in der CI fehl. --if-present no-op't in Repos ohne format-Script. Benoetigt allowedCommands in der self-hosted Renovate-Config.",
"matchManagers": ["npm"],
"postUpgradeTasks": {
"commands": ["npm run format --if-present"],
"fileFilters": ["**/*"],
"executionMode": "branch"
}
},
{
"description": "npm devDependencies (non-major) gesammelt, automerge bei gruener CI",
"matchManagers": ["npm"],