import{readFile as r}from"node:fs/promises";import{join as n}from"node:path";import t from"semver";import{reporter as i}from"../tools/notifiers/reporter.js";import{PACKAGE_NAME as s}from"../../config/product-gates.js";import{PORTAL_VERSION as o}from"../version.js";async function k(){let e="";try{const a=await r(n(process.cwd(),"package.json"));e=JSON.parse(a.toString()).dependencies?.[s]||""}catch{return}e&&!t.valid(e)||e&&!t.satisfies(o,e)&&await i.panicOnBuildContentError(`Detected version mismatch: Installed (${o}) doesn't match package.json (${e}). Run 'npm install' to update and commit the package-lock.json.`)}export{k as validateInstalledVersion};
