@stryke/fs
Version:
A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.
47 lines (46 loc) • 1.64 kB
TypeScript
import type { PackageResolvingOptions } from "@stryke/path/resolve";
import type { PackageJson } from "@stryke/types/package-json";
import type { PackageManager } from "@stryke/types/package-manager";
/**
* Get the package manager used in the project
* @param dir - The path to the project
* @returns The package manager used in the project
*/
export declare function getPackageManager(dir?: any): PackageManager;
/**
* Get package info
*
* @param name - The name of the package
* @param options - The options to use when resolving the package
* @returns The package info
*/
export declare function getPackageInfo(name: string, options?: PackageResolvingOptions): Promise<{
name: string;
version: any;
rootPath: any;
packageJsonPath: any;
packageJson: PackageJson;
} | undefined>;
/**
* Get the package info from the package.json file
*
* @param cwd - The current working directory
* @returns The package info
*/
export declare function loadPackageJson(cwd?: any): Promise<PackageJson | null>;
/**
* Check if a package is listed in the package.json file
*
* @param name - The name of the package
* @param cwd - The current working directory
* @returns An indicator specifying if the package is listed
*/
export declare function isPackageListed(name: string, cwd?: string): Promise<boolean>;
/**
* Check if a package exists
*
* @param name - The name of the package
* @param options - The options to use when resolving the package
* @returns An indicator specifying if the package exists
*/
export declare function isPackageExists(name: string, options?: PackageResolvingOptions): boolean;