diff --git a/plugins/woocommerce-blocks/.env b/plugins/woocommerce-blocks/.env index f3fe9ba8961..53b93779bd9 100644 --- a/plugins/woocommerce-blocks/.env +++ b/plugins/woocommerce-blocks/.env @@ -12,5 +12,5 @@ WORDPRESS_TITLE=WooCommerce Core E2E Test Suite WORDPRESS_LOGIN=admin WORDPRESS_PASSWORD=password WORDPRESS_EMAIL=admin@woocommercecoree2etestsuite.com -WP_VERSION=5.4 -WOO_VERSION=5.3.0 +WP_VERSION=latest +WOO_VERSION=latest diff --git a/plugins/woocommerce-blocks/.github/patch-initial-checklist.md b/plugins/woocommerce-blocks/.github/patch-initial-checklist.md index 49ed2d36a8c..824b9261806 100644 --- a/plugins/woocommerce-blocks/.github/patch-initial-checklist.md +++ b/plugins/woocommerce-blocks/.github/patch-initial-checklist.md @@ -8,8 +8,6 @@ The release pull request has been created! This checklist is a guide to follow f * [ ] Add the version and date to the changelog section within `readme.txt`, e.g. `= {{version}} - YYYY-MM-DD =` * [ ] Copy the changelog from the pull request description above into this new section * [ ] Update compatibility sections (if applicable). __Note:__ Do not change the stable tag or plugin version; this is automated. - * [ ] Update _Requires at least_, _Tested up to_, and _Requires PHP_ sections at the top of `readme.txt`. - * [ ] Update _Requires at least_, _Requires PHP_, _WC requires at least_, and _WC tested up to_ at the top of `woocommerce-gutenberg-products-block.php` * [ ] Push above changes to the release branch. ## Write Testing Notes @@ -20,7 +18,7 @@ Additionally, make sure to differentiate between things in the testing notes tha * [ ] Run `npm ci` * [ ] Run `npm run package-plugin:deploy`. This will create a zip of the current branch build locally. -* [ ] Create testing notes for the release. You can usually go through the pull requests linked in the changelog and grab testing notes from each pull. +* [ ] Create testing notes for the release. You can usually go through the pull requests linked in the changelog and grab testing notes from each pull. * [ ] Add the notes to `docs/testing/releases` * [ ] Update the `docs/testing/releases/README.md` file index. * [ ] Copy a link to the release zip you created earlier into the testing notes. To generate the link you can upload the zip as an attachment in a GitHub comment and then just copy the path (without publishing the comment). diff --git a/plugins/woocommerce-blocks/.github/release-initial-checklist.md b/plugins/woocommerce-blocks/.github/release-initial-checklist.md index 19f098c4282..54732bf71bf 100644 --- a/plugins/woocommerce-blocks/.github/release-initial-checklist.md +++ b/plugins/woocommerce-blocks/.github/release-initial-checklist.md @@ -3,13 +3,14 @@ The release pull request has been created! This checklist is a guide to follow f * [ ] Checkout the release branch locally. ## Initial Preparation - * [ ] Add the changelog to `readme.txt` * [ ] Add the version and date to the changelog section within `readme.txt`, e.g. `= {{version}} - YYYY-MM-DD =` * [ ] Copy the changelog from the pull request description above into this new section * [ ] Update compatibility sections (if applicable). __Note:__ Do not change the stable tag or plugin version; this is automated. - * [ ] Update _Requires at least_, _Tested up to_, and _Requires PHP_ sections at the top of `readme.txt`. - * [ ] Update _Requires at least_, _Requires PHP_, _WC requires at least_, and _WC tested up to_ at the top of `woocommerce-gutenberg-products-block.php` + * [ ] Update _Requires at least_, _Tested up to_, and _Requires PHP_ sections at the top of `readme.txt`. Note, this should also be the latest WordPress version available at time of release. + * [ ] Update _Requires at least_, _Requires PHP_, _WC requires at least_, and _WC tested up to_ at the top of `woocommerce-gutenberg-products-block.php`. Note, this should include requiring the latest WP and WC versions at the time of the plugin release. + * [ ] If necessary, update the value of `$minimum_wp_version` at the top of the `woocommerce-gutenberg-products-block.php` file to the latest available version of WordPress. + * [ ] If necessary, update the `phpcs.xml` file to reference the minimum WP version supported by **WooCommerce Core**. It would be this line: ``. * [ ] Push above changes to the release branch. ## Write Testing Notes @@ -21,7 +22,7 @@ Additionally, make sure to differentiate between things in the testing notes tha * [ ] Run `npm ci` * [ ] Run `npm run package-plugin:deploy`. This will create a zip of the current branch build locally. * Note: The zip file is functionally equivalent to what gets released except the version bump. -* [ ] Create testing notes for the release. You can usually go through the pull requests linked in the changelog and grab testing notes from each pull. +* [ ] Create testing notes for the release. You can usually go through the pull requests linked in the changelog and grab testing notes from each pull. * [ ] Add the notes to `docs/testing/releases` * [ ] Update the `docs/testing/releases/README.md` file index. * [ ] Copy a link to the release zip you created earlier into the testing notes. To generate the link you can upload the zip as an attachment in a GitHub comment and then just copy the path (without publishing the comment). @@ -52,7 +53,7 @@ Additionally, make sure to differentiate between things in the testing notes tha * [ ] Execute `npm run deploy` * The script will ask you to enter the version number to tag. Please enter the version we're releasing right now. Do not publish any dev tags as a release. * Note: the script automatically updates version numbers on Github (commits on your behalf). - * **ALERT**: This script will ask you if this release will be deployed to WordPress.org. You should answer yes for this release even if it is a pre-release. + * **ALERT**: This script will ask you if this release will be deployed to WordPress.org. You should answer yes for this release even if it is a pre-release. * A GitHub release will automatically be created and this will trigger a workflow that automatically deploys the plugin to WordPress.org. * [ ] Edit the [GitHub release](https://github.com/woocommerce/woocommerce-gutenberg-products-block/releases) and copy changelog into the release notes. Ensure there is a release with the correct version, the one you entered above. * [ ] The `#team-rubik` slack instance will be notified about the progress with the WordPress.org deploy. Watch for that. If anything goes wrong, an error will be reported and you can followup via the GitHub actions tab and the log for that workflow. diff --git a/plugins/woocommerce-blocks/.github/workflows/php-js-e2e-tests.yml b/plugins/woocommerce-blocks/.github/workflows/php-js-e2e-tests.yml index 1bc74bfc2a5..59d122c0fe3 100644 --- a/plugins/woocommerce-blocks/.github/workflows/php-js-e2e-tests.yml +++ b/plugins/woocommerce-blocks/.github/workflows/php-js-e2e-tests.yml @@ -58,8 +58,8 @@ jobs: run: | composer install - JSE2ETestsWP57Gutenberg: - name: JavaScipt E2E Tests (WP 5.7 with Gutenberg plugin) + JSE2EWithGutenberg: + name: JavaScript E2E Tests (WP latest with Gutenberg plugin) needs: Setup runs-on: ubuntu-latest steps: @@ -113,10 +113,9 @@ jobs: run: | composer install - - name: E2E Tests (WP 5.7 with Gutenberg plugin) + - name: E2E Tests (WP latest with Gutenberg plugin) env: WOOCOMMERCE_BLOCKS_PHASE: 3 - WP_VERSION: 5.7-branch run: | chmod -R 767 ./ #needed for permissions issues JSON='{"plugins": ["https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip","https://github.com/WP-API/Basic-Auth/archive/master.zip","https://downloads.wordpress.org/plugin/gutenberg.latest-stable.zip", "."] }' @@ -125,8 +124,8 @@ jobs: npm run wp-env clean all npm run test:e2e - JSE2ETestsWP57: - name: JavaScipt E2E Tests (WP 5.7) + JSE2ETests: + name: JavaScript E2E Tests (latest) needs: Setup runs-on: ubuntu-latest steps: @@ -180,143 +179,10 @@ jobs: run: | composer install - - name: E2E Tests (WP 5.7) + - name: E2E Tests (WP latest) env: WOOCOMMERCE_BLOCKS_PHASE: 3 - WP_VERSION: 5.7-branch run: | npm run wp-env start npm run wp-env clean all npm run test:e2e - - JSE2ETestsWP56: - name: JavaScipt E2E Tests (WP 5.6) - needs: Setup - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: 14.x - - - name: Npm install and build - run: | - npm ci - FORCE_REDUCED_MOTION=true npm run build:e2e-test - - - name: blocks.ini setup - run: | - echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - uses: actions/cache@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 7.4 - coverage: none - tools: composer - - - name: Composer install - run: | - composer install - - - name: E2E Tests (WP 5.6) - env: - WOOCOMMERCE_BLOCKS_PHASE: 3 - WP_VERSION: 5.6-branch - run: | - JSON='{"core": "WordPress/WordPress#'"$WP_VERSION"'"}' - echo $JSON > .wp-env.override.json - npm run wp-env start - npm run wp-env clean all - npm run test:e2e - - JSE2ETestsWP55: - name: JavaScipt E2E Tests (WP 5.5) - needs: Setup - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: 14.x - - - name: Npm install and build - run: | - npm ci - FORCE_REDUCED_MOTION=true npm run build:e2e-test - - - name: blocks.ini setup - run: | - echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - uses: actions/cache@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 7.4 - coverage: none - tools: composer - - - name: Composer install - run: | - composer install - - - name: E2E Tests (WP 5.5) - env: - WOOCOMMERCE_BLOCKS_PHASE: 3 - WP_VERSION: 5.5-branch - run: | - JSON='{"core": "WordPress/WordPress#'"$WP_VERSION"'"}' - echo $JSON > .wp-env.override.json - npm run wp-env start - npm run wp-env clean all - npm run test:e2e diff --git a/plugins/woocommerce-blocks/.github/workflows/unit-tests.yml b/plugins/woocommerce-blocks/.github/workflows/unit-tests.yml index 74df8b073ac..252293f971c 100644 --- a/plugins/woocommerce-blocks/.github/workflows/unit-tests.yml +++ b/plugins/woocommerce-blocks/.github/workflows/unit-tests.yml @@ -94,8 +94,6 @@ jobs: echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini - name: Run PHP Unit tests - env: - WOO_VERSION: 5.3.0 run: | npm run phpunit diff --git a/plugins/woocommerce-blocks/README.md b/plugins/woocommerce-blocks/README.md index a854d81c103..4ea85fb8005 100644 --- a/plugins/woocommerce-blocks/README.md +++ b/plugins/woocommerce-blocks/README.md @@ -17,11 +17,10 @@ Use this plugin if you want access to the bleeding edge of available blocks for - [Documentation](#documentation) - [Code Documentation](#code-documentation) - - [Contributing](#contributing) - [Installing the plugin version](#installing-the-plugin-version) - [Installing the development version](#installing-the-development-version) - [Getting started with block development](#getting-started-with-block-development) -- [Vision for the Feature](#vision-for-the-feature) +- [Long-term vision](#long-term-vision) ## Documentation @@ -40,19 +39,16 @@ If you want to see what we're working on for future versions, or want to help ou We release a new version of WooCommerce Blocks onto WordPress.org every few weeks, which can be used as an easier way to preview the features. -> Note: The plugin follows a policy of supporting the "L2" strategy for version support. What this means is that the plugin will support the most recent two minor versions of WordPress, and the most recent two minor versions of WooCommerce core at the time of a release. +> Note: The plugin follows a policy of supporting the "L0" strategy for version support. What this means is that the plugin will require the most recent version of WordPress, and the most recent version of WooCommerce core at the time of a release. You can read more about [this policy here](https://developer.woocommerce.com/?p=9998). > -> That means if the latest version of WooCommerce is 4.3 at the time of a release, then our minimum version requirements for WooCommerce core would be 4.1+. -> -> We **recommend** you always keep WordPress and WooCommerce core up to date in order to ensure your store is running with the most recent fixes and enhancements to help your store be successful. -1. Make sure you have WordPress 5.4+ and WooCommerce 4.3+ +1. Make sure you have the latest available versions of WordPress and WooCommerce on your site. 2. The plugin version is available on WordPress.org. [Download the plugin version here.](https://wordpress.org/plugins/woo-gutenberg-products-block/) 3. Activate the plugin. ## Installing the development version -1. Make sure you have WordPress 5.4+ and WooCommerce 4.3+ +1. Make sure you have the latest versions of WordPress and WooCommerce on your site. 2. Get a copy of this plugin using the green "Clone or download" button on the right. 3. `npm install` to install the dependencies. 4. `composer install` to install core dependencies. diff --git a/plugins/woocommerce-blocks/phpcs.xml b/plugins/woocommerce-blocks/phpcs.xml index 3ed470ae2ed..bfb2d53dbcb 100644 --- a/plugins/woocommerce-blocks/phpcs.xml +++ b/plugins/woocommerce-blocks/phpcs.xml @@ -9,7 +9,7 @@ languages/woo-gutenberg-products-block.php - + diff --git a/plugins/woocommerce-blocks/readme.txt b/plugins/woocommerce-blocks/readme.txt index 52590e5930c..5e9edd7bdc5 100644 --- a/plugins/woocommerce-blocks/readme.txt +++ b/plugins/woocommerce-blocks/readme.txt @@ -1,7 +1,7 @@ === WooCommerce Blocks === Contributors: automattic, woocommerce, claudiulodro, tiagonoronha, jameskoster, ryelle, levinmedia, aljullu, mikejolley, nerrad, joshuawold, assassinateur, haszari Tags: gutenberg, woocommerce, woo commerce, products, blocks, woocommerce blocks -Requires at least: 5.5 +Requires at least: 5.8 Tested up to: 5.8 Requires PHP: 7.0 Stable tag: 5.6.0-dev @@ -44,8 +44,7 @@ Use this plugin if you want access to the bleeding edge of available blocks for = Minimum Requirements = -* WordPress 5.5 or greater -* WooCommerce 4.3 or greater +* Latest release versions of WordPress and WooCommerce ([read more here](https://developer.woocommerce.com/?p=9998)) * PHP version 7.0 or greater (PHP 7.4 or greater is recommended) * MySQL version 5.6 or greater diff --git a/plugins/woocommerce-blocks/src/Domain/Bootstrap.php b/plugins/woocommerce-blocks/src/Domain/Bootstrap.php index 810eb7b7166..7b0272afbc4 100644 --- a/plugins/woocommerce-blocks/src/Domain/Bootstrap.php +++ b/plugins/woocommerce-blocks/src/Domain/Bootstrap.php @@ -100,7 +100,31 @@ class Bootstrap { * @return boolean */ protected function has_core_dependencies() { - return class_exists( 'WooCommerce' ) && function_exists( 'register_block_type' ); + $has_needed_dependencies = class_exists( 'WooCommerce' ); + if ( $has_needed_dependencies ) { + $plugin_data = \get_file_data( + $this->package->get_path( 'woocommerce-gutenberg-products-block.php' ), + [ + 'RequiredWCVersion' => 'WC requires at least', + ] + ); + if ( isset( $plugin_data['RequiredWCVersion'] ) && version_compare( \WC()->version, $plugin_data['RequiredWCVersion'], '<' ) ) { + $has_needed_dependencies = false; + add_action( + 'admin_notices', + function() { + if ( should_display_compatibility_notices() ) { + ?> +
+

+
+ setAccessible( true ); + $inner_container = $inner_container_property->getValue( wc_get_container() ); + + $inner_container->replace( LegacyProxy::class, MockableLegacyProxy::class ); + $inner_container->reset_all_resolved(); + + $GLOBALS['wc_container'] = $inner_container; +} + function wc_load_core() { define( 'WC_TAX_ROUNDING_MODE', 'auto' ); define( 'WC_USE_TRANSACTIONS', false ); @@ -119,3 +150,4 @@ tests_add_filter( 'setup_theme', 'wc_install_core' ); // Start up the WP testing environment. require $_tests_dir . '/includes/bootstrap.php'; wc_test_includes(); +wc_blocks_initialize_dependency_injection(); diff --git a/plugins/woocommerce-blocks/woocommerce-gutenberg-products-block.php b/plugins/woocommerce-blocks/woocommerce-gutenberg-products-block.php index fc73486263b..1bdc8522a0b 100644 --- a/plugins/woocommerce-blocks/woocommerce-gutenberg-products-block.php +++ b/plugins/woocommerce-blocks/woocommerce-gutenberg-products-block.php @@ -7,9 +7,9 @@ * Author: Automattic * Author URI: https://woocommerce.com * Text Domain: woo-gutenberg-products-block - * Requires at least: 5.5 + * Requires at least: 5.8 * Requires PHP: 7.0 - * WC requires at least: 5.2 + * WC requires at least: 5.5 * WC tested up to: 5.5 * * @package WooCommerce\Blocks @@ -18,7 +18,7 @@ defined( 'ABSPATH' ) || exit; -$minimum_wp_version = '5.5'; +$minimum_wp_version = '5.8'; if ( ! defined( 'WC_BLOCKS_IS_FEATURE_PLUGIN' ) ) { define( 'WC_BLOCKS_IS_FEATURE_PLUGIN', true ); @@ -54,8 +54,8 @@ if ( version_compare( $GLOBALS['wp_version'], $minimum_wp_version, '<' ) ) { function woocommerce_blocks_admin_unsupported_wp_notice() { if ( should_display_compatibility_notices() ) { ?> -
-

+
+