diff --git a/node_modules/libnpmexec/CHANGELOG.md b/node_modules/libnpmexec/CHANGELOG.md new file mode 100644 index 0000000000000..28cb71028868e --- /dev/null +++ b/node_modules/libnpmexec/CHANGELOG.md @@ -0,0 +1,17 @@ +# Changelog + +## v1.1.0 + +- Add add walk up dir lookup logic to satisfy local bins, +similar to `@npmcli/run-script` + +## v1.0.1 + +- Fix `scriptShell` option name. + +## v1.0.0 + +- Initial implementation, moves the code that used to live in the **npm cli**, +ref: https://github.com/npm/cli/blob/release/v7.10.0/lib/exec.js into this +separate module, providing a programmatic API to the **npm exec** functionality. + diff --git a/node_modules/libnpmexec/README.md b/node_modules/libnpmexec/README.md index fb7a771760019..18a26011adc76 100644 --- a/node_modules/libnpmexec/README.md +++ b/node_modules/libnpmexec/README.md @@ -39,7 +39,7 @@ await libexec({ - `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** + - `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](https://github.com/npm/arborist/) and [pacote](https://github.com/npm/pacote/#options) **Object** diff --git a/node_modules/libnpmexec/lib/index.js b/node_modules/libnpmexec/lib/index.js index a48c654bf6a4f..8c5181f397519 100644 --- a/node_modules/libnpmexec/lib/index.js +++ b/node_modules/libnpmexec/lib/index.js @@ -16,6 +16,7 @@ const getBinFromManifest = require('./get-bin-from-manifest.js') const manifestMissing = require('./manifest-missing.js') const noTTY = require('./no-tty.js') const runScript = require('./run-script.js') +const isWindows = require('./is-windows.js') /* istanbul ignore next */ const PATH = ( @@ -34,7 +35,7 @@ const exec = async (opts) => { packages: _packages = [], path = '.', runPath = '.', - scriptShell = undefined, + scriptShell = isWindows ? process.env.ComSpec || 'cmd' : 'sh', yes = undefined, ...flatOptions } = opts diff --git a/node_modules/libnpmexec/lib/is-windows.js b/node_modules/libnpmexec/lib/is-windows.js new file mode 100644 index 0000000000000..fbece90ad7496 --- /dev/null +++ b/node_modules/libnpmexec/lib/is-windows.js @@ -0,0 +1 @@ +module.exports = process.platform === 'win32' diff --git a/node_modules/libnpmexec/package.json b/node_modules/libnpmexec/package.json index c113ac6d0a607..2b3b488cf079f 100644 --- a/node_modules/libnpmexec/package.json +++ b/node_modules/libnpmexec/package.json @@ -1,6 +1,6 @@ { "name": "libnpmexec", - "version": "1.1.1", + "version": "1.2.0", "files": [ "lib" ], diff --git a/package-lock.json b/package-lock.json index 08c9712ace7ee..f20da70ff561d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -103,7 +103,7 @@ "leven": "^3.1.0", "libnpmaccess": "^4.0.2", "libnpmdiff": "^2.0.4", - "libnpmexec": "^1.1.1", + "libnpmexec": "^1.2.0", "libnpmfund": "^1.1.0", "libnpmhook": "^6.0.2", "libnpmorg": "^2.0.2", @@ -4650,9 +4650,9 @@ } }, "node_modules/libnpmexec": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/libnpmexec/-/libnpmexec-1.1.1.tgz", - "integrity": "sha512-uw6H2dzC6F6fdq7lAxfzXPimHCJ3/g6ycFKcv2Q2QXuNZ94EDmNPpMO6f4mwiC5F6Lyy/WK0IL7AZwRhmSvUdQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/libnpmexec/-/libnpmexec-1.2.0.tgz", + "integrity": "sha512-LkxnH2wsMUI4thsgUK0r+EFZ5iCjKlp21J68dFY7AzD5uaaIPqO3lqVvYbyl1Umz1R4rY9t3vFa1fF3hzo6Y2Q==", "inBundle": true, "dependencies": { "@npmcli/arborist": "^2.3.0", @@ -13690,9 +13690,9 @@ } }, "libnpmexec": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/libnpmexec/-/libnpmexec-1.1.1.tgz", - "integrity": "sha512-uw6H2dzC6F6fdq7lAxfzXPimHCJ3/g6ycFKcv2Q2QXuNZ94EDmNPpMO6f4mwiC5F6Lyy/WK0IL7AZwRhmSvUdQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/libnpmexec/-/libnpmexec-1.2.0.tgz", + "integrity": "sha512-LkxnH2wsMUI4thsgUK0r+EFZ5iCjKlp21J68dFY7AzD5uaaIPqO3lqVvYbyl1Umz1R4rY9t3vFa1fF3hzo6Y2Q==", "requires": { "@npmcli/arborist": "^2.3.0", "@npmcli/ci-detect": "^1.3.0", diff --git a/package.json b/package.json index 70fa91887930d..0e60c184900f2 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "leven": "^3.1.0", "libnpmaccess": "^4.0.2", "libnpmdiff": "^2.0.4", - "libnpmexec": "^1.1.1", + "libnpmexec": "^1.2.0", "libnpmfund": "^1.1.0", "libnpmhook": "^6.0.2", "libnpmorg": "^2.0.2", diff --git a/test/lib/exec.js b/test/lib/exec.js index 4f8cc02fce7bd..6924783239b49 100644 --- a/test/lib/exec.js +++ b/test/lib/exec.js @@ -307,7 +307,7 @@ t.test('npm exec , run interactive shell', t => { throw er t.match(RUN_SCRIPTS, [{ - pkg: { scripts: { npx: undefined } }, + pkg: { scripts: { npx: /sh|cmd/ } }, }]) LOG_WARN.length = 0