Summary
scripts/extract-ts-types.mjs hardcodes the output project directory as SimpleModule.${moduleName}:
const projectDir = `SimpleModule.${moduleName}`;
const outPath = resolve(modulesDir, moduleName, 'src', projectDir, 'types.ts');
mkdirSync(resolve(modulesDir, moduleName, 'src', projectDir), { recursive: true });
But sm new module <Name> creates projects named <Name> and <Name>.Contracts, not SimpleModule.<Name>. The namespace is SimpleModule.<Name>; the directory is not.
Reproduction
sm new project MyApp && cd MyApp
sm new module Invoicing
npm run generate:types
Result
src/modules/Invoicing/src/Invoicing/ # the real project (Invoicing.csproj)
src/modules/Invoicing/src/Invoicing.Contracts/ # the real contracts project
src/modules/Invoicing/src/SimpleModule.Invoicing/types.ts # created by the script, nothing else in it
The generated types land in a sibling directory that contains only types.ts and belongs to no project.
Why it matters
- A module's own
.tsx files cannot import the types by any path the module actually uses; they have to reach sideways into a directory with no project, no tsconfig.json and no package.json.
- The directory matches the root
workspaces glob src/modules/*/src/* while containing no package.json.
- Deleting a module leaves it behind. After removing the scaffold's sample
Items module (deleting src/modules/Items entirely), the next generate:types recreated src/modules/Items/src/SimpleModule.Items/types.ts from the still-present generated .g.cs, resurrecting a directory tree for a module that no longer exists.
Suggested fix
Write to the module's actual project directory — <modulesDir>/<moduleName>/src/<moduleName>/types.ts — so the types sit next to the Pages/ they are meant to type, and are covered by that project's existing tsconfig.json.
If the SimpleModule. prefix is intentional for some layouts, resolve the directory by looking for the project that exists rather than assuming the name.
Environment
SimpleModule.Cli 0.0.39, packages 0.0.39
- .NET SDK 10.0.201, Node 23.5.0, macOS
Related: #283 (same script, emits for NuGet-installed modules).
Summary
scripts/extract-ts-types.mjshardcodes the output project directory asSimpleModule.${moduleName}:But
sm new module <Name>creates projects named<Name>and<Name>.Contracts, notSimpleModule.<Name>. The namespace isSimpleModule.<Name>; the directory is not.Reproduction
Result
The generated types land in a sibling directory that contains only
types.tsand belongs to no project.Why it matters
.tsxfiles cannot import the types by any path the module actually uses; they have to reach sideways into a directory with no project, notsconfig.jsonand nopackage.json.workspacesglobsrc/modules/*/src/*while containing nopackage.json.Itemsmodule (deletingsrc/modules/Itemsentirely), the nextgenerate:typesrecreatedsrc/modules/Items/src/SimpleModule.Items/types.tsfrom the still-present generated.g.cs, resurrecting a directory tree for a module that no longer exists.Suggested fix
Write to the module's actual project directory —
<modulesDir>/<moduleName>/src/<moduleName>/types.ts— so the types sit next to thePages/they are meant to type, and are covered by that project's existingtsconfig.json.If the
SimpleModule.prefix is intentional for some layouts, resolve the directory by looking for the project that exists rather than assuming the name.Environment
SimpleModule.Cli0.0.39, packages 0.0.39Related: #283 (same script, emits for NuGet-installed modules).