Skip to content

chore: add logging templates script and fix engines for pnpm v10 #12021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/_template/package.json
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@
},
"engines": {
"node": "^18.20.2 || >=20.9.0",
"pnpm": "^9"
"pnpm": "^9 || ^10"
},
"pnpm": {
"onlyBuiltDependencies": [
2 changes: 1 addition & 1 deletion templates/blank/package.json
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@
},
"engines": {
"node": "^18.20.2 || >=20.9.0",
"pnpm": "^9"
"pnpm": "^9 || ^10"
},
"pnpm": {
"onlyBuiltDependencies": [
2 changes: 1 addition & 1 deletion templates/plugin/package.json
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@
},
"engines": {
"node": "^18.20.2 || >=20.9.0",
"pnpm": "^9"
"pnpm": "^9 || ^10"
},
"publishConfig": {
"exports": {
2 changes: 1 addition & 1 deletion templates/website/package.json
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@
},
"engines": {
"node": "^18.20.2 || >=20.9.0",
"pnpm": "^9"
"pnpm": "^9 || ^10"
},
"pnpm": {
"onlyBuiltDependencies": [
2 changes: 1 addition & 1 deletion templates/with-payload-cloud/package.json
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@
},
"engines": {
"node": "^18.20.2 || >=20.9.0",
"pnpm": "^9"
"pnpm": "^9 || ^10"
},
"pnpm": {
"onlyBuiltDependencies": [
2 changes: 1 addition & 1 deletion templates/with-postgres/package.json
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@
},
"engines": {
"node": "^18.20.2 || >=20.9.0",
"pnpm": "^9"
"pnpm": "^9 || ^10"
},
"pnpm": {
"onlyBuiltDependencies": [
10 changes: 9 additions & 1 deletion tools/scripts/src/generate-template-variations.ts
Original file line number Diff line number Diff line change
@@ -435,9 +435,10 @@ function header(message: string) {
function log(message: string) {
console.log(chalk.dim(message))
}

function execSyncSafe(command: string, options?: Parameters<typeof execSync>[1]) {
try {
console.log(`Executing: ${command}`)
log(`Executing: ${command}`)
execSync(command, { stdio: 'inherit', ...options })
} catch (error) {
if (error instanceof Error) {
@@ -492,6 +493,11 @@ async function bumpPackageJson({
)
}

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

log(`Found latest version of ${packageName}: ${latestVersion}`)

return latestVersion
} catch (error) {
console.error('Error fetching Payload version:', error)