Description:
When pruning orphaned outputs, empty directories left behind by deleted markdown files are not removed on Windows because of a path separator mismatch during path-prefix matching.
Steps to reproduce
- On Windows, run the vitest suite for
packages/leadtype/src/convert/convert.test.ts.
- Notice that the test
convertAllMdx > prune removes directories emptied by deletions but keeps non-md files fails.
- Empty directories are left behind in the build output on Windows.
Cause
In packages/leadtype/src/convert/convert.ts, the directory sweep checks if a parent directory is inside outDir using:
const resolvedOutDir = resolve(outDir); // yields backslashes on Windows
// ...
while (dir !== resolvedOutDir && dir.startsWith(resolvedOutDir + sep)) {
Description:
When pruning orphaned outputs, empty directories left behind by deleted markdown files are not removed on Windows because of a path separator mismatch during path-prefix matching.
Steps to reproduce
packages/leadtype/src/convert/convert.test.ts.convertAllMdx > prune removes directories emptied by deletions but keeps non-md filesfails.Cause
In packages/leadtype/src/convert/convert.ts, the directory sweep checks if a parent directory is inside
outDirusing: