UNPKG

workspace-tools

Version:

A collection of utilities that are useful in a git-controlled monorepo managed by one of these tools:

27 lines (26 loc) 1.12 kB
import type { Catalogs } from "../types/Catalogs"; /** * Returns true if the version starts with `catalog:`. */ export declare function isCatalogVersion(version: string): boolean; /** * Given a dependency package name and a version spec string, if the version starts with `catalog:`, * look up the actual version spec (not the final resolved version) from the given catalogs. * * Throws an error if there's anything invalid about the catalog spec (no catalogs defined, * no matching catalog, catalog doesn't contain `name`, recursive catalog version). * * Returns undefined if the version doesn't start with `catalog:`. * @see https://pnpm.io/catalogs * @see https://yarnpkg.com/features/catalogs * * @param name - Dependency package name * @param version - Dependency version spec, e.g. `catalog:my-catalog` or `catalog:`, * or some non-catalog spec like `^1.2.3` * @returns Actual version spec from the catalog, or undefined if not a catalog version */ export declare function getCatalogVersion(params: { name: string; version: string; catalogs: Catalogs | undefined; }): string | undefined;