diff --git a/templates/_template/package.json b/templates/_template/package.json index 8e58189ad83..2a07fd31106 100644 --- a/templates/_template/package.json +++ b/templates/_template/package.json @@ -39,7 +39,7 @@ }, "engines": { "node": "^18.20.2 || >=20.9.0", - "pnpm": "^9" + "pnpm": "^9 || ^10" }, "pnpm": { "onlyBuiltDependencies": [ diff --git a/templates/blank/package.json b/templates/blank/package.json index a83125c92b3..44480007e2c 100644 --- a/templates/blank/package.json +++ b/templates/blank/package.json @@ -39,7 +39,7 @@ }, "engines": { "node": "^18.20.2 || >=20.9.0", - "pnpm": "^9" + "pnpm": "^9 || ^10" }, "pnpm": { "onlyBuiltDependencies": [ diff --git a/templates/plugin/package.json b/templates/plugin/package.json index ea0e9c4ff7e..922dda1691d 100644 --- a/templates/plugin/package.json +++ b/templates/plugin/package.json @@ -81,7 +81,7 @@ }, "engines": { "node": "^18.20.2 || >=20.9.0", - "pnpm": "^9" + "pnpm": "^9 || ^10" }, "publishConfig": { "exports": { diff --git a/templates/website/package.json b/templates/website/package.json index 814b246a3ce..52ba49937d3 100644 --- a/templates/website/package.json +++ b/templates/website/package.json @@ -70,7 +70,7 @@ }, "engines": { "node": "^18.20.2 || >=20.9.0", - "pnpm": "^9" + "pnpm": "^9 || ^10" }, "pnpm": { "onlyBuiltDependencies": [ diff --git a/templates/with-payload-cloud/package.json b/templates/with-payload-cloud/package.json index dbb7c2cb537..e30f38ff618 100644 --- a/templates/with-payload-cloud/package.json +++ b/templates/with-payload-cloud/package.json @@ -39,7 +39,7 @@ }, "engines": { "node": "^18.20.2 || >=20.9.0", - "pnpm": "^9" + "pnpm": "^9 || ^10" }, "pnpm": { "onlyBuiltDependencies": [ diff --git a/templates/with-postgres/package.json b/templates/with-postgres/package.json index 928b94b4ced..561ed29ab78 100644 --- a/templates/with-postgres/package.json +++ b/templates/with-postgres/package.json @@ -40,7 +40,7 @@ }, "engines": { "node": "^18.20.2 || >=20.9.0", - "pnpm": "^9" + "pnpm": "^9 || ^10" }, "pnpm": { "onlyBuiltDependencies": [ diff --git a/tools/scripts/src/generate-template-variations.ts b/tools/scripts/src/generate-template-variations.ts index c7dac07356a..836c17a6b60 100644 --- a/tools/scripts/src/generate-template-variations.ts +++ b/tools/scripts/src/generate-template-variations.ts @@ -435,9 +435,10 @@ function header(message: string) { function log(message: string) { console.log(chalk.dim(message)) } + function execSyncSafe(command: string, options?: Parameters[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)