From 1fe80548aefc74a76fcd5cbac20ba21d137f3283 Mon Sep 17 00:00:00 2001 From: Maelan LE BORGNE Date: Thu, 9 Nov 2023 10:02:58 +0100 Subject: [PATCH] Changes to follow SF bundle best practices --- composer.json | 2 +- config/services.php | 16 ++++++++-------- .../SensiolabsTypeScriptExtension.php | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 2827bdd..e8a5d31 100644 --- a/composer.json +++ b/composer.json @@ -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": [ { diff --git a/config/services.php b/config/services.php index 03ca7c5..73cd6c9 100644 --- a/config/services.php +++ b/config/services.php @@ -13,19 +13,19 @@ 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 @@ -33,15 +33,15 @@ ->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' diff --git a/src/DependencyInjection/SensiolabsTypeScriptExtension.php b/src/DependencyInjection/SensiolabsTypeScriptExtension.php index 1ec07d7..9a461b9 100644 --- a/src/DependencyInjection/SensiolabsTypeScriptExtension.php +++ b/src/DependencyInjection/SensiolabsTypeScriptExtension.php @@ -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%');