PackageLicense
constPackageLicense:FilePolicyDefinition<PackageLicenseSettings|undefined>
Defined in: policies/PackageLicense.ts:101
A repo policy that ensures each package has a LICENSE file that matches the root LICENSE.
Remarks
Section titled “Remarks”This policy is essential for monorepos where individual packages are published to npm. Each published package should include a LICENSE file, and it should match the root repository’s LICENSE to ensure consistent licensing.
The policy:
- Checks if a LICENSE file exists in the package directory
- Compares it with the root LICENSE file
- Can auto-fix by copying the root LICENSE to the package directory
By default, private packages are skipped since they’re not published.
Example
Section titled “Example”import { makePolicy } from "repopo";import { PackageLicense } from "repopo/policies";
const config: RepopoConfig = { policies: [ // Use defaults (skip private, look for LICENSE) makePolicy(PackageLicense),
// Or require LICENSE for all packages including private // makePolicy(PackageLicense, { config: { skipPrivate: false } }), ],};