Should I commit auto generated files published in npm package

1.3k views Asked by At

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?

1

There are 1 answers

0
Marina Liu On BEST ANSWER

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.