Remove unnecessary package version reading of @wordpress/components (https://github.com/woocommerce/woocommerce-blocks/pull/1154)
* remove unnecessary package version reading of @wordpress/components * comment out unused variable
This commit is contained in:
parent
8fe23415ba
commit
0ee090d16d
|
@ -75,26 +75,17 @@ class Bootstrap {
|
||||||
$this->container->register(
|
$this->container->register(
|
||||||
AssetDataRegistry::class,
|
AssetDataRegistry::class,
|
||||||
function( Container $container ) {
|
function( Container $container ) {
|
||||||
$asset_api = $container->get( AssetApi::class );
|
$asset_api = $container->get( AssetApi::class );
|
||||||
$js_package = \json_decode(
|
// phpcs:disable Squiz . PHP . CommentedOutCode . Found
|
||||||
// phpcs:disable WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
// @todo: this needs added back in once the @woocommerce/components
|
||||||
\file_get_contents(
|
// package has been updated.
|
||||||
$this->package->get_path( 'package.json' )
|
// $load_back_compat = defined( 'WC_ADMIN_VERSION_NUMBER' )
|
||||||
),
|
// && version_compare( WC_ADMIN_VERSION_NUMBER, '0.19.0', '<=' );
|
||||||
true
|
// return $load_back_compat
|
||||||
);
|
// ? new BackCompatAssetDataRegistry( $asset_api )
|
||||||
$woocommerce_components_version =
|
// : new AssetDataRegistry( $asset_api );
|
||||||
isset( $js_package['dependencies']['@woocommerce/components'] )
|
// phpcs:enable
|
||||||
? $js_package['dependencies']['@woocommerce/components']
|
return new BackCompatAssetDataRegistry( $asset_api );
|
||||||
: 0;
|
|
||||||
$load_back_compat = '3.2.0' === $woocommerce_components_version
|
|
||||||
|| (
|
|
||||||
defined( 'WC_ADMIN_VERSION_NUMBER' )
|
|
||||||
&& version_compare( WC_ADMIN_VERSION_NUMBER, '0.19.0', '<=' )
|
|
||||||
);
|
|
||||||
return $load_back_compat
|
|
||||||
? new BackCompatAssetDataRegistry( $asset_api )
|
|
||||||
: new AssetDataRegistry( $asset_api );
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue