Skip to content

Commit b270901

Browse files
authored
chore: add logging templates script and fix engines for pnpm v10 (#12021)
- Fixes issues with using pnpm v10 in some templates by allowing `^10` in engines as well - Added logging to the template generation script so we can debug the latest version being pulled by CI
1 parent c7b14bd commit b270901

File tree

7 files changed

+15
-7
lines changed

7 files changed

+15
-7
lines changed

templates/_template/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"engines": {
4141
"node": "^18.20.2 || >=20.9.0",
42-
"pnpm": "^9"
42+
"pnpm": "^9 || ^10"
4343
},
4444
"pnpm": {
4545
"onlyBuiltDependencies": [

templates/blank/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"engines": {
4141
"node": "^18.20.2 || >=20.9.0",
42-
"pnpm": "^9"
42+
"pnpm": "^9 || ^10"
4343
},
4444
"pnpm": {
4545
"onlyBuiltDependencies": [

templates/plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
},
8282
"engines": {
8383
"node": "^18.20.2 || >=20.9.0",
84-
"pnpm": "^9"
84+
"pnpm": "^9 || ^10"
8585
},
8686
"publishConfig": {
8787
"exports": {

templates/website/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
},
7171
"engines": {
7272
"node": "^18.20.2 || >=20.9.0",
73-
"pnpm": "^9"
73+
"pnpm": "^9 || ^10"
7474
},
7575
"pnpm": {
7676
"onlyBuiltDependencies": [

templates/with-payload-cloud/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"engines": {
4141
"node": "^18.20.2 || >=20.9.0",
42-
"pnpm": "^9"
42+
"pnpm": "^9 || ^10"
4343
},
4444
"pnpm": {
4545
"onlyBuiltDependencies": [

templates/with-postgres/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
},
4141
"engines": {
4242
"node": "^18.20.2 || >=20.9.0",
43-
"pnpm": "^9"
43+
"pnpm": "^9 || ^10"
4444
},
4545
"pnpm": {
4646
"onlyBuiltDependencies": [

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,10 @@ function header(message: string) {
435435
function log(message: string) {
436436
console.log(chalk.dim(message))
437437
}
438+
438439
function execSyncSafe(command: string, options?: Parameters<typeof execSync>[1]) {
439440
try {
440-
console.log(`Executing: ${command}`)
441+
log(`Executing: ${command}`)
441442
execSync(command, { stdio: 'inherit', ...options })
442443
} catch (error) {
443444
if (error instanceof Error) {
@@ -492,6 +493,11 @@ async function bumpPackageJson({
492493
)
493494
}
494495

496+
/**
497+
* Fetches the latest version of a package from the NPM registry.
498+
*
499+
* Used in determining the latest version of Payload to use in the generated templates.
500+
*/
495501
async function getLatestPackageVersion({
496502
packageName = 'payload',
497503
}: {
@@ -509,6 +515,8 @@ async function getLatestPackageVersion({
509515
const data = await response.json()
510516
const latestVersion = data['dist-tags'].latest
511517

518+
log(`Found latest version of ${packageName}: ${latestVersion}`)
519+
512520
return latestVersion
513521
} catch (error) {
514522
console.error('Error fetching Payload version:', error)

0 commit comments

Comments
 (0)