Merge pull request #32500 from woocommerce/fix/feature-config-file-location
Move feature flag config files to Woocommerce plugin
This commit is contained in:
commit
1e3a3d8af5
|
@ -69,7 +69,7 @@ jobs:
|
|||
|
||||
- name: Build Admin feature config
|
||||
working-directory: ./
|
||||
run: pnpm nx build:feature-config woocommerce-admin
|
||||
run: pnpm nx build:feature-config woocommerce
|
||||
|
||||
- name: Add PHP8 Compatibility.
|
||||
run: |
|
||||
|
|
|
@ -61,7 +61,7 @@ jobs:
|
|||
- name: Build Admin feature config
|
||||
working-directory: ./
|
||||
run: |
|
||||
pnpm nx build:feature-config woocommerce-admin
|
||||
pnpm nx build:feature-config woocommerce
|
||||
|
||||
- name: Init DB and WP
|
||||
run: pnpm nx install-unit-test-db woocommerce
|
||||
|
|
|
@ -69,7 +69,7 @@ jobs:
|
|||
- name: Build Admin feature config
|
||||
working-directory: ./
|
||||
run: |
|
||||
pnpm nx build:feature-config woocommerce-admin
|
||||
pnpm nx build:feature-config woocommerce
|
||||
|
||||
- name: Add PHP8 Compatibility.
|
||||
run: |
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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 );
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Move feature flag config files to Woocommerce plugin to support unit test execution in the wp-env environment.
|
|
@ -14,7 +14,8 @@
|
|||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"build": "./bin/build-zip.sh",
|
||||
"build:core": "pnpm nx build woocommerce-admin && pnpm nx build woocommerce-legacy-assets && pnpm run makepot",
|
||||
"build:feature-config": "php bin/generate-feature-config.php",
|
||||
"build:core": "pnpm run build:feature-config && pnpm nx build woocommerce-admin && pnpm nx build woocommerce-legacy-assets && pnpm run makepot",
|
||||
"build:zip": "pnpm run build",
|
||||
"lint:js": "eslint assets/js --ext=js",
|
||||
"docker:down": "pnpx wc-e2e docker:down",
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
"executor": "@nrwl/workspace:run-commands",
|
||||
"options": {
|
||||
"commands": [
|
||||
"pnpm nx build:feature-config woocommerce-admin",
|
||||
"pnpm nx build:feature-config woocommerce",
|
||||
"pnpm nx watch-assets woocommerce"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -259,7 +259,7 @@ class WC_Unit_Tests_Bootstrap {
|
|||
* @return array Filtered feature flags.
|
||||
*/
|
||||
public function add_development_features( $flags ) {
|
||||
$config = json_decode( file_get_contents( $this->plugin_dir . '/../woocommerce-admin/config/development.json' ) ); // @codingStandardsIgnoreLine.
|
||||
$config = json_decode( file_get_contents( $this->plugin_dir . '/client/admin/config/development.json' ) ); // @codingStandardsIgnoreLine.
|
||||
foreach ( $config->features as $feature => $bool ) {
|
||||
$flags[ $feature ] = $bool;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue