INNER CODE UNIT · JavaScript
pnpmGlobal
tunnckoCore/opensource · @packages/all-module-paths/src/index.js:56
const pnpmGlobal = pnpmStoreVersions.find((pnpmGlobalStore) =>
fs.existsSync(pnpmGlobalStore),
);
// Always first all the "official" global paths,
// it's mostly always a short array of few items paths.
// That ensures that the nvm's global dir is always last item
// We also filtering out the `vX.X.X/node_modules`, because such never exist.
const globalPackages = globalPaths
.filter((x) => !x.endsWith(path.join(nvmCurrent, 'node_modules')))
.filter((x) => {
if (!x.startsWith(nvmDir)) {
return true;
}
const start = x.startsWith(nvmDir);
return (
(start && x.endsWith(pnpmGlobal)) ||
x.includes(path.join(nvmCurrent, 'lib'))