Skip to content

PackageReadme

const PackageReadme: FilePolicyDefinition<PackageReadmeSettings | undefined>

Defined in: policies/PackageReadme.ts:243

A repo policy that ensures each package has a README.md file with proper content.

This policy validates that packages have documentation and can enforce:

  1. README.md file exists
  2. README title matches the package name
  3. README contains required content (e.g., trademark notices)

The policy supports auto-fixing by creating a basic README with the package name as title.

import { makePolicy } from "repopo";
import { PackageReadme } from "repopo/policies";
const config: RepopoConfig = {
policies: [
// Basic README validation
makePolicy(PackageReadme, { instanceId: "readme" }),
// Require trademark notice in all READMEs
makePolicy(PackageReadme, {
instanceId: "readme-trademark",
config: { requiredContent: "## Trademark" },
}),
],
};