chore(templates): remove unneeded lock files, add hook (#9508)

- Update lock files for blank, website
- Delete unneeded lock files
- Adds git hook to ensure no new lockfiles are added for _other than_
blank and website.
This commit is contained in:
Elliot DeNolf
2024-11-25 10:04:41 -05:00
committed by GitHub
parent aa1d300062
commit 8658945d7b
6 changed files with 1281 additions and 22175 deletions

View File

@@ -0,0 +1,24 @@
/**
* In order for Payload Cloud to detect the package manager used in a template, it looks for lock files in the root of the template directory.
*
* Lock files should remain for blank and website templates, but should be removed for all others.
*/
import { existsSync, readdirSync, rmSync } from 'fs'
import { join } from 'path'
const baseDir = join(process.cwd(), 'templates')
// These directories MUST contain a lock file for Payload Cloud to detect the package manager
const excluded = ['website', 'blank']
const directories = readdirSync(baseDir, { withFileTypes: true })
.filter((dir) => dir.isDirectory() && !excluded.includes(dir.name))
.map((dir) => join(baseDir, dir.name, 'pnpm-lock.yaml'))
directories.forEach((file) => {
if (existsSync(file)) {
rmSync(file)
console.log(`Removed: ${file}`)
}
})