MCPcopy Create free account
hub / github.com/vercel/vercel / isGlobalByPath

Function isGlobalByPath

packages/cli/src/util/get-update-command.ts:108–129  ·  view source on GitHub ↗
(installPath: string)

Source from the content-addressed store, hash-verified

106}
107
108function isGlobalByPath(installPath: string): boolean {
109 // This is true for e.g. nvm, node path will be equal to now path
110 if (dirname(process.argv[0]) === dirname(process.argv[1])) {
111 return true;
112 }
113
114 if (
115 installPath.includes(['', 'yarn', 'global', 'node_modules', ''].join(sep))
116 ) {
117 return true;
118 }
119
120 if (installPath.includes(['', 'pnpm', 'global', ''].join(sep))) {
121 return true;
122 }
123
124 if (installPath.includes(['', 'fnm', 'node-versions', ''].join(sep))) {
125 return true;
126 }
127
128 return false;
129}
130
131async function isGlobalByPrefix(installPath: string): Promise<boolean> {
132 const isWindows = process.platform === 'win32';

Callers 1

resolveInstallFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected