Reputation: 15371
I'd like to ignore the JavaScript files compiled from TypeScript in my git repo. (That greatly simplifies merging, rebasing, partial commits etc.) The relevant parts of my setup look like this:
tsconfig.json
{
"compilerOptions": {
"outDir": "./dist"
}
}
.gitignore
dist
When installing globally like this:
rm -rf dist
node_modules/.bin/tsc
sudo npm install -g
the gitignored dist
folder is not installed. Is there any proper solution to this? The following ones aren't really satisfactory:
dist
in .gitignore
before and after sudo npm install -g
Upvotes: 1
Views: 2030
Reputation: 15371
I solved the problem by putting the following into my package.json
:
"files": [
"/dist"
],
Now, only the dist folder and README.md
are packaged/installed. Found out about this possibility from a post by Jeff Dickey.
Upvotes: 3