@microsoft/api-extractor
Version:
Validatation, documentation, and auditing for the exported API of a TypeScript package
23 lines (22 loc) • 909 B
TypeScript
/**
* Utilities for navigating packages.
*/
export default class PackageJsonHelpers {
/**
* Finds the path to the package folder of a given currentPath, by probing
* upwards from the currentPath until a package.json file is found.
* If no package.json can be found, undefined is returned.
*
* @param currentPath - a path (relative or absolute) of the current location
* @returns a relative path to the package folder
*/
static tryFindPackagePathUpwards(currentPath: string): string;
/**
* Loads the package.json file and returns the name of the package.
*
* @param packageJsonPath - an absolute path to the folder containing the
* package.json file, it does not include the 'package.json' suffix.
* @returns the name of the package (E.g. @microsoft/api-extractor)
*/
static readPackageName(packageJsonPath: string): string;
}