UNPKG

@nuxt/devtools

Version:

<a href="https://devtools.nuxt.com"><img width="1200" alt="Nuxt DevTools" src="https://github-production-user-asset-6210df.s3.amazonaws.com/904724/261577617-a10567bd-ad33-48cc-9bda-9e37dbe1929f.png"></a> <br>

29 lines (26 loc) 842 B
import { resolve } from 'node:path'; import { fileURLToPath } from 'node:url'; import isInstalledGlobally from 'is-installed-globally'; const packageDir = resolve(fileURLToPath(import.meta.url), "../.."); const distDir = resolve(fileURLToPath(import.meta.url), ".."); const runtimeDir = resolve(distDir, "runtime"); const clientDir = resolve(distDir, "client"); const globalInstallMatch = [ "/yarn/global/", "/pnpm/global/", "/npm/global/", "/.nvm/", "/.volta/", "/.fnm/", // On Windows "/nvm/versions/", "/n/versions/" // TODO: More info for other package managers ]; function isGlobalInstall() { if (isInstalledGlobally) return true; const dir = packageDir.replace(/\\/g, "/"); return globalInstallMatch.some((i) => dir.includes(i)); } export { clientDir, distDir, isGlobalInstall, packageDir, runtimeDir };