diff options
author | Kat Marchán <kzm@sykosomatic.org> | 2017-07-09 01:20:33 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-07-11 03:09:54 +0300 |
commit | fb040bee0710759c60e45bf8fa2a3b8ddcf4212a (patch) | |
tree | fbd20b9c0b119495436404b8effa5a417269e80c /bin/npx.cmd | |
parent | 88aafee8b5b232b7eeb5690279a098d056575791 (diff) |
npx: bundle npx with npm itself
npx is an npm package runner with a bunch of nice features. While
it is also available on the npm registry as `npx`, it's the sort
of thing that's better off being bundles with npm itself.
Fixes: #6053
PR-URL: https://github.com/npm/npm/pull/17685
Credit: @zkat
Reviewed-By: @iarna
Diffstat (limited to 'bin/npx.cmd')
-rw-r--r-- | bin/npx.cmd | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/npx.cmd b/bin/npx.cmd new file mode 100644 index 000000000..72526178e --- /dev/null +++ b/bin/npx.cmd @@ -0,0 +1,19 @@ +:: Created by npm, please don't edit manually.
+@ECHO OFF
+
+SETLOCAL
+
+SET "NODE_EXE=%~dp0\node.exe"
+IF NOT EXIST "%NODE_EXE%" (
+ SET "NODE_EXE=node"
+)
+
+SET "NPX_CLI_JS=%~dp0\node_modules\npm\bin\npx-cli.js"
+FOR /F "delims=" %%F IN ('CALL "%NODE_EXE%" "%NPX_CLI_JS%" prefix -g') DO (
+ SET "NPM_PREFIX_NPX_CLI_JS=%%F\node_modules\npm\bin\npx-cli.js"
+)
+IF EXIST "%NPM_PREFIX_NPX_CLI_JS%" (
+ SET "NPX_CLI_JS=%NPM_PREFIX_NPX_CLI_JS%"
+)
+
+"%NODE_EXE%" "%NPX_CLI_JS%" %*
|