Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

Hash out wtf npx ./foo commands do #49

Closed
zkat opened this issue Jun 24, 2017 · 0 comments
Closed

Hash out wtf npx ./foo commands do #49

zkat opened this issue Jun 24, 2017 · 0 comments

Comments

@zkat
Copy link
Owner

zkat commented Jun 24, 2017

There's a particular corner case with npx usage that hasn't been quite specced out to satisfaction: local directory specifiers.

note: directory in npm-package-arg lingo includes regular directories as well as any files that don't end in .tar, .tgz, or .tar.gz. I'll be using that terminology here, with specific disambiguation as necessary.

The biggest problem is that there's several different situations where these specifiers can pop up, and we need to know what to actually do with them. I'll put a table here with the current + proposed behavior for the various situations, and hopefully we can come up with something useful here.

I definitely consider the current behavior to be buggy because I think literally no one wants what npx does for this right now.

command current behavior do this instead
npx ./pkgdir npm i -g ./pkgdir && pkgdir node ./pkgdir/${pkg.bin or pkg.main or index.js}
npx ./otherdir npm i -g ./otherdir && otherdir Error: executing random directories makes no sense
npx ./foo.bin npm i -g ./foo.bin && foo.bin ./foo.bin
npx ./foo.js npm i -g ./foo.js && foo.js node ./foo.js
npx ./foo (foo has #!/usr/bin/env node) npm i -g ./foo && foo node ./foo
npx -p pkg ./whatever npm i -g pkg && ./whatever Exactly the same as above, but with an npm i -g pkg first.
@zkat zkat changed the title Hash out wtf directory commands do Hash out wtf npx ./foo commands do Jun 24, 2017
zkat added a commit that referenced this issue Jun 24, 2017
Fixes: #49

BREAKING CHANGE: `npx ./something` will now execute `./something` as a
binary instead of trying to install it as npm would. Other behavior
related to local path deps has likewise been changed. See #49 for deets.
zkat added a commit that referenced this issue Jun 24, 2017
Fixes: #49

BREAKING CHANGE: `npx ./something` will now execute `./something` as a
binary or script instead of trying to install it as npm would. Other behavior
related to local path deps has likewise been changed. See
[#49](#49) for a detailed explanation
of all the various cases and how each of them is handled.
@zkat zkat closed this as completed in 2e418d1 Jun 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant