mira
Version:
NearForm Accelerator for Cloud Native Serverless AWS
39 lines (38 loc) • 1.6 kB
TypeScript
export default class FileHelpers {
/**
* Gets the most relevant application directory. This is defined by taking
* the currently executing file folder, and checking or moving up until the
* directory is no longer inside a node_modules folder.
* @param {String} path (Optional) If provided, attempts to lookup from the
* from directory.
* @return {String} The most relevant application directory.
*/
static getApplicationDirectory(path?: string): string;
/**
* Heuristic for guessing main directory. This includes resolving the
* following use cases:
* 1) ./node_modules/.bin scripts
* 2) ./node_modules/PACKAGE_NAME/file scripts
* 3) ./SUBDIR/file calls
*
* The first non-node_modules folder with a package.json in it is used.
*/
static getMainDirectory(): string | boolean;
/**
* Gets the directory of a package.
* @param {String} path The path from which to look for the package directory.
* @returns {String} The directory containing the package.json file.
*/
static getPackageDirectory(path?: string): string | boolean;
/**
* Gets the package.json given a file path. If not found in the filepath
* directory, moves up a directory.
* @param {String} file The file path to search from.
* @return {Boolean|String} False if no file is found.
*/
static getPackageFile(path?: string): string | boolean;
/**
* Normalize a pathname.
*/
static normalize(path: string): string;
}