/** * Configuration for the PackageAllowedScopes policy. * * This policy ensures packages in a monorepo use only approved scopes or package names. * This prevents accidental introduction of new scopes and ensures naming consistency. * * @example * ```typescript * const config: PackageAllowedScopesConfig = { * // Only packages in these scopes are allowed * allowedScopes: ["@myorg", "@internal", "@experimental"], * // These specific unscoped packages are also allowed * unscopedPackages: ["my-legacy-tool", "special-package"], * }; * ``` * * @alpha */ export interface PackageAllowedScopesConfig { /** * A list of npm scopes that are allowed for packages in this repository. * * Scopes should start with `@` (e.g., `@myorg`). A package like `@myorg/foo` * would match the scope `@myorg`. * * @remarks * * If a package's scope is not in this list and the package is not in * `unscopedPackages`, the policy will fail. * * @example * ```typescript * allowedScopes: ["@myorg", "@myorg-tools", "@myorg-internal"] * ``` */ allowedScopes?: string[]; /** * A list of unscoped package names that are explicitly allowed. * * Use this for legacy packages or special cases where an unscoped name is needed. * * @remarks * * Unscoped packages not in this list will cause the policy to fail. * * @example * ```typescript * unscopedPackages: ["my-legacy-tool", "special-package"] * ``` */ unscopedPackages?: string[]; } /** * A policy that ensures packages use only allowed scopes and package names. * * This policy prevents accidental introduction of new npm scopes or unscoped packages * in a monorepo. It helps maintain naming consistency and prevents typos or mistakes * when creating new packages. * * @remarks * * The policy checks packages in the following order: * * 1. If the package is scoped (starts with `@`), check if its scope is in `allowedScopes` * 2. If the package is unscoped, check if it's in `unscopedPackages` * 3. If neither check passes, the policy fails * * The "root" package (common in monorepos) is automatically skipped. * * @example * ```typescript * import { makePolicy } from "repopo"; * import { PackageAllowedScopes } from "repopo/policies"; * * const config: RepopoConfig = { * policies: [ * makePolicy(PackageAllowedScopes, { * allowedScopes: ["@myorg", "@internal"], * unscopedPackages: ["legacy-package"], * }), * ], * }; * ``` * * @alpha */ export declare const PackageAllowedScopes: import("../policy.js").PolicyShape; //# sourceMappingURL=PackageAllowedScopes.d.ts.map