Skip to content

Infer package workspace source globs for import graphs #33

Description

@Gabriel-Darbord

Current behavior:
typescript.importGraph defaults to src/**/*.ts. In TypeScript monorepos where package sources live under workspace folders such as packages/*/src, the default call can analyze zero files even though the project has TypeScript source files.

Minimal reproduction:

  1. Create a TypeScript workspace with files under packages/example/src/index.ts and no root src directory.
  2. Run typescript.importGraph without an explicit include argument.

Observed behavior:
No source files are analyzed because the default include pattern does not match the workspace layout.

Expected behavior:
The tool either infers source globs from package workspaces or tsconfig includes, or reports that the default include matched nothing with a concrete suggested include.

Proposed fix:
When include is omitted, derive candidate source globs from package.json workspaces and tsconfig include paths before falling back to src/**/*.ts. If no files match, return a compact diagnostic with suggested include patterns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No 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