Files

19 lines
552 B
JavaScript
Raw Permalink Normal View History

2026-05-31 18:44:04 +08:00
import { promisifiedGracefulFs } from './promisifiedGracefulFs.js';
import path from 'node:path';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export async function readPackageJson(dir, safe = false) {
try {
return JSON.parse(await promisifiedGracefulFs.readFile(path.resolve(dir, 'package.json'), {
encoding: 'utf-8',
}));
}
catch (err) {
if (safe) {
return {};
}
else {
throw err;
}
}
}
//# sourceMappingURL=read-package-json.js.map