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

avoid version problems for node users #45

Closed
alexeagle opened this issue Oct 3, 2017 · 8 comments
Closed

avoid version problems for node users #45

alexeagle opened this issue Oct 3, 2017 · 8 comments

Comments

@alexeagle
Copy link
Collaborator

There are two ways:

  1. recommend PATH=./node_modules/.bin:$PATH so that if you are in a project directory where [email protected] is installed, you get that version. @vsavkin suggests this. But if you're in a child directory (common for bazel users since it does a good job in this case) it doesn't work

  2. when ibazel runs, it checks if there is a locally installed copy, and exec()s that one instead. gulp and angular-cli do it this way. @hansl suggests this

@ittaiz
Copy link
Member

ittaiz commented Oct 4, 2017 via email

@alexeagle
Copy link
Collaborator Author

Currently you either do a global install, then get the global version anywhere you run the tool, or list ibazel in your package.json#devDependencies, then you have to run it like ./node_modules/.bin/ibazel

@ittaiz
Copy link
Member

ittaiz commented Oct 4, 2017 via email

@mrmeku
Copy link
Collaborator

mrmeku commented Nov 15, 2017

I think this issue is a bit tricky since you can specify multiple targets for bazel to build/run

bazel build :some_target path:some_other_target

Should we only try to pick the local ibazel if they specify one target? Or maybe only if they are in a subdirectory with a local bazel installation (so running ibazel from outside the project directory would do use the global installed version)?

I think we need to think about a really easy to understand heuristic we can use so that we can communicate that to ibazel users

@alexeagle
Copy link
Collaborator Author

I don't think it matters what the target patterns are.
You just look in the cwd() where the ibazel is run. If you find a locally installed in ./node_modules or ../(../)+node_modules then you use that (following node module resolution semantics). Finally you give up and run the globally installed one.

@mrmeku
Copy link
Collaborator

mrmeku commented Nov 16, 2017 via email

@achew22
Copy link
Member

achew22 commented Nov 16, 2017

Is there a good way to scan for node_modules directories other than to recurse up and see if it exists?

@alexeagle
Copy link
Collaborator Author

alexeagle commented Nov 16, 2017 via email

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

No branches or pull requests

4 participants