Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffpaul committed Jun 27, 2023
2 parents eb0b0b0 + 918af94 commit f2eb703
Show file tree
Hide file tree
Showing 30 changed files with 3,075 additions and 606 deletions.
7 changes: 1 addition & 6 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@
/tests

# Files
.distignore
.editorconfig
.eslintignore
.eslintrc
.gitignore
.npmrc
.*
babel.config.js
CHANGELOG.md
CODE_OF_CONDUCT.md
Expand Down
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ assets/js/shared/vendor
gulp-tasks/
webpack.config.babel.js
gulpfile.babel.js
tests/cypress/*
tests/bin/set-core-version.js
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# These owners will be the default owners for everything in the repo. Unless a later match takes precedence, @10up/open-source-practice or @dsawardekar, as primary maintainers will be requested for review when someone opens a Pull Request.
* @10up/open-source-practice @dsawardekar

# GitHub and WordPress.org specifics
/.github/ @jeffpaul
/.wordpress-org/ @jeffpaul
CODE_OF_CONDUCT.md @jeffpaul
LICENSE.md @jeffpaul
51 changes: 51 additions & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: E2E test

on:
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop
jobs:
cypress:
name: ${{ matrix.core.name }}
runs-on: ubuntu-latest
strategy:
matrix:
core:
- {name: 'WP latest', version: 'latest'}
- {name: 'WP minimum', version: 'WordPress/WordPress#6.1'}
- {name: 'WP trunk', version: 'WordPress/WordPress#master'}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: npm install
- name: Composer (optional)
run: composer install
continue-on-error: true
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Build (optional)
run: npm ci && npm run build
continue-on-error: true
- name: Set the core version
run: ./tests/bin/set-core-version.js ${{ matrix.core.version }}
- name: Set up WP environment
run: npm run env:start
- name: Test
run: npm run cypress:run
- name: Make artifacts available
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-artifact
retention-days: 2
path: |
${{ github.workspace }}/tests/cypress/screenshots/
${{ github.workspace }}/tests/cypress/videos/
${{ github.workspace }}/tests/cypress/logs/
${{ github.workspace }}/tests/cypress/reports/
8 changes: 6 additions & 2 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ jobs:
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: actions/dependency-review-action@v1
- name: Dependency Review
uses: actions/dependency-review-action@v3
with:
license-check: true
vulnerability-check: false
config-file: 10up/.github/.github/dependency-review-config.yml@trunk
7 changes: 3 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: install node v12
uses: actions/setup-node@v1
with:
node-version: 12
node-version: 16
- name: npm install
run: npm install
- name: eslint
Expand All @@ -38,9 +38,8 @@ jobs:
with:
php-version: '7.4'
coverage: none
tools: phpcs
- name: composer install
run: composer install
- name: PHPCS check
uses: chekalsky/phpcs-action@v1
with:
phpcs_bin_path: './vendor/bin/phpcs .'
run: './vendor/bin/phpcs .'
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16
6 changes: 6 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"plugins": [ "." ],
"mappings": {
"sample-post.txt": "./tests/cypress/fixtures/sample-post.txt"
}
}
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file, per [the Ke

## [Unreleased] - TBD

## [1.2.0] - 2023-06-27
**Note that this release bumps the WordPress minimum version from 5.7 to 6.1 and the PHP minimum version from 7.4 to 8.0.**

### Added
- Settings UI for managing supported post types (props [@akshitsethi](https://github.com/akshitsethi), [@dinhtungdu](https://github.com/dinhtungdu), [@Sidsector9](https://github.com/Sidsector9), [@jayedul](https://github.com/jayedul), [@dsawardekar](https://github.com/dsawardekar), [@terrance-orletsky-d7](https://github.com/terrance-orletsky-d7), [@ouun](https://github.com/ouun) via [#66](https://github.com/10up/convert-to-blocks/pull/66), [#104](https://github.com/10up/convert-to-blocks/pull/104), [#112](https://github.com/10up/convert-to-blocks/pull/112), [#114](https://github.com/10up/convert-to-blocks/pull/114)).
- Filter hook `convert_to_blocks_update_posts_query_params` to modify `WP_Query` parameters to query posts that need to be migrated (props [@kmgalanakis](https://github.com/kmgalanakis), [@Sidsector9](https://github.com/Sidsector9), [@sanketio](https://github.com/sanketio) via [#113](https://github.com/10up/convert-to-blocks/pull/113)).
- Cypress end-to-end tests (props [@barneyjeffries](https://github.com/barneyjeffries), [@jeffpaul](https://github.com/jeffpaul), [@iamdharmesh](https://github.com/iamdharmesh), [@Sidsector9](https://github.com/Sidsector9), [@vikrampm1](https://github.com/vikrampm1) via [#106](https://github.com/10up/convert-to-blocks/pull/106)).

### Changed
- Bump PHP minimum supported version from 7.4 to 8.0 (props [@barneyjeffries](https://github.com/barneyjeffries), [@jeffpaul](https://github.com/jeffpaul), [@iamdharmesh](https://github.com/iamdharmesh), [@Sidsector9](https://github.com/Sidsector9), [@vikrampm1](https://github.com/vikrampm1) via [#106](https://github.com/10up/convert-to-blocks/pull/106)).
- Bump WordPress minimum supported version from 5.7 to 6.1 (props [@barneyjeffries](https://github.com/barneyjeffries), [@jeffpaul](https://github.com/jeffpaul), [@iamdharmesh](https://github.com/iamdharmesh), [@Sidsector9](https://github.com/Sidsector9), [@vikrampm1](https://github.com/vikrampm1) via [#106](https://github.com/10up/convert-to-blocks/pull/106)).
- Bump WordPress "tested up to" version 6.2 (props [@Sidsector9](https://github.com/Sidsector9) via [#115](https://github.com/10up/convert-to-blocks/pull/115)).
- Updated the Dependency Review GitHub Action (props [@jeffpaul](https://github.com/jeffpaul) via [#109](https://github.com/10up/convert-to-blocks/pull/109)).

## [1.1.1] - 2023-01-05
**Note that this release bumps the WordPress minimum version from 5.4 to 5.7 and the PHP minimum version from 7.0 to 7.4.**

Expand Down
2 changes: 1 addition & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The following individuals are responsible for curating the list of issues, respo

Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc.

[Darshan Sawardekar (@dsawardekar)](https://github.com/dsawardekar), [Taylor Lovett (@tlovett1)](https://github.com/tlovett1), [Tyler Bailey (@TylerB24890)](https://github.com/TylerB24890), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Diana Padron](https://profiles.wordpress.org/dianapadron), [Barry Ceelen (@barryceelen)](https://github.com/barryceelen), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Peter Sorensen (@psorensen)](https://github.com/psorensen), [Brandon Berg (@BBerg10up)](https://github.com/BBerg10up), [Hashim Warren (@hashimwarren)](https://github.com/hashimwarren), [Jason LeMahieu (@MadtownLems)](https://github.com/MadtownLems), [Simon Carne](https://profiles.wordpress.org/scarne/), [Rodrigo Arias (@rodrigo-arias)](https://github.com/rodrigo-arias), [Gary Thayer (@gthayer)](https://github.com/gthayer), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Max Lyuchin (@cadic)](https://github.com/cadic), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Mohit Dadhich (@mohitwp)](https://github.com/mohitwp), [GitHub Dependabot (@dependabot)](https://github.com/apps/dependabot), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Andrew Norcross (@norcross)](https://github.com/norcross), [Quamruz Zaman (@zamanq)](https://github.com/zamanq), [Mehul Gohil (@mehul0810)](https://github.com/mehul0810).
[Darshan Sawardekar (@dsawardekar)](https://github.com/dsawardekar), [Taylor Lovett (@tlovett1)](https://github.com/tlovett1), [Tyler Bailey (@TylerB24890)](https://github.com/TylerB24890), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Diana Padron](https://profiles.wordpress.org/dianapadron), [Barry Ceelen (@barryceelen)](https://github.com/barryceelen), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Peter Sorensen (@psorensen)](https://github.com/psorensen), [Brandon Berg (@BBerg10up)](https://github.com/BBerg10up), [Hashim Warren (@hashimwarren)](https://github.com/hashimwarren), [Jason LeMahieu (@MadtownLems)](https://github.com/MadtownLems), [Simon Carne](https://profiles.wordpress.org/scarne/), [Rodrigo Arias (@rodrigo-arias)](https://github.com/rodrigo-arias), [Gary Thayer (@gthayer)](https://github.com/gthayer), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Max Lyuchin (@cadic)](https://github.com/cadic), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Mohit Dadhich (@mohitwp)](https://github.com/mohitwp), [GitHub Dependabot (@dependabot)](https://github.com/apps/dependabot), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Andrew Norcross (@norcross)](https://github.com/norcross), [Quamruz Zaman (@zamanq)](https://github.com/zamanq), [Mehul Gohil (@mehul0810)](https://github.com/mehul0810), [Akshit Sethi (@akshitsethi)](https://github.com/akshitsethi), [Terrance Orletsky (@terrance-orletsky-d7)](https://github.com/terrance-orletsky-d7), [Philipp (@ouun)](https://github.com/ouun), [Sanket Parmar (@sanketio)](https://github.com/sanketio), [Konstantinos Galanakis (@kmgalanakis)](https://github.com/kmgalanakis), [Vikram Moparthy (@vikrampm1)](https://github.com/vikrampm1), [Barney Jeffries(@barneyjeffries)](https://github.com/barneyjeffries).

## Libraries

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ The `wp convert-to-blocks start` [WP-CLI command](https://github.com/10up/conver

## Requirements

- PHP 7.4+
- WordPress 5.7+
- PHP 8+
- WordPress 6.1+
- Inner Blocks Transforms is only supported with the Gutenberg Plugin 10.9.0+

## Installation
Expand Down
4 changes: 3 additions & 1 deletion config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package convert-to-blocks
*/

$plugin_version = '1.1.1';
$plugin_version = '1.2.0';

if ( file_exists( __DIR__ . '/.commit' ) ) {
// phpcs:disable
Expand All @@ -17,6 +17,8 @@
convert_to_blocks_define( 'CONVERT_TO_BLOCKS_VERSION', $plugin_version );
convert_to_blocks_define( 'CONVERT_TO_BLOCKS_DIR', plugin_dir_path( __FILE__ ) );
convert_to_blocks_define( 'CONVERT_TO_BLOCKS_URL', plugin_dir_url( __FILE__ ) );
convert_to_blocks_define( 'CONVERT_TO_BLOCKS_SLUG', 'convert-to-blocks' );
convert_to_blocks_define( 'CONVERT_TO_BLOCKS_DEFAULT_POST_TYPES', [ 'post', 'page' ] );

/* Labels */

Expand Down
6 changes: 3 additions & 3 deletions convert-to-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* Plugin Name: Convert to Blocks
* Plugin URI: https://github.com/10up/convert-to-blocks
* Description: Convert classic editor posts to blocks on the fly.
* Version: 1.1.1
* Requires at least: 5.7
* Requires PHP: 7.4
* Version: 1.2.0
* Requires at least: 6.1
* Requires PHP: 8
* Author: 10up
* Author URI: https://10up.com
* License: GPLv2 or later
Expand Down
15 changes: 15 additions & 0 deletions includes/ConvertToBlocks/MigrationAgent.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@ public function get_posts_to_update( $opts = [] ) {
'ignore_sticky_posts' => true,
];

/**
* Filter query parameters for the query to get the posts to be updated.
*
* @since 1.1.2
*
* @hook convert_to_blocks_update_posts_query_params
*
* @param {array} $query_params Array of query parameters.
* @param {array} $post_type Array with the post types.
* @param {array} $opts Optional opts.
*
* @return {array} Array of request arguments.
*/
$query_params = apply_filters( 'convert_to_blocks_update_posts_query_params', $query_params, $post_type, $opts );

if ( ! empty( $opts['only'] ) ) {
$post_in = explode( ',', $opts['only'] );
$post_in = array_map( 'intval', $post_in );
Expand Down
25 changes: 21 additions & 4 deletions includes/ConvertToBlocks/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public function init() {
$this->register_objects(
[
new RESTSupport(),
new Settings(),
]
);
}
Expand Down Expand Up @@ -184,14 +185,30 @@ public function init_locale() {
* @return bool
*/
public function post_type_supports_convert_to_blocks( $post_type ) {
$supports = post_type_supports( $post_type, 'convert-to-blocks' );
$use_defaults = apply_filters( 'convert_to_blocks_defaults', true );
$default_post_types = $this->get_default_post_types();
$supports = post_type_supports( $post_type, 'convert-to-blocks' );
$use_defaults = apply_filters( 'convert_to_blocks_defaults', true );
$default_post_types = $this->get_default_post_types();
$user_selected_post_types = get_option( sprintf( '%s_post_types', CONVERT_TO_BLOCKS_SLUG ), $default_post_types );

if ( ! $supports && $use_defaults && in_array( $post_type, $default_post_types, true ) ) {
$supports = true;
}

// For user-selected option via the Settings UI.
if ( false !== $user_selected_post_types ) {
$supports = false;

// If no post_type is selected.
if ( empty( $user_selected_post_types ) ) {
$supports = false;
}

// Check if post_type is selected by the user.
if ( in_array( $post_type, $user_selected_post_types, true ) ) {
$supports = true;
}
}

$supports = apply_filters( 'post_type_supports_convert_to_blocks', $supports, $post_type );

return $supports;
Expand Down Expand Up @@ -257,7 +274,7 @@ public function is_classic_editor_post( $post_id ) {
* @return array
*/
public function get_default_post_types() {
return apply_filters( 'convert_to_blocks_default_post_types', [ 'post', 'page' ] );
return apply_filters( 'convert_to_blocks_default_post_types', CONVERT_TO_BLOCKS_DEFAULT_POST_TYPES );
}

/**
Expand Down
Loading

0 comments on commit f2eb703

Please sign in to comment.