File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,13 @@ import path from 'node:path'
3
3
import process from 'node:process'
4
4
5
5
import constants from '../constants'
6
- import { findRoot } from '../utils/path-resolve'
6
+ import { findNpmPath } from '../utils/path-resolve'
7
7
8
8
const { NODE_MODULES , SOCKET_CLI_ISSUES_URL } = constants
9
9
10
10
const npmEntrypoint = realpathSync . native ( process . argv [ 1 ] ! )
11
- const npmRootPath = findRoot ( path . dirname ( npmEntrypoint ) )
12
- if ( npmRootPath === undefined ) {
11
+ const npmPath = findNpmPath ( npmEntrypoint )
12
+ if ( npmPath === undefined ) {
13
13
console . error (
14
14
`Unable to find npm CLI install directory.
15
15
Searched parent directories of ${ npmEntrypoint } .
@@ -22,7 +22,7 @@ Please report to ${SOCKET_CLI_ISSUES_URL}.`
22
22
process . exit ( 127 )
23
23
}
24
24
25
- export const npmNmPath = path . join ( npmRootPath , NODE_MODULES )
25
+ export const npmNmPath = path . join ( npmPath , NODE_MODULES )
26
26
export const arboristPkgPath = path . join ( npmNmPath , '@npmcli/arborist' )
27
27
export const arboristClassPath = path . join (
28
28
arboristPkgPath ,
Original file line number Diff line number Diff line change @@ -165,7 +165,7 @@ function pathsToPatterns(paths: string[]): string[] {
165
165
return paths . map ( p => ( p === '.' ? '**/*' : p ) )
166
166
}
167
167
168
- export function findRoot ( filepath : string ) : string | undefined {
168
+ export function findNpmPath ( filepath : string ) : string | undefined {
169
169
let curPath = filepath
170
170
while ( true ) {
171
171
if ( path . basename ( curPath ) === NPM ) {
You can’t perform that action at this time.
0 commit comments