TypeScript .gitignore Guide
October 26, 2023
When working with TypeScript, certain files and directories are generated during the compilation and development process that you may not want to commit to your Git repository. This guide will outline the common items you'd typically want to exclude using a .gitignore
file.
Getting Started
First, make sure you're in the root directory of your TypeScript project. Then create a file named .gitignore
if it doesn't already exist.
touch .gitignore
You could ship faster.
Imagine the time you'd save if you never had to build another internal tool, write a SQL report, or manage another admin panel again. Basedash is built by internal tool builders, for internal tool builders. Our mission is to change the way developers work, so you can focus on building your product.
Common TypeScript Exclusions
Compilation Outputs
TypeScript compiles down to JavaScript, and by default, the compiled JavaScript files have the .js
extension and source maps have the .js.map
extension. If you're compiling TypeScript to a dedicated output directory (e.g., dist
or build
), you might want to exclude the entire directory. If not, you might want to exclude the individual files.
# If using a dedicated output directory: dist/ build/ # If not using a dedicated output directory: *.js *.js.map
Node Modules
If you're using npm or Yarn to manage your project's dependencies, you'll have a node_modules/
directory. This should always be excluded as it can contain thousands of files, and you don’t want those in your repo.
node_modules/
IDE and Editor Configurations
Many IDEs and editors create configuration and cache files that are specific to a user's environment. Examples include .vscode/
for Visual Studio Code and .idea/
for JetBrains IDEs.
.vscode/ .idea/
Environment Configuration
Files that contain secrets, API keys, or database connection info (commonly .env
files or other configuration files) should never be committed to a public repository.
.env .env.local .env.*.local
TypeScript Cache
TypeScript might generate cache files when using project references or when incremental compilation is enabled.
*.tsbuildinfo
Other Common Exclusions
Other files and directories that are commonly excluded in many JavaScript and TypeScript projects include:
# Log files *.log # Runtime data pids *.pid *.seed *.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage # nyc test coverage .nyc_output # Grunt intermediate storage (<https://gruntjs.com/creating-plugins#storing-task-files>) .grunt # Bower dependency directory (<https://bower.io/>) bower_components # Dependency directory # Commenting this out is preferred by some developers, npm can # handle it properly when it's symlinked (npm v3+) # node_modules/ # TSD Debug info tsd-debug.log
Wrapping Up
Once you've configured your .gitignore
based on your needs, simply save and close the file. Git will now respect these exclusions for all future commits. Remember, if you've previously committed unwanted files, you'll need to remove them from your repository history or use the git rm
command before the .gitignore
changes will apply to them.
TOC
October 26, 2023
When working with TypeScript, certain files and directories are generated during the compilation and development process that you may not want to commit to your Git repository. This guide will outline the common items you'd typically want to exclude using a .gitignore
file.
Getting Started
First, make sure you're in the root directory of your TypeScript project. Then create a file named .gitignore
if it doesn't already exist.
touch .gitignore
You could ship faster.
Imagine the time you'd save if you never had to build another internal tool, write a SQL report, or manage another admin panel again. Basedash is built by internal tool builders, for internal tool builders. Our mission is to change the way developers work, so you can focus on building your product.
Common TypeScript Exclusions
Compilation Outputs
TypeScript compiles down to JavaScript, and by default, the compiled JavaScript files have the .js
extension and source maps have the .js.map
extension. If you're compiling TypeScript to a dedicated output directory (e.g., dist
or build
), you might want to exclude the entire directory. If not, you might want to exclude the individual files.
# If using a dedicated output directory: dist/ build/ # If not using a dedicated output directory: *.js *.js.map
Node Modules
If you're using npm or Yarn to manage your project's dependencies, you'll have a node_modules/
directory. This should always be excluded as it can contain thousands of files, and you don’t want those in your repo.
node_modules/
IDE and Editor Configurations
Many IDEs and editors create configuration and cache files that are specific to a user's environment. Examples include .vscode/
for Visual Studio Code and .idea/
for JetBrains IDEs.
.vscode/ .idea/
Environment Configuration
Files that contain secrets, API keys, or database connection info (commonly .env
files or other configuration files) should never be committed to a public repository.
.env .env.local .env.*.local
TypeScript Cache
TypeScript might generate cache files when using project references or when incremental compilation is enabled.
*.tsbuildinfo
Other Common Exclusions
Other files and directories that are commonly excluded in many JavaScript and TypeScript projects include:
# Log files *.log # Runtime data pids *.pid *.seed *.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage # nyc test coverage .nyc_output # Grunt intermediate storage (<https://gruntjs.com/creating-plugins#storing-task-files>) .grunt # Bower dependency directory (<https://bower.io/>) bower_components # Dependency directory # Commenting this out is preferred by some developers, npm can # handle it properly when it's symlinked (npm v3+) # node_modules/ # TSD Debug info tsd-debug.log
Wrapping Up
Once you've configured your .gitignore
based on your needs, simply save and close the file. Git will now respect these exclusions for all future commits. Remember, if you've previously committed unwanted files, you'll need to remove them from your repository history or use the git rm
command before the .gitignore
changes will apply to them.
October 26, 2023
When working with TypeScript, certain files and directories are generated during the compilation and development process that you may not want to commit to your Git repository. This guide will outline the common items you'd typically want to exclude using a .gitignore
file.
Getting Started
First, make sure you're in the root directory of your TypeScript project. Then create a file named .gitignore
if it doesn't already exist.
touch .gitignore
You could ship faster.
Imagine the time you'd save if you never had to build another internal tool, write a SQL report, or manage another admin panel again. Basedash is built by internal tool builders, for internal tool builders. Our mission is to change the way developers work, so you can focus on building your product.
Common TypeScript Exclusions
Compilation Outputs
TypeScript compiles down to JavaScript, and by default, the compiled JavaScript files have the .js
extension and source maps have the .js.map
extension. If you're compiling TypeScript to a dedicated output directory (e.g., dist
or build
), you might want to exclude the entire directory. If not, you might want to exclude the individual files.
# If using a dedicated output directory: dist/ build/ # If not using a dedicated output directory: *.js *.js.map
Node Modules
If you're using npm or Yarn to manage your project's dependencies, you'll have a node_modules/
directory. This should always be excluded as it can contain thousands of files, and you don’t want those in your repo.
node_modules/
IDE and Editor Configurations
Many IDEs and editors create configuration and cache files that are specific to a user's environment. Examples include .vscode/
for Visual Studio Code and .idea/
for JetBrains IDEs.
.vscode/ .idea/
Environment Configuration
Files that contain secrets, API keys, or database connection info (commonly .env
files or other configuration files) should never be committed to a public repository.
.env .env.local .env.*.local
TypeScript Cache
TypeScript might generate cache files when using project references or when incremental compilation is enabled.
*.tsbuildinfo
Other Common Exclusions
Other files and directories that are commonly excluded in many JavaScript and TypeScript projects include:
# Log files *.log # Runtime data pids *.pid *.seed *.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage # nyc test coverage .nyc_output # Grunt intermediate storage (<https://gruntjs.com/creating-plugins#storing-task-files>) .grunt # Bower dependency directory (<https://bower.io/>) bower_components # Dependency directory # Commenting this out is preferred by some developers, npm can # handle it properly when it's symlinked (npm v3+) # node_modules/ # TSD Debug info tsd-debug.log
Wrapping Up
Once you've configured your .gitignore
based on your needs, simply save and close the file. Git will now respect these exclusions for all future commits. Remember, if you've previously committed unwanted files, you'll need to remove them from your repository history or use the git rm
command before the .gitignore
changes will apply to them.
What is Basedash?
What is Basedash?
What is Basedash?
Ship faster, worry less with Basedash
Ship faster, worry less with Basedash
You're busy enough with product work to be weighed down building, maintaining, scoping and developing internal apps and admin panels. Forget all of that, and give your team the admin panel that you don't have to build. Launch in less time than it takes to run a standup.
You're busy enough with product work to be weighed down building, maintaining, scoping and developing internal apps and admin panels. Forget all of that, and give your team the admin panel that you don't have to build. Launch in less time than it takes to run a standup.
You're busy enough with product work to be weighed down building, maintaining, scoping and developing internal apps and admin panels. Forget all of that, and give your team the admin panel that you don't have to build. Launch in less time than it takes to run a standup.
Dashboards and charts
Edit data, create records, oversee how your product is running without the need to build or manage custom software.
USER CRM
ADMIN PANEL
SQL COMPOSER WITH AI
Related posts
Related posts
Related posts
How to turn webpages into editable canvases with a JavaScript bookmarklet
Kris Lachance
How to fix the "not all code paths return a value" issue in TypeScript
Kris Lachance
Working with WebSockets in Node.js using TypeScript
Kris Lachance
Type Annotations Can Only Be Used in TypeScript Files
Kris Lachance
Guide to TypeScript Recursive Type
Kris Lachance
How to Configure Knex.js with TypeScript
Kris Lachance