File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ const exec = async (opts) => {
110110 return run ( )
111111 }
112112
113- const needPackageCommandSwap = ( args . length > 0 ) && ( packages . length === 0 )
113+ let needPackageCommandSwap = ( args . length > 0 ) && ( packages . length === 0 )
114114 // If they asked for a command w/o specifying a package, see if there is a
115115 // bin that directly matches that name:
116116 // - in the local package itself
@@ -126,9 +126,11 @@ const exec = async (opts) => {
126126 if ( localManifest ?. bin ?. [ args [ 0 ] ] ) {
127127 // we have to install the local package into the npx cache so that its
128128 // bin links get set up
129+ flatOptions . installLinks = false
130+ // args[0] will exist when the package is installed
129131 packages . push ( path )
130132 yes = true
131- flatOptions . installLinks = false
133+ needPackageCommandSwap = false
132134 } else {
133135 const dir = dirname ( dirname ( localBin ) )
134136 const localBinPath = await localFileExists ( dir , args [ 0 ] , '/' )
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ t.test('bin in local pkg', async t => {
2828 const pkg = {
2929 name : '@npmcli/local-pkg-bin-test' ,
3030 bin : {
31+ b : 'echo this is something else' ,
3132 a : 'local-bin-test.js' ,
3233 } ,
3334 }
You can’t perform that action at this time.
0 commit comments