Build: Fix production script asset names (https://github.com/woocommerce/woocommerce-admin/pull/6681)
* Avoid suffix on production build assets filenames * check minification feature to determin filename * changelog * changelog typo
This commit is contained in:
parent
6296952949
commit
a2996ff820
|
@ -146,6 +146,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
|
||||||
- Fix: Show management links when the task list is complete (even if its not hidden). #6657
|
- Fix: Show management links when the task list is complete (even if its not hidden). #6657
|
||||||
- Fix: Adding New Zealand and Ireland to selective bundle option, previously missed. #6649
|
- Fix: Adding New Zealand and Ireland to selective bundle option, previously missed. #6649
|
||||||
- Fix: Update the Mercado option used for enabling/disabling. #6677
|
- Fix: Update the Mercado option used for enabling/disabling. #6677
|
||||||
|
- Dev: Ensure production script asset names don't include .min suffix #6681
|
||||||
- Fix: Improve AddFirstProduct email note contents. #6617
|
- Fix: Improve AddFirstProduct email note contents. #6617
|
||||||
|
|
||||||
== 2.1.3 3/14/2021 ==
|
== 2.1.3 3/14/2021 ==
|
||||||
|
|
|
@ -128,7 +128,8 @@ class Coupons {
|
||||||
Loader::get_file_version( 'css' )
|
Loader::get_file_version( 'css' )
|
||||||
);
|
);
|
||||||
|
|
||||||
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/marketing-coupons.min.asset.php';
|
$script_assets_filename = Loader::get_script_asset_filename( 'marketing-coupons' );
|
||||||
|
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/' . $script_assets_filename;
|
||||||
|
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'wc-admin-marketing-coupons',
|
'wc-admin-marketing-coupons',
|
||||||
|
|
|
@ -150,7 +150,8 @@ class Init {
|
||||||
Loader::get_file_version( 'css' )
|
Loader::get_file_version( 'css' )
|
||||||
);
|
);
|
||||||
|
|
||||||
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/navigation-opt-out.min.asset.php';
|
$script_assets_filename = Loader::get_script_asset_filename( 'navigation-opt-out' );
|
||||||
|
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/' . $script_assets_filename;
|
||||||
|
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'wc-admin-navigation-opt-out',
|
'wc-admin-navigation-opt-out',
|
||||||
|
|
|
@ -263,7 +263,8 @@ class OnboardingTasks {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/onboarding-product-notice.min.asset.php';
|
$script_assets_filename = Loader::get_script_asset_filename( 'onboarding-product-notice' );
|
||||||
|
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/' . $script_assets_filename;
|
||||||
|
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'onboarding-product-notice',
|
'onboarding-product-notice',
|
||||||
|
@ -282,7 +283,8 @@ class OnboardingTasks {
|
||||||
public static function add_onboarding_homepage_notice_admin_script( $hook ) {
|
public static function add_onboarding_homepage_notice_admin_script( $hook ) {
|
||||||
global $post;
|
global $post;
|
||||||
if ( 'post.php' === $hook && 'page' === $post->post_type && isset( $_GET[ self::ACTIVE_TASK_TRANSIENT ] ) && 'homepage' === $_GET[ self::ACTIVE_TASK_TRANSIENT ] ) { // phpcs:ignore csrf ok.
|
if ( 'post.php' === $hook && 'page' === $post->post_type && isset( $_GET[ self::ACTIVE_TASK_TRANSIENT ] ) && 'homepage' === $_GET[ self::ACTIVE_TASK_TRANSIENT ] ) { // phpcs:ignore csrf ok.
|
||||||
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/onboarding-homepage-notice.min.asset.php';
|
$script_assets_filename = Loader::get_script_asset_filename( 'onboarding-homepage-notice' );
|
||||||
|
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/' . $script_assets_filename;
|
||||||
|
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'onboarding-homepage-notice',
|
'onboarding-homepage-notice',
|
||||||
|
@ -307,7 +309,8 @@ class OnboardingTasks {
|
||||||
'tax' === self::get_active_task() &&
|
'tax' === self::get_active_task() &&
|
||||||
! self::is_active_task_complete()
|
! self::is_active_task_complete()
|
||||||
) {
|
) {
|
||||||
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/onboarding-tax-notice.min.asset.php';
|
$script_assets_filename = Loader::get_script_asset_filename( 'onboarding-tax-notice' );
|
||||||
|
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/' . $script_assets_filename;
|
||||||
|
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'onboarding-tax-notice',
|
'onboarding-tax-notice',
|
||||||
|
@ -329,7 +332,8 @@ class OnboardingTasks {
|
||||||
if ( 'product_page_product_importer' === $hook && 'done' === $step && 'product-import' === self::get_active_task() ) {
|
if ( 'product_page_product_importer' === $hook && 'done' === $step && 'product-import' === self::get_active_task() ) {
|
||||||
delete_transient( self::ACTIVE_TASK_TRANSIENT );
|
delete_transient( self::ACTIVE_TASK_TRANSIENT );
|
||||||
|
|
||||||
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/onboarding-product-import-notice.min.asset.php';
|
$script_assets_filename = Loader::get_script_asset_filename( 'onboarding-product-import-notice' );
|
||||||
|
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/' . $script_assets_filename;
|
||||||
|
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'onboarding-product-import-notice',
|
'onboarding-product-import-notice',
|
||||||
|
|
|
@ -151,7 +151,8 @@ class ShippingLabelBanner {
|
||||||
Loader::get_file_version( 'css' )
|
Loader::get_file_version( 'css' )
|
||||||
);
|
);
|
||||||
|
|
||||||
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/print-shipping-label-banner.min.asset.php';
|
$script_assets_filename = Loader::get_script_asset_filename( 'print-shipping-label-banner' );
|
||||||
|
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/' . $script_assets_filename;
|
||||||
|
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'print-shipping-label-banner',
|
'print-shipping-label-banner',
|
||||||
|
|
|
@ -243,6 +243,18 @@ class Loader {
|
||||||
return plugins_url( self::get_path( $ext ) . $file . $suffix . '.' . $ext, WC_ADMIN_PLUGIN_FILE );
|
return plugins_url( self::get_path( $ext ) . $file . $suffix . '.' . $ext, WC_ADMIN_PLUGIN_FILE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a script asset filename
|
||||||
|
*
|
||||||
|
* @param string $file File name (without extension).
|
||||||
|
* @return string complete asset filename.
|
||||||
|
*/
|
||||||
|
public static function get_script_asset_filename( $file ) {
|
||||||
|
$minification_suffix = Features::exists( 'minified-js' ) ? '.min' : '';
|
||||||
|
|
||||||
|
return $file . $minification_suffix . '.asset.php';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the file modified time as a cache buster if we're in dev mode, or the plugin version otherwise.
|
* Gets the file modified time as a cache buster if we're in dev mode, or the plugin version otherwise.
|
||||||
*
|
*
|
||||||
|
@ -355,8 +367,9 @@ class Loader {
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ( $scripts as $script ) {
|
foreach ( $scripts as $script ) {
|
||||||
$script_path_name = isset( $scripts_map[ $script ] ) ? $scripts_map[ $script ] : str_replace( 'wc-', '', $script );
|
$script_path_name = isset( $scripts_map[ $script ] ) ? $scripts_map[ $script ] : str_replace( 'wc-', '', $script );
|
||||||
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . $script_path_name . '/index.min.asset.php';
|
$script_assets_filename = self::get_script_asset_filename( 'index' );
|
||||||
|
$script_assets = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . $script_path_name . '/' . $script_assets_filename;
|
||||||
|
|
||||||
wp_register_script(
|
wp_register_script(
|
||||||
$script,
|
$script,
|
||||||
|
|
Loading…
Reference in New Issue