Skip to content

Directory pruning fails to clean up empty folders on Windows #146

Description

@Adityakk9031

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

  1. On Windows, run the vitest suite for packages/leadtype/src/convert/convert.test.ts.
  2. Notice that the test convertAllMdx > prune removes directories emptied by deletions but keeps non-md files fails.
  3. 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)) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions