Move feature flag config files to Woocommerce plugin to support unit test execution in the wp-env environment.

This commit is contained in:
Paul Sealock 2022-04-06 14:08:04 +12:00
parent 73409592b7
commit 407b225133
5 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@
"build": "pnpm run build:feature-config && cross-env NODE_ENV=production webpack",
"analyze": "cross-env NODE_ENV=production ANALYZE=true webpack",
"postbuild": "pnpm run -s i18n:pot && pnpm run -s i18n:build",
"build:feature-config": "php bin/generate-feature-config.php",
"build:feature-config": "php ../woocommerce/bin/generate-feature-config.php",
"build:packages": "cross-env NODE_ENV=production pnpm run:packages -- build",
"build:release": "./bin/build-plugin-zip.sh",
"clean": "rimraf ./dist && pnpm run:packages -- clean --parallel",

View File

@ -17,7 +17,7 @@ $phase = getenv( 'WC_ADMIN_PHASE' );
if ( ! in_array( $phase, array( 'development', 'plugin', 'core' ), true ) ) {
$phase = 'plugin'; // Default to plugin when running `pnpm run build`.
}
$config_json = file_get_contents( __DIR__ . '/../config/' . $phase . '.json' );
$config_json = file_get_contents( __DIR__ . '/../client/admin/config/' . $phase . '.json' );
$config = json_decode( $config_json );
$write = "<?php\n";
@ -33,7 +33,7 @@ $write .= "\t\t);\n";
$write .= "\t}\n";
$write .= "}\n";
$config_file = fopen( __DIR__ . '/../../woocommerce/includes/react-admin/feature-config.php', 'w' );
$config_file = fopen( __DIR__ . '/../includes/react-admin/feature-config.php', 'w' );
fwrite( $config_file, $write );
fclose( $config_file );