Skip to content

PromptScript API


Function: getPackageInfo()

getPackageInfo(baseDir, relativePath): PackageInfo

Defined in: core/src/utils/package.ts:30

Get package information from a package.json file.

Parameters

baseDir

string

Base directory containing package.json (typically __dirname of the caller)

relativePath

string = '../package.json'

Relative path to package.json from baseDir (default: '../package.json')

Returns

PackageInfo

Package information

Example

// In src/cli.ts
const pkg = getPackageInfo(__dirname);
console.log(pkg.version); // "1.0.0"