deno-npm-sync
Version:
A CLI tool to synchronize dependencies between Deno and NPM projects.
48 lines (47 loc) • 2.04 kB
TypeScript
interface PnpmWorkspaceYaml {
catalog?: Record<string, string>;
catalogs?: Record<string, Record<string, string>>;
}
/**
* Detects the package manager used in the project
* @param cwd - Current working directory
* @returns Package manager name or null
*/
export declare function detectPackageManager(cwd: string): Promise<string | null>;
/**
* Reads and parses pnpm-workspace.yaml
* @param workspaceRoot - Root directory of the workspace
* @returns Parsed workspace YAML or null if not found
*/
export declare function readPnpmWorkspaceYaml(workspaceRoot: string): PnpmWorkspaceYaml | null;
/**
* Resolves a pnpm catalog reference to its actual version
* @param packageName - Name of the package
* @param catalogName - Name of the catalog (e.g., 'prod', 'dev') or 'default'
* @param workspaceRoot - Root directory of the workspace
* @returns Resolved version or null if not found
*/
export declare function resolvePnpmCatalog(packageName: string, catalogName: string, workspaceRoot: string): string | null;
/**
* Parses a catalog reference string (e.g., "catalog:prod" or "catalog:")
* @param reference - Catalog reference string
* @returns Object with catalogName or null if not a catalog reference
*/
export declare function parseCatalogReference(reference: string): {
catalogName: string;
} | null;
/**
* Resolves a version string, handling catalog references
* @param version - Version string or catalog reference (e.g., "^3.0.0" or "catalog:prod")
* @param packageName - Name of the package
* @param workspaceRoot - Root directory of the workspace
* @returns Resolved version or null if cannot be resolved
*/
export declare function resolveVersion(version: string, packageName: string, workspaceRoot: string): Promise<string | null>;
/**
* Finds the workspace root by looking for pnpm-workspace.yaml
* @param startPath - Starting directory to search from
* @returns Workspace root path or null if not found
*/
export declare function findWorkspaceRoot(startPath: string): string | null;
export {};