Search code examples
gittypescriptnpmversion-controlnpmignore

Should I commit auto generated files published in npm package


I have a NPM package written in TypeScript. My build process takes all *.ts files and bundle them into myLib.d.ts, myLib.js and myLib.js.map.

My NPM package must have all src/.ts files and these three myLib. auto generated files.

But in my git repository, should I commit these three myLib.* auto generated files?

Is it a problem to publish files in npm package that are not under version control?


Solution

  • The output/generated files myLib.d.ts, myLib.js and myLib.js.map shouldn’t managed in git repo.

    You should ignore these files by .gitignore. And it won’t effect to publish npm pakeages.

    You can also refer the example .gitignore file for TypeScript.