node/deps/npm/node_modules/libnpmexec
npm CLI robot bfe32ec016
deps: upgrade npm to 10.2.4
PR-URL: https://github.com/nodejs/node/pull/50751
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2023-11-16 17:12:25 +00:00
..
lib deps: upgrade npm to 9.8.1 2023-07-23 10:11:27 +00:00
LICENSE deps: upgrade npm to 7.11.2 2021-04-30 17:39:15 -04:00
README.md deps: upgrade npm to 9.7.1 2023-06-08 12:24:49 +00:00
package.json deps: upgrade npm to 10.2.4 2023-11-16 17:12:25 +00:00

README.md

libnpmexec

npm version license CI - 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 using packages option String, defaults to empty string.
    • cache: The path location to where the npm cache folder is placed String
    • npxCache: The path location to where the npx cache folder is placed String
    • chalk: Chalk instance to use for colors? Required
    • localBin: Location to the node_modules/.bin folder of the local project to start scanning for bin files String, defaults to ./node_modules/.bin. libexec will walk up the directory structure looking for node_modules/.bin folders in parent folders that might satisfy the current arg and will use that bin if found.
    • locationMsg: Overrides "at location" message when entering interactive mode String
    • globalBin: Location to the global space bin folder, same as: $(npm bin -g) String, defaults to empty string.
    • output: A function to print output to Function
    • 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 to sh on POSIX systems, process.env.ComSpec OR cmd on Windows
    • yes: Should skip download confirmation prompt when fetching missing packages from the registry? Boolean
    • registry, cache, and more options that are forwarded to @npmcli/arborist and pacote Object

LICENSE

ISC