Proxy File Suffix
By default each generated file is named after the type it represents, or after its C# source file when
CratisProxiesUseSourceFileAsOutputFile is on:
Features/Authors/RegisterAuthor.tsFeatures/Authors/AllAuthors.tsSet CratisProxiesUseProxyFileSuffix to name them Name.proxy.ts instead:
<PropertyGroup> <CratisProxiesUseProxyFileSuffix>true</CratisProxiesUseProxyFileSuffix></PropertyGroup>Features/Authors/RegisterAuthor.proxy.tsFeatures/Authors/AllAuthors.proxy.tsUse it when generated proxies share folders with hand-written TypeScript: the suffix tells the two apart at a
glance, and lets tooling - lint rules, code owners, coverage exclusions - match generated files with a single
*.proxy.ts pattern.
What changes with it
Section titled “What changes with it”- File names. Every generated file carries the suffix, including combined files named after a C# source file.
- Imports between generated files. A generated file imports another as
./RegisterAuthor.proxy. Types mapped to a module of your own through a type mapping or a package mapping are imported exactly as mapped, never suffixed. - Barrels. Generated
index.tsfiles export the suffixed names, as inexport * from './RegisterAuthor.proxy';, so imports through a folder barrel keep working unchanged.
Code that imports a generated file directly by path must use the suffixed name once the option is on.
Switching an existing project
Section titled “Switching an existing project”Turning the option on - or off - in a project that already has generated files replaces them: the next build writes
the new names and removes the previously generated ones, like any other generated file that is no longer produced.
With the default incremental output, the switch removes only files the generator produced. The suffix does not protect handwritten files from the generator’s other cleanup: full regeneration deletes the whole output directory, and orphan-directory cleanup can remove an index.ts.