@builder.io/dev-tools
Version:
Builder.io Visual CMS Devtools
33 lines (32 loc) • 1.05 kB
TypeScript
/**
* Safely read a JSON file
*/
export declare function safeReadJSON(filePath: string): any | null;
/**
* Safely read a text file
*/
export declare function safeReadFile(filePath: string): string | null;
/**
* Package manager information
*/
export interface PackageManagerInfo {
manager: "npm" | "yarn" | "pnpm" | "bun";
setupCommand: string;
}
/**
* Detect the package manager at the root level based on lock files
* Returns the specific package manager command for setup
*/
export declare function detectRootPackageManager(files: string[]): PackageManagerInfo | null;
/**
* Check if a file exists at the root level
*/
export declare function hasRootFile(files: string[], fileName: string): boolean;
/**
* Check if any file matches a pattern at the root level
*/
export declare function hasRootFileMatching(files: string[], predicate: (fileName: string) => boolean): boolean;
/**
* Check if a directory exists at the root level
*/
export declare function hasRootDirectory(files: string[], directoryName: string): boolean;