wxt
Version:
⚡ Next-gen Web Extension Framework
21 lines (20 loc) • 538 B
JavaScript
import { wxt } from "../wxt.mjs";
import { readJson } from "./fs.mjs";
import { resolve } from "node:path";
//#region src/core/utils/package.ts
/**
* Read the project's package.json.
*
* TODO: look in root and up directories until it's found
*/
async function getPackageJson() {
const file = resolve(wxt.config.root, "package.json");
try {
return await readJson(file);
} catch (err) {
wxt.logger.debug(`Failed to read package.json at: ${file}. Returning undefined.`, err);
return {};
}
}
//#endregion
export { getPackageJson };