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'
33import process from 'node:process'
44
55import constants from '../constants'
6- import { findRoot } from '../utils/path-resolve'
6+ import { findNpmPath } from '../utils/path-resolve'
77
88const { NODE_MODULES , SOCKET_CLI_ISSUES_URL } = constants
99
1010const 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 ) {
1313 console . error (
1414 `Unable to find npm CLI install directory.
1515Searched parent directories of ${ npmEntrypoint } .
@@ -22,7 +22,7 @@ Please report to ${SOCKET_CLI_ISSUES_URL}.`
2222 process . exit ( 127 )
2323}
2424
25- export const npmNmPath = path . join ( npmRootPath , NODE_MODULES )
25+ export const npmNmPath = path . join ( npmPath , NODE_MODULES )
2626export const arboristPkgPath = path . join ( npmNmPath , '@npmcli/arborist' )
2727export const arboristClassPath = path . join (
2828 arboristPkgPath ,
Original file line number Diff line number Diff line change @@ -165,7 +165,7 @@ function pathsToPatterns(paths: string[]): string[] {
165165 return paths . map ( p => ( p === '.' ? '**/*' : p ) )
166166}
167167
168- export function findRoot ( filepath : string ) : string | undefined {
168+ export function findNpmPath ( filepath : string ) : string | undefined {
169169 let curPath = filepath
170170 while ( true ) {
171171 if ( path . basename ( curPath ) === NPM ) {
You can’t perform that action at this time.
0 commit comments