You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.
Let npx locate the "bin" from package.json first and execute it.
It is meant for when you develop a project and you work in the directory, at this point your project isn't installed and you don't have bin-files in node_modules.
Example:
Structure
project
|- bin
|- my-installer.js
|- my-other-bin.js
$ npx install should look into package.json for "bin.install" and execute "bin/my-installer.js" $ npx foo should look into package.json for "bin.foo" and execute "bin/my-other-bin.js"
It will be a nicer version of defined "scripts" and exec them with "npm run", you can always work with npx.
The text was updated successfully, but these errors were encountered:
npx already has some logic around local directory execution. What you're suggesting can already work with npx -p . install. I think this is reasonable enough, as I don't want to take on the breaking change that would be to allow arbitrary shadowing of commands based on the current directory -- which I would've been more comfortable with earlier in npx's life.
I'll think about this, though. I think this might actually be a handy thing to make default behavior 🤔
I agree this makes a lot of sense, because it means you're testing you own bin scripts using the same command (npx install) everyone else will be using, rather than node ./bin/my-installer.js.
I'm unclear on how npm handles bin name collisions across packages. That's the only case where I can imagine shadowing being a problem.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Let npx locate the "bin" from package.json first and execute it.
It is meant for when you develop a project and you work in the directory, at this point your project isn't installed and you don't have bin-files in
node_modules
.Example:
Structure
package.json
$ cd project
$ npx install
should look into package.json for "bin.install" and execute "bin/my-installer.js"$ npx foo
should look into package.json for "bin.foo" and execute "bin/my-other-bin.js"It will be a nicer version of defined "scripts" and exec them with "npm run", you can always work with npx.
The text was updated successfully, but these errors were encountered: