mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
PR-URL: https://github.com/nodejs/node/pull/60168 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> |
||
|---|---|---|
| .. | ||
| lib | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
libnpmexec
The npm exec (npx) Programmatic API
Install
npm install libnpmexec
Usage:
const libexec = require('libnpmexec')
await libexec({
args: ['yosay', 'Bom dia!'],
cache: '~/.npm/_cacache',
npxCache: '~/.npm/_npx',
yes: true,
})
API:
libexec(opts)
opts:args: List of pkgs to execute Array, defaults to[]call: An alternative command to run when usingpackagesoption String, defaults to empty string.cache: The path location to where the npm cache folder is placed StringnpxCache: The path location to where the npx cache folder is placed Stringchalk: Chalk instance to use for colors? RequiredlocalBin: Location to thenode_modules/.binfolder of the local project to start scanning for bin files String, defaults to./node_modules/.bin. libexec will walk up the directory structure looking fornode_modules/.binfolders in parent folders that might satisfy the currentargand will use that bin if found.locationMsg: Overrides "at location" message when entering interactive mode StringglobalBin: Location to the global space bin folder, same as:$(npm bin -g)String, defaults to empty string.packages: A list of packages to be used (possibly fetch from the registry) Array, defaults to[]path: Location to where to read local project info (package.json) String, defaults to.runPath: Location to where to execute the script String, defaults to.scriptShell: Default shell to be used String, defaults toshon POSIX systems,process.env.ComSpecORcmdon Windowsyes: Should skip download confirmation prompt when fetching missing packages from the registry? Booleanregistry,cache, and more options that are forwarded to @npmcli/arborist and pacote Object