mirror of
https://github.com/EveryInc/compound-engineering-plugin.git
synced 2026-09-19 01:09:55 +08:00
30 lines
844 B
TypeScript
30 lines
844 B
TypeScript
import path from "path"
|
|
|
|
type ReleasePleasePackageConfig = {
|
|
"changelog-path"?: string
|
|
"skip-changelog"?: boolean
|
|
}
|
|
|
|
type ReleasePleaseConfig = {
|
|
packages: Record<string, ReleasePleasePackageConfig>
|
|
}
|
|
|
|
export function validateReleasePleaseConfig(config: ReleasePleaseConfig): string[] {
|
|
const errors: string[] = []
|
|
|
|
for (const [packagePath, packageConfig] of Object.entries(config.packages)) {
|
|
const changelogPath = packageConfig["changelog-path"]
|
|
if (!changelogPath) continue
|
|
|
|
const normalized = path.posix.normalize(changelogPath)
|
|
const segments = normalized.split("/")
|
|
if (segments.includes("..")) {
|
|
errors.push(
|
|
`Package "${packagePath}" uses an unsupported changelog-path "${changelogPath}". release-please does not allow upward-relative paths like "../".`,
|
|
)
|
|
}
|
|
}
|
|
|
|
return errors
|
|
}
|