/** * Configuration for the PackagePrivateField policy. * * This policy enforces that packages are correctly marked as private or public based on * their scope or name. This is essential for monorepos where some packages should be * published to npm while others should remain internal. * * All pattern matching uses glob patterns via picomatch. * * @example * ```typescript * const config: PackagePrivateFieldConfig = { * // Packages in myorg scope must be published (private: false or absent) * mustPublish: ["@myorg/*"], * // Packages in internal scope must be private * mustBePrivate: ["@internal/*"], * // Packages in experimental scope can choose * mayPublish: ["@experimental/*"], * }; * ``` * * @alpha */ export interface PackagePrivateFieldConfig { /** * A list of glob patterns for packages that must be published. * * Packages matching these patterns must NOT have `private: true` in their package.json. * If they do, the policy will fail and can auto-fix by removing the private field. * * @remarks * * Uses glob patterns via picomatch. Use "@scope/*" to match all packages in a scope, * or use exact package names. * * @example * ```typescript * mustPublish: ["@fluidframework/*", "@fluid-tools/*", "tinylicious"] * ``` */ mustPublish?: string[]; /** * A list of glob patterns for packages that must be private. * * Packages matching these patterns must have `private: true` in their package.json. * If they don't, the policy will fail and can auto-fix by adding `private: true`. * * @remarks * * Uses glob patterns via picomatch (see mustPublish for pattern examples). * * @example * ```typescript * mustBePrivate: ["@fluid-internal/*", "@fluid-private/*"] * ``` */ mustBePrivate?: string[]; /** * A list of glob patterns for packages that may optionally be published. * * Packages matching these patterns can choose whether to be private or public. * The policy will not enforce either state for these packages. * * @remarks * * Uses glob patterns via picomatch (see mustPublish for pattern examples). * Packages not matching any list default to requiring `private: true`. * * @example * ```typescript * mayPublish: ["@fluid-experimental/*"] * ``` */ mayPublish?: string[]; /** * Default behavior for packages that don't match any of the above lists. * * - `"private"` (default): Unmatched packages must have `private: true` * - `"public"`: Unmatched packages must NOT have `private: true` * - `"ignore"`: No enforcement for unmatched packages * * @defaultValue "private" */ unmatchedPackages?: "private" | "public" | "ignore"; } /** * A policy that enforces the `private` field in package.json based on package scope or name. * * This policy is essential for monorepos where publishing control is important: * * - Prevent accidental publishing of internal packages * - Ensure public packages don't have `private: true` blocking publishing * - Allow experimental packages to choose their own publishing status * * @remarks * * The policy evaluates packages in the following order: * * 1. If the package matches `mustPublish`, it must NOT have `private: true` * 2. If the package matches `mustBePrivate`, it MUST have `private: true` * 3. If the package matches `mayPublish`, no enforcement is applied * 4. Otherwise, the `unmatchedPackages` setting determines behavior (defaults to requiring private) * * @example * ```typescript * import { makePolicy } from "repopo"; * import { PackagePrivateField } from "repopo/policies"; * * const config: RepopoConfig = { * policies: [ * makePolicy(PackagePrivateField, { * mustPublish: ["@myorg/*"], * mustBePrivate: ["@internal/*"], * mayPublish: ["@experimental/*"], * unmatchedPackages: "private", * }), * ], * }; * ``` * * @alpha */ export declare const PackagePrivateField: import("../policy.js").PolicyShape; //# sourceMappingURL=PackagePrivateField.d.ts.map