Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node_modules/.bin to $PATH #26

Closed
kentcdodds opened this issue Sep 9, 2015 · 10 comments
Closed

Add node_modules/.bin to $PATH #26

kentcdodds opened this issue Sep 9, 2015 · 10 comments

Comments

@kentcdodds
Copy link
Contributor

Just like npm-scripts do:

In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix. For example, if there is a devDependency on tap in your package, you should write:

"scripts": {"test": "tap test/.js"}
instead of "scripts": {"test": "node_modules/.bin/tap test/
.js"} to run your tests.

This would be very handy!

@kentcdodds
Copy link
Contributor Author

I'm investigating now. Here is where the scripts are run, and here is where PATH gets added. Would love it if we could get the path adding stuff open sourced, or find an open source solution...

@gtramontina
Copy link
Collaborator

Yes!! I thought about this in the very beginning of the project and for whatever reason I forgot about it... I've done something like that here: https://github.com/gtramontina/npmw 😁 -- more specifically at https://github.com/gtramontina/npmw/blob/master/lib/npmw.template#L15-L16

I believe this should be quite straight forward.

@kentcdodds
Copy link
Contributor Author

I think it'd be cool if we could take some of what npm has here and here and open source it, then ghooks can use it... I'll let you know when I've got that done. 😀

@kentcdodds
Copy link
Contributor Author

Done! http://npm.im/add-to-path

@bjrmatos
Copy link

I think this would be useful for better git's GUI integration #18 :D

@kentcdodds
Copy link
Contributor Author

I don't think so actually. The problem is that git GUIs don't even load node in the first place :-(

@noamokman
Copy link
Contributor

👍 this repo seems a bit in active.. need some help?

@kentcdodds
Copy link
Contributor Author

Would totally love some help :-) FYI, add-to-path was renamed and altered a bit to become manage-path

@noamokman
Copy link
Contributor

Yeah just followed up on your second PR for npm.
Hope you manage to squeeze it in 😄
I wanna close all PRs and issues. I can make a PR for this issue but I wanna clean up a bit first.
What do you say?

@kentcdodds
Copy link
Contributor Author

That sounds awesome! I'll keep an eye on things :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants