Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I check my TypeScript definition files for external libraries into git?

Tags:

git

typescript

I am using TSD to manage the TypeScript definition files for a web application I am developing.

Should I check the TypeScript definition files for the external libraries I am using (managed via Bower) into git in addition to the tsd.json file?

Similar discussions exist for Bower and NPM dependencies, where the NPM documentation says no, and afaik Bower no longer gives a recommendation (used to say yes).

The definition files are quite lightweight, so I am leaning towards checking them in. Any opinions?

like image 918
muenchdo Avatar asked Dec 24 '22 14:12

muenchdo


1 Answers

If a developer should run npm install after checking out your repo, why not have tsd install run automatically? It's easy to add it to scripts in package.json:

// package.json
"scripts": {
  "postinstall": "tsd install"
}

The argument for not checking in generated files and dependencies is not merely to reduce the weight of the repository. It's also about trusting a script to keep things up-to-date, rather than human decision. And it reduces noise in commits when minor changes occur in the generated files.

A contrary argument could be made: if you're concerned that the tsd resources will go missing, checking them into your repo will guard against that. But the paranoid should check in the npm modules as well.

like image 67
Robert Penner Avatar answered May 21 '23 02:05

Robert Penner