Closed Dimava closed 12 months ago
cc @antfu
Thanks for bringing this up, but sorry we no longer accept adding new commands.
@antfu Do you think this behavior could be achieved without adding a new command?
I use Firebase CLI and Prisma CLI in my projects (installed locally) and currently there is no way to reliably execute these with ni.
When using npm as a package manager, it works as expected because npx
attempts to run local binaries before download. However, the translated commands for other package managers force a download from the registry, which causes either version mismatches or lookup failure.
Some packages use a different name for their package vs binary. For instance, the firebase
CLI is distributed under the firebase-tools package. This means with npm I can write nlx firebase
but with other package managers I have to write nlx firebase-tools
.
Perhaps nlx
could align more with npm's behavior, defaulting to local binaries before performing a registry lookup?
Description
This PR adds
nrx
command, which is an "execute local binary" command:Unlike
dlx
-style commands (npx
/yarn dlx
) this can't install new packages and must use existing ones If the binary is missing, this command is guaranteed to failLinked Issues
(unrelated) #140
Additional context
This Draft PR is missing:
nrx
command for some other stuff (as there werenx
andnix
)console.log('>', command)
nrx
can run binarynrx
cannot run missing binaryPlease tell me if there is interest in this command, so I can either procees to making tests/docs or leave it as-is (it works for me locally, so I don't really need tests/docs if this is not going to be upstreamed)