just-scripts
Version:
Just Stack Scripts
19 lines • 740 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.readPackageJson = void 0;
const path = require("path");
const fse = require("fs-extra");
/**
* Reads and parses the package.json file from the given folder.
* @param folderPath The folder path to look for a package.json in.
* @returns The parsed file contents, or undefined if the file doesn't exist.
*/
function readPackageJson(folderPath) {
const packageJsonPath = path.join(folderPath, 'package.json');
if (fse.existsSync(packageJsonPath)) {
return fse.readJsonSync(packageJsonPath, { throws: false }) || undefined;
}
return undefined;
}
exports.readPackageJson = readPackageJson;
//# sourceMappingURL=readPackageJson.js.map