/** * Configuration for the PackageFolderName policy. * * This policy ensures that package folder names match their package names, * promoting consistency and making packages easier to find in the file system. * * @example * ```typescript * const config: PackageFolderNameConfig = { * // Strip all scopes when matching folder names * stripScopes: ["@*"], * // Or strip specific scopes * stripScopes: ["@myorg", "@internal"], * // These packages are exempt from the check * excludePackages: ["@myorg/special-name"], * }; * ``` * * @alpha */ export interface PackageFolderNameConfig { /** * A list of npm scope patterns to strip when comparing folder names to package names. * * For scoped packages like `@myorg/my-package`, if `@myorg` matches a pattern in this list, * the policy will expect the folder to be named `my-package` (not `@myorg/my-package`). * * @remarks * * Supports glob patterns: * - `@*` - matches all scopes * - `@myorg` - matches exactly `@myorg` * - `@my*` - matches scopes starting with `@my` * * @example * ```typescript * // Strip all scopes - @anything/my-package → folder "my-package" * stripScopes: ["@*"] * * // Strip specific scopes only * stripScopes: ["@myorg", "@internal"] * * // Strip scopes matching a pattern * stripScopes: ["@fluid*"] * ``` */ stripScopes?: string[]; /** * A list of package names that are exempt from folder name matching. * * Use this for packages that intentionally have different folder names, * such as legacy packages or packages with special naming requirements. * * @example * ```typescript * excludePackages: ["@myorg/cli", "legacy-package"] * ``` */ excludePackages?: string[]; } /** * 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 * * 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.json` with name `my-lib` ✓ * - `packages/my-lib/package.json` with name `@myorg/my-lib` ✓ (if @myorg in stripScopes) * - `packages/wrong-name/package.json` with name `my-lib` ✗ * * @example * ```typescript * import { makePolicy } from "repopo"; * import { PackageFolderName } from "repopo/policies"; * * const config: RepopoConfig = { * policies: [ * makePolicy(PackageFolderName, { * stripScopes: ["@myorg", "@internal"], * excludePackages: ["@myorg/special-case"], * }), * ], * }; * ``` * * @alpha */ export declare const PackageFolderName: import("../policy.js").PolicyShape; //# sourceMappingURL=PackageFolderName.d.ts.map