Consider not following symlinks during `clean`
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
When `clean: true`, we basically glob `**/*` with our `cwd` set to `dist`.
If for whatever reason you have a symlink inside your `dist` directory, we currently follow it and remove whatever is on the other end.
In particular, anyone moving from `tshy` to `tsup` will hit this as tshy creates symlinks to your project directory in `dist/`. this means the first time you build using tsup, after previously using tshy, tsup removes itself (as it removes `node_modules` and everything else).
we should probably just remove the link rather than following it
Contributor guide
Research direction
Start by locating the implementation of `clean: true` and the glob over `dist`; reproduce the issue with a symlink inside the output directory, especially one created by tshy. Confirm that cleanup removes the symlink itself without traversing its target, then run the existing cleanup or build tests if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100