PackageFolderName
constPackageFolderName:FilePolicyDefinition<PackageFolderNameConfig|undefined>
Defined in: policies/PackageFolderName.ts:144
A policy that ensures package folder names match package names.
This policy helps maintain a consistent and predictable file structure in monorepos by ensuring that folder names correspond to package names. This makes it easier to locate packages in the file system.
Remarks
Section titled “Remarks”The policy compares the immediate parent folder name of the package.json
against the package name. For scoped packages, the scope can optionally
be stripped based on the stripScopes configuration.
For example:
packages/my-lib/package.jsonwith namemy-lib✓packages/my-lib/package.jsonwith name@myorg/my-lib✓ (if@myorgis instripScopes)packages/wrong-name/package.jsonwith namemy-lib✗
Example
Section titled “Example”import { makePolicy } from "repopo";import { PackageFolderName } from "repopo/policies";
const config: RepopoConfig = { policies: [ makePolicy(PackageFolderName, { config: { stripScopes: ["@myorg", "@internal"], excludePackages: ["@myorg/special-case"], }, }), ],};