Skip to main content

Project

Functions

getPackageRoot()

function getPackageRoot(upStackBy): Promise<string>;

Defined in: packages/complete-node/src/functions/project.ts:16

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.

Returns

Promise<string>

Throws

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