Reputation: 33
Should the repository for a library written in Typescript contain a JS version for the consumer? Or should I leave it to the consumer to compile it themselves? Or neither?
Upvotes: 1
Views: 163
Reputation:
As a general rule, I only include the source files in the repo. There is a reasonable expectation that a person downloading the source will want to work with the source and build it. Meanwhile you can offer build tools/commands to help them build it. For npm modules, your package.json might have a postinstall script that runs the tsc
command. As long as TypeScript is a dependency, npm will download the necessary libraries and execute the TypeScript build when the user does an npm install
on the repo once cloned locally.
Upvotes: 1