diff options
author | isaacs <i@izs.me> | 2020-07-31 04:33:55 +0300 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2020-07-31 19:37:36 +0300 |
commit | 5473bbda76fd0fbb3d8321c19bc045c71c06a44c (patch) | |
tree | 96c2a0760017ea60b006410fea232dc77d34a6cd /Makefile | |
parent | bcc663807330c21dffe4b7cf7647d0dbcd48a022 (diff) |
Add 'npm exec', port npx to use it directly
This removes libnpx, and adds a new command, 'npm exec', which
implements the functionality. As of this change going live, we are
dropping support for the standalone top-level package 'npx'.
Not all of the functionality of the old version of npx is maintained.
The shell fallback functionality is dropped. It's insecure, and not
something we want to support or encourage. If anyone wants it, they
can hack up their .bashrc file themselves.
--no-install is not supported. If the package is not found locally, it
is installed in a predictable location in the cache, rather than
failing. This is something we might want to review, as automatically
installing in the case of misspellings may be a security footgun.
--ignore-existing is dropped. Existing packages are always given
priority.
--quiet or -q can be accomplished by using the --silent npm option, so
it's also dropped.
--npm option is dropped. npx will always use the npm that it ships
with.
--node-arg is dropped. There are other ways to set node options via
environment variables in the Node.js versions we support.
--always-spawn is dropped. npx will always spawn a child process to
execute commands.
The --shell option can be accomplished by using the --script-shell npm
option.
--version and --help are just passed through to npm.
As an added bonus, I noticed that the files in `bin/` were not getting
run. So now we have full coverage for npm-cli.js and npx-cli.js.
PR-URL: https://github.com/npm/cli/pull/1588
Credit: @isaacs
Close: #1588
Reviewed-by: @ruyadorno
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 6 |
1 files changed, 1 insertions, 5 deletions
@@ -9,8 +9,7 @@ markdowns = $(shell find docs -name '*.md' | grep -v 'index') README.md cli_mandocs = $(shell find docs/content/cli-commands -name '*.md' \ |sed 's|.md|.1|g' \ |sed 's|docs/content/cli-commands/|man/man1/|g' ) \ - man/man1/npm-README.1 \ - man/man1/npx.1 + man/man1/npm-README.1 files_mandocs = $(shell find docs/content/configuring-npm -name '*.md' \ |sed 's|.md|.5|g' \ @@ -84,9 +83,6 @@ man/man1/%.1: docs/content/cli-commands/%.md scripts/docs-build.js package.json @[ -d man/man1 ] || mkdir -p man/man1 node scripts/docs-build.js $< $@ -man/man1/npx.1: node_modules/libnpx/libnpx.1 - cat $< | sed s/libnpx/npx/ > $@ - man/man5/npm-json.5: man/man5/package.json.5 cp $< $@ |