egoist / egoist/tsup

Consider not following symlinks during `clean`

Open
#1,149 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.