Skip to content

feat(move-file): handle empty source project after move #337

@LayZeeDK

Description

@LayZeeDK

Summary

When the move-file generator moves the last exported file from a source project, the source project's index file can become empty or have only an empty export. The generator should handle this case by ensuring the source project has a valid TypeScript module even when empty.

Current Behavior

After moving the last/only exported file from a source project:

  • The source project's index.ts may be left empty or invalid
  • This can cause TypeScript compilation errors
  • Build tools may fail on the now-empty project

Proposed Behavior

When a move operation leaves the source project with no remaining exports:

  1. Write export {} to the source project's entry point (index.ts)
  2. This creates a valid TypeScript module even when empty
  3. Prevents compilation/build errors

Example

Before move:

// lib-a/src/index.ts
export * from './lib/util';

After moving lib/util.ts to lib-b:

// lib-a/src/index.ts
export {};

Context

Discovered during implementation of e2e test scenarios in #333. The MOVE-SMALL scenario moves a file between libraries and exposes this edge case.

Acceptance Criteria

  • Generator detects when source project has no remaining exports
  • Generator writes export {} to source project's entry point
  • Source project remains valid TypeScript module
  • Builds succeed for both source and target projects
  • Add test case for this scenario

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions