Skip to content

Commit 9de13c2

Browse files
authored
templates: bump plugin template to latest payload version (#16305)
### What? Bump the plugin template's pinned Payload package versions from `3.37.0` to `3.82.1` and add it to `generate-template-variations.ts` so future releases bump it automatically. ### Why? Audit against the current Payload version (`3.82.1`): | Template | Payload version | Status | |---|---|---| | `blank`, `ecommerce`, `website` | `workspace:*` | ✅ auto-bumped | | `with-cloudflare-d1`, `with-postgres`, `with-vercel-*` | `3.82.1` | ✅ bumped via release workflow / manual PRs | | `plugin` | `3.37.0` | ❌ stale (~45 patches behind) | The plugin template is not a standard app-template variation, so `generate-template-variations.ts` skipped it entirely. The post-release workflow therefore never touched it, and the recent manual bump PRs (#16212, #16229) only covered app templates. ### How? 1. `templates/plugin/package.json` — bump `payload` + `@payloadcms/*` devDeps from `3.37.0` → `3.82.1`, bump `@payloadcms/eslint-config` from `3.9.0` → `3.28.0`, bump `peerDependencies.payload` from `^3.37.0` → `^3.82.1`. 2. `tools/scripts/src/generate-template-variations.ts`: - Allow `--template plugin` through the filter (plugin isn't a variation entry). - After the main loop, call a new `bumpPluginTemplate()` helper which resolves the latest `payload` version from npm and reuses `bumpPackageJson`. - Extend `bumpPackageJson` to also bump `peerDependencies` entries, writing `^<version>` so plugin consumers can install compatible patch/minor updates (exact pins would be too strict for a peer dep). Verified locally with `pnpm script:gen-templates --template plugin` — picked up the latest npm version (`3.83.0`), bumped devDeps, wrote `^3.83.0` to peer deps, and preserved `@payloadcms/eslint-config` via the existing `DO_NOT_BUMP` list.
1 parent 500e39d commit 9de13c2

2 files changed

Lines changed: 52 additions & 11 deletions

File tree

templates/plugin/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
},
4747
"devDependencies": {
4848
"@eslint/eslintrc": "^3.2.0",
49-
"@payloadcms/db-mongodb": "3.37.0",
50-
"@payloadcms/db-postgres": "3.37.0",
51-
"@payloadcms/db-sqlite": "3.37.0",
52-
"@payloadcms/eslint-config": "3.9.0",
53-
"@payloadcms/next": "3.37.0",
54-
"@payloadcms/richtext-lexical": "3.37.0",
55-
"@payloadcms/ui": "3.37.0",
49+
"@payloadcms/db-mongodb": "3.82.1",
50+
"@payloadcms/db-postgres": "3.82.1",
51+
"@payloadcms/db-sqlite": "3.82.1",
52+
"@payloadcms/eslint-config": "3.28.0",
53+
"@payloadcms/next": "3.82.1",
54+
"@payloadcms/richtext-lexical": "3.82.1",
55+
"@payloadcms/ui": "3.82.1",
5656
"@playwright/test": "1.58.2",
5757
"@swc-node/register": "1.10.9",
5858
"@swc/cli": "0.6.0",
@@ -67,7 +67,7 @@
6767
"mongodb-memory-server": "10.1.4",
6868
"next": "16.2.3",
6969
"open": "^10.1.0",
70-
"payload": "3.37.0",
70+
"payload": "3.82.1",
7171
"prettier": "^3.4.2",
7272
"qs-esm": "8.0.1",
7373
"react": "19.2.4",
@@ -80,7 +80,7 @@
8080
"vitest": "4.0.18"
8181
},
8282
"peerDependencies": {
83-
"payload": "^3.37.0"
83+
"payload": "^3.82.1"
8484
},
8585
"engines": {
8686
"node": "^18.20.2 || >=20.9.0",

tools/scripts/src/generate-template-variations.ts

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,17 @@ async function main() {
211211
},
212212
]
213213

214-
// If template is set, only generate that template
215-
if (template) {
214+
// If template is set, only generate that template. The plugin template is not a
215+
// standard variation (see `bumpPluginTemplate` below), so allow it through without
216+
// matching a variation entry.
217+
if (template && template !== 'plugin') {
216218
const variation = variations.find((v) => v.dirname === template)
217219
if (!variation) {
218220
throw new Error(`Variation not found: ${template}`)
219221
}
220222
variations = [variation]
223+
} else if (template === 'plugin') {
224+
variations = []
221225
}
222226

223227
for (const variation of variations) {
@@ -373,6 +377,11 @@ async function main() {
373377

374378
log(`Done configuring payload config for ${destDir}/src/payload.config.ts`)
375379
}
380+
381+
if (!template || template === 'plugin') {
382+
await bumpPluginTemplate()
383+
}
384+
376385
log('Running prettier on generated files...')
377386
execSyncSafe(`pnpm prettier --write templates "*.{js,jsx,ts,tsx}"`, { cwd: PROJECT_ROOT })
378387

@@ -542,13 +551,45 @@ async function bumpPackageJson({
542551
}
543552
}
544553

554+
// Peer deps use a caret range so consumers can install patch/minor updates.
555+
const peerDependencies = packageJson.peerDependencies
556+
if (peerDependencies) {
557+
for (const packageName of Object.keys(peerDependencies)) {
558+
if (
559+
(packageName === 'payload' || packageName.startsWith('@payloadcms')) &&
560+
!DO_NOT_BUMP.includes(packageName)
561+
) {
562+
peerDependencies[packageName] = `^${latestVersion}`
563+
}
564+
}
565+
}
566+
545567
// write it out
546568
await fs.writeFile(
547569
path.resolve(templateDir, 'package.json'),
548570
JSON.stringify(packageJson, null, 2),
549571
)
550572
}
551573

574+
/**
575+
* The plugin template is not a standard app-template variation (no payload.config.ts,
576+
* no migrations, no importmap) but its pinned Payload versions still need to be bumped
577+
* on each release. Unlike `blank`/`website`/`ecommerce`, it is not part of the pnpm
578+
* workspace, so its versions drift unless we bump them explicitly.
579+
*/
580+
async function bumpPluginTemplate() {
581+
header('Bumping plugin template...')
582+
const pluginDir = path.join(TEMPLATES_DIR, 'plugin')
583+
const payloadVersion = await getLatestPackageVersion({ packageName: 'payload' })
584+
if (!payloadVersion) {
585+
throw new Error('Could not resolve latest payload version')
586+
}
587+
await bumpPackageJson({
588+
templateDir: pluginDir,
589+
latestVersion: payloadVersion,
590+
})
591+
}
592+
552593
/**
553594
* Fetches the latest version of a package from the NPM registry.
554595
*

0 commit comments

Comments
 (0)