JoshuaKGoldberg / JoshuaKGoldberg/create-typescript-app

🐛 Bug: Migration mode should not clobber `.gitignore`

Open
#1,354 1 comment 1 reaction 0 assignees View on GitHub
status: accepting prs type: bug
Dominant language
TypeScript
Stars
1.4k
Forks
89
Avg merge
1m
Merged PRs (30d)
3

Description

### Bug Report Checklist

- [X] I have tried restarting my IDE and the issue persists.
- [X] I have pulled the latest `main` branch of the repository.
- [X] I have [searched for related issues](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aissue) and found none that matched my issue.

### Expected

For an existing project, the `.gitignore` file has probably accumulated lots of stuff that should be ignored.

I expected the migration script to add to `.gitignore` or adjust it, not to completely clobber it.

### Actual

Running `npx create-typescript-app` completely clobbers the `.gitignore` file, replacing it with a two-liner.

### Additional Info

I wound up with lots of previously-untracked files added to my repo after running the migrate script over at https://github.com/danvk/literate-ts/pull/246

For example: I was ignoring the `coverage` directory, which contained HTML reports of code coverage that I would periodically generate. After migration, git wanted to track this.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the migration path invoked by `npx create-typescript-app` and inspect how it handles the existing `.gitignore`. The fix is done when migration preserves existing ignore entries while applying its required changes, including keeping directories such as `coverage` ignored.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.