I'm using flowtypes in my project and getting third-party library definitions via flow-typed CLI.
Running flow-typed install
puts in /flow-typed/npm folder all definitions founded for dependencies in package.json.
So I wonder if I should commit this folder or ignore it. Since you may want to add other flowtype definitions to flow-typed folder I'm guessing that /flow-typed/npm folder should be ignored and /flow-typed should be keep in version control but not sure really. Any thoughts?
The flow-typed npm package provides a CLI that includes several commands for working with this repository. The full list of commands is available in the docs.
There are pros and cons. I suggest the default is to not commit the node_modules folder, and instead add it to your .gitignore file. You might have special needs that reverse this decision. I discuss the topic so you can make your own opinion.
9 Answers 9 ActiveOldestVotes 193 The answer is not as easy as Alberto Zaccagni suggests. If you develop applications (especially enterprise applications), including node_modules in your git repo is a viable choice and which alternative you choose depends on your project.
Keep in mind that git isn't tracking differences between versions of any file, but is storing copies of either version of a file as soon as a single character has changed. Every update to any dependency will result in another large changeset.
General advice is to check them into source control: https://github.com/flow-typed/flow-typed/wiki/FAQs#why-do-i-need-to-commit-the-libdefs-that-flow-typed-installs-for-my-project
Libdefs in flow-typed are tagged at both Flow and library version when they are installed, but libdefs themselves can improve over time. For example, they may have a bug or there may be an improvement to their accuracy or completeness.
When a libdef is improved or updated in flow-typed, there's some chance that the change could introduce new Flow errors into your project. As good as it is to find new issues, we also want to make sure that Flow-errors in your project are consistent and predictable over time.
So if/when you wish to upgrade a libdef that you've already checked in to your project's version control, you can do so explicitly with the flow-typed install --overwrite command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With