Summary
scripts/extract-ts-types.mjs iterates over every DtoTypeScript_*.g.cs the source generator emits and writes a types.ts for each. That set includes modules that arrived as NuGet packages, not as source in the consumer's repo — so the script creates source directories for modules the consumer does not own.
Reproduction
Scaffold a project, then install any packaged module:
sm new project MyApp && cd MyApp
sm install SimpleModule.Users # pulls SimpleModule.Settings too
npm run generate:types
Result
src/modules/Users/src/SimpleModule.Users/types.ts # module lives in a NuGet package
src/modules/Settings/src/SimpleModule.Settings/types.ts # ditto
Neither Users nor Settings has any source in the repo. Before generate:types ran, src/modules/ contained only the locally-created modules.
Why it matters
- Repo pollution. The consumer gets tracked source directories for code they do not own and cannot edit. Regenerating the types is the only thing that ever writes there.
- Collides with the npm workspaces glob. The root
package.json uses "workspaces": ["src/modules/*/src/*", ...]. These phantom directories match that glob. They contain no package.json so npm currently skips them, but the layout is one step away from breaking npm install.
- They get committed. Nothing in the generated
.gitignore excludes them, so they land in the consumer's history and show up in diffs whenever a packaged module's DTOs change.
- Stale entries are never removed. Deleting a module leaves its directory behind — see the companion issue.
Suggested fix
Only emit types for modules that have a corresponding project directory in <modulesDir>. Something like: skip the file when <modulesDir>/<moduleName> does not already exist, rather than mkdirSync(..., { recursive: true }) unconditionally.
Packaged modules could ship their types.ts inside the NuGet package (or under node_modules/obj) instead of being reconstructed in the consumer's source tree.
Environment
SimpleModule.Cli 0.0.39, packages 0.0.39
- .NET SDK 10.0.201, Node 23.5.0, macOS
Summary
scripts/extract-ts-types.mjsiterates over everyDtoTypeScript_*.g.csthe source generator emits and writes atypes.tsfor each. That set includes modules that arrived as NuGet packages, not as source in the consumer's repo — so the script creates source directories for modules the consumer does not own.Reproduction
Scaffold a project, then install any packaged module:
Result
Neither
UsersnorSettingshas any source in the repo. Beforegenerate:typesran,src/modules/contained only the locally-created modules.Why it matters
package.jsonuses"workspaces": ["src/modules/*/src/*", ...]. These phantom directories match that glob. They contain nopackage.jsonso npm currently skips them, but the layout is one step away from breakingnpm install..gitignoreexcludes them, so they land in the consumer's history and show up in diffs whenever a packaged module's DTOs change.Suggested fix
Only emit types for modules that have a corresponding project directory in
<modulesDir>. Something like: skip the file when<modulesDir>/<moduleName>does not already exist, rather thanmkdirSync(..., { recursive: true })unconditionally.Packaged modules could ship their
types.tsinside the NuGet package (or undernode_modules/obj) instead of being reconstructed in the consumer's source tree.Environment
SimpleModule.Cli0.0.39, packages 0.0.39