Skip to content

Commit

Permalink
Changes to follow SF bundle best practices
Browse files Browse the repository at this point in the history
  • Loading branch information
maelanleborgne committed Nov 9, 2023
1 parent 93de626 commit 1fe8054
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sensiolabs/typescript-bundle",
"description": "TypeScript support for Symfony + AssetMapper",
"license": "MIT",
"type": "library",
"type": "symfony-bundle",
"keywords": ["asset-mapper", "typescript"],
"authors": [
{
Expand Down
16 changes: 8 additions & 8 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,35 @@

return static function (ContainerConfigurator $container) {
$container->services()
->set('typescript.builder', TypeScriptBuilder::class)
->set('sensiolabs_typescript.builder', TypeScriptBuilder::class)
->args([
abstract_arg('path to typescript files'),
abstract_arg('path to compiled directory'),
param('kernel.project_dir'),
abstract_arg('path to the swc binary'),
])
->set('typescript.command.build', TypeScriptBuildCommand::class)
->set('sensiolabs_typescript.command.build', TypeScriptBuildCommand::class)
->args([
service('typescript.builder')
service('sensiolabs_typescript.builder')
])
->tag('console.command')
->set('typescript.js_asset_compiler', TypeScriptCompiler::class)
->set('sensiolabs_typescript.js_asset_compiler', TypeScriptCompiler::class)
->tag('asset_mapper.compiler', [
// A priority needs to be set to ensure that the TypeScript compiler is called before the JavaScript compiler
'priority' => 10
])
->args([
abstract_arg('path to typescript source dir'),
abstract_arg('path to typescript output directory'),
service('typescript.builder'),
service('sensiolabs_typescript.builder'),
])
->set('typescript.public_asset_path_resolver', TypeScriptPublicPathAssetPathResolver::class)
->set('sensiolabs_typescript.public_asset_path_resolver', TypeScriptPublicPathAssetPathResolver::class)
->decorate('asset_mapper.public_assets_path_resolver')
->args([
service('.inner')
])
->set('typescript.pre_assets_compile_listener', PreAssetsCompileListener::class)
->args([service('typescript.builder')])
->set('sensiolabs_typescript.pre_assets_compile_listener', PreAssetsCompileListener::class)
->args([service('sensiolabs_typescript.builder')])
->tag('kernel.event_listener', [
'event' => PreAssetsCompileEvent::class,
'method' => '__invoke'
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/SensiolabsTypeScriptExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public function load(array $configs, ContainerBuilder $container): void
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);

$container->findDefinition('typescript.builder')
$container->findDefinition('sensiolabs_typescript.builder')
->replaceArgument(0, $config['source_dir'])
->replaceArgument(1, '%kernel.project_dir%/var/typescript')
->replaceArgument(3, $config['binary']);

$container->findDefinition('typescript.js_asset_compiler')
$container->findDefinition('sensiolabs_typescript.js_asset_compiler')
->replaceArgument(0, $config['source_dir'])
->replaceArgument(1, '%kernel.project_dir%/var/typescript')
->replaceArgument(2, '%kernel.project_dir%');
Expand Down

0 comments on commit 1fe8054

Please sign in to comment.