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

install command support pass through repositories #4142

Open
Brianzchen opened this issue Oct 3, 2021 · 1 comment
Open

install command support pass through repositories #4142

Brianzchen opened this issue Oct 3, 2021 · 1 comment
Labels
libdef Related to a library definition

Comments

@Brianzchen
Copy link
Member

Do you want to request a feature or report a bug?
feature

What is the current behavior?
Currently when I run flow-typed install it will always install lib defs from the preconfigured src destination being what's in the cache dir ${homeDir}/.flow-typed. There is an option to target a custom cache dir but most of the time a user of flow-typed wouldn't use that because that tries to pull all lib defs from that particular custom dir.

The copy from src to dest is here

Cache dir query is done here

What is the expected behavior?
What I'd like to see is a bypass source location option where flow-typed can try to first query defs from there before looking in the cache dir which ultimately is pulled from the flow-typed repo.

If this is a feature request, what is motivation or use case for changing the behavior?
This opens up a lot of doors for teams to build their own configs and custom defs that can be easily shared without copying and pasting everywhere.

  1. If my company hasn't fully adopted flowtype or uses TS and the maintainers of a private library doesn't want to maintain flow I can still self serve just as flow-typed does for open source libraries
  2. I can create type defs to override what's in flow-typed as I wait for PRs to get merged
  3. (future thinking) It can be a central place to save other things such as standardised .flowconfig that teams can use in the future when creating new repos and in the future we can enable some kind of flow-typed init command that installs it if they are pulling from a custom source

Doubts

  • Not really sure how to configure something like this, maybe just flow-typed install --customDir=~/some-place or it's a config file?
  • I guess the alternative is to create a private repo where private type defs are stored and you can just add a line in the [libs] section in .flowconfig that point to it like @node_modules/@scope/private-types
@Brianzchen
Copy link
Member Author

The correct thing here would be to build a proxy for where the cache is generated from, and the cli searches for lib defs there. If they cannot be found then it will search in flow-typed/flow-typed repo.

But digging into the code it doesn't support that because that cache is hardcoded right now to run git pulls to update the cache as well as using the git version to make version signing (though this seem to matter less).
https://github.com/flow-typed/flow-typed/blob/master/cli/src/lib/git.js#L140

@Brianzchen Brianzchen added this to Todo in Brian's watchlist Nov 23, 2021
@Brianzchen Brianzchen added the libdef Related to a library definition label Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libdef Related to a library definition
Projects
Development

No branches or pull requests

1 participant