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

[CLI] CLI should look at cwd and use locally-installed binary (if present) #88

Closed
jeffmo opened this issue May 11, 2016 · 4 comments · May be fixed by admmasters/flow-typed#19 or admmasters/flow-typed#24

Comments

@jeffmo
Copy link
Contributor

jeffmo commented May 11, 2016

One problem with npm install -g is that it installs an executable at a certain version -- whereas various projects could be built using/expecting a different version.

One way I dealt with this for the Jest CLI was to look at CWD and try to determine if we're currently inside a project that depends on the CLI (and, if so, delegate execution to the local version instead of the globally-installed version).

This should also help reduce the frequency with which people need to update their global CLI version.

@bassettsj
Copy link
Contributor

Agreed. This is why grunt-cli exists.

@ryyppy
Copy link
Contributor

ryyppy commented May 12, 2016

Are you talking about the flow-typed cli binary?

@jeffmo
Copy link
Contributor Author

jeffmo commented May 12, 2016

@ryyppy: right

@jeffmo
Copy link
Contributor Author

jeffmo commented May 12, 2016

(PS: I have this PR mostly ready, just need to test a bit more before I send it out for review)

jeffmo added a commit that referenced this issue May 16, 2016
Per #88, this looks for a binary at `$CWD/node_modules/.bin/flow-typed` (and walks up to root) in order to find a "local" version of the CLIto execute.

This makes `npm install -g` a little safer to do for projects that wish to tie to a specific version of `flow-typed` for whatever reason.
@jeffmo jeffmo closed this as completed May 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants