atcheck/lsscanner/new_ubuntu/node_modules/electron-rebuild/src/read-package-json.ts

15 lines
296 B
TypeScript
Raw Normal View History

2019-12-16 18:42:21 +01:00
import * as fs from 'fs-extra';
import * as path from 'path';
export async function readPackageJson(dir: string, safe = false) {
try {
return await fs.readJson(path.resolve(dir, 'package.json'));
} catch (err) {
if (safe) {
return {};
} else {
throw err;
}
}
}