Skip to content

Commit 301caab

Browse files
PKuhlmayclaude
andauthored
[TASK] Fix #658: Generate user.tsconfig for backend module extensions (#819)
In TYPO3 v13, extensions can place User-TSConfig in Configuration/user.tsconfig for automatic loading (Feature #101807), replacing the deprecated addUserTSConfig(). - Add generateUserTsConfig() to FileGenerator - Add Configuration/user.tsconfigt template generating a module.{key} block per backend module as a starting point for developers - Generation is skipped when the extension has no backend modules Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ef2eb4d commit 301caab

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

Classes/Service/FileGenerator.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ public function build(Extension $extension): void
172172

173173
$this->generatePageTsConfig();
174174

175+
$this->generateUserTsConfig();
176+
175177
$this->generateServicesYaml();
176178

177179
$this->generateBackendModuleFiles();
@@ -289,6 +291,25 @@ protected function generatePageTsConfig(): void
289291
// when using PLUGIN_TYPE_CONTENT_ELEMENT, so no page.tsconfig generation is needed.
290292
}
291293

294+
/**
295+
* @throws Exception
296+
*/
297+
protected function generateUserTsConfig(): void
298+
{
299+
if (!$this->extension->hasBackendModules()) {
300+
return;
301+
}
302+
try {
303+
$fileContents = $this->renderTemplate(
304+
'Configuration/user.tsconfigt',
305+
['extension' => $this->extension]
306+
);
307+
$this->writeFile($this->configurationDirectory . 'user.tsconfig', $fileContents);
308+
} catch (Exception $e) {
309+
throw new Exception('Could not write Configuration/user.tsconfig. Error: ' . $e->getMessage());
310+
}
311+
}
312+
292313
/**
293314
* @throws Exception
294315
*/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{namespace k=EBT\ExtensionBuilder\ViewHelpers}<f:for each="{extension.BackendModules}" as="backendModule">module.{extension.extensionKey}_{backendModule.key} {
2+
}
3+
</f:for>

0 commit comments

Comments
 (0)