Skip to main content

Project

Helper functions relating to JavaScript/TypeScript projects.

Functions

getPackageRoot()

function getPackageRoot(upStackBy, verbose): Promise<string>;

Defined in: functions/project.ts:21

Helper function to get the directory of the closest "package.json" file, starting from the file that contains the calling function.

Parameters

ParameterTypeDefault valueDescription
upStackBynumber1Optional. The number of functions to rewind in the calling stack before attempting to find the closest "package.json" file. Default is 1.
verbosebooleanfalseOptional. Shows all of the stack frames. Default is false.

Returns

Promise<string>

Throws

If the calling function cannot be determined or if a "package.json" file cannot be found.