diff --git a/.github/release-pull-request-template.md b/.github/release-pull-request-template.md index f806222f5..4b1cd9fb7 100644 --- a/.github/release-pull-request-template.md +++ b/.github/release-pull-request-template.md @@ -10,6 +10,7 @@ - [ ] Update this pull request's status from `draft` to `ready to merge`. - [ ] Review: Do a review of the commit to the `stable` branch to ensure the contents of the diffs are as expected. - [ ] Test: Check out the `stable` branch and test it locally to ensure everything works as expected. It is recommended that you rename the existing `distributor` directory and check out `stable` fresh because switching branches does not delete files. This can be done with `git clone --single-branch --branch stable git@github.com:10up/distributor.git` +- [ ] Either perform a regression testing utilizing the available [Critical Flows](https://10up.github.io/Open-Source-Best-Practices/testing/#critical-flows) and Test Cases or if [end-to-end tests](https://10up.github.io/Open-Source-Best-Practices/testing/#e2e-testing) cover a significant portion of those Critical Flows then run e2e tests. Only proceed if everything tests successfully. - [ ] Release: Create a [new release](https://github.com/10up/distributor/releases/new), naming the tag and the release with the new version number, and **targeting the `stable` branch**. Paste the changelog from `CHANGELOG.md` into the body of the release and include a link to the [closed issues on the milestone](https://github.com/10up/distributor/milestone/#?closed=1). The release should now appear under [releases](https://github.com/10up/distributor/releases). - [ ] Check release: Wait for the [Publish Release Action](https://github.com/10up/distributor/actions?query=workflow%3A%22Publish+Release%22) to complete, and then check the latest release to ensure that the ZIP has been attached as an asset. Download the ZIP and inspect the contents to be sure they match the contents of the `stable` branch. - [ ] Close milestone: Edit the [milestone](https://github.com/10up/distributor/milestone/#) with release date (in the `Due date (optional)` field) and link to GitHub release (in the `Description` field), then close the milestone. diff --git a/.github/workflows/no-response.yml b/.github/workflows/close-stale-issues.yml similarity index 55% rename from .github/workflows/no-response.yml rename to .github/workflows/close-stale-issues.yml index 5d7f01ca9..842f1eefd 100644 --- a/.github/workflows/no-response.yml +++ b/.github/workflows/close-stale-issues.yml @@ -1,26 +1,27 @@ -name: No Response +name: 'Close stale issues' # **What it does**: Closes issues where the original author doesn't respond to a request for information. # **Why we have it**: To remove the need for maintainers to remember to check back on issues periodically to see if contributors have responded. -# **Who does it impact**: Everyone that works on docs or docs-internal. on: - issue_comment: - types: [created] schedule: - # Schedule for five minutes after the hour, every hour - - cron: '5 * * * *' + # Schedule for every day at 1:30am UTC + - cron: '30 1 * * *' + +permissions: + issues: write jobs: - noResponse: + stale: runs-on: ubuntu-latest steps: - - uses: lee-dohm/no-response@v0.5.0 + - uses: actions/stale@v9 with: - token: ${{ github.token }} - daysUntilClose: 14 # Number of days of inactivity before an Issue is closed for lack of response - responseRequiredLabel: "Reporter Feedback" # Label indicating that a response from the original author is required - closeComment: > + days-before-stale: 7 + days-before-close: 7 + stale-issue-message: > + It has been 7 days since more information was requested from you in this issue and we have not heard back. This issue is now marked as stale and will be closed in 7 days, but if you have more information to add then please comment and the issue will stay open. + close-issue-message: > This issue has been automatically closed because there has been no response to our request for more information. With only the information that is currently in the issue, we don't have enough information @@ -28,3 +29,7 @@ jobs: that we can investigate further. See [this blog post on bug reports and the importance of repro steps](https://www.lee-dohm.com/2015/01/04/writing-good-bug-reports/) for more information about the kind of information that may be helpful. + stale-issue-label: 'stale' + close-issue-reason: 'not_planned' + any-of-labels: 'Reporter Feedback' + remove-stale-when-updated: true diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 15f8b70a4..20939439a 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -47,11 +47,11 @@ jobs: - {name: 'PHP Default', version: null} core: - {name: 'WP stable', version: 'latest'} - - {name: 'WP 5.7', version: 'WordPress/WordPress#5.7'} + - {name: 'WP 6.3', version: 'WordPress/WordPress#6.3'} - {name: 'WP trunk', version: 'WordPress/WordPress#master'} include: - php: {name: 'PHP 7.4', version: '7.4'} - core: {name: 'WP 5.7', version: 'WordPress/WordPress#5.7'} + core: {name: 'WP 6.3', version: 'WordPress/WordPress#6.3'} - php: {name: 'PHP 8.1', version: '8.1'} core: {name: 'WP stable', version: 'latest'} steps: @@ -93,8 +93,8 @@ jobs: - name: Log WP environment versions run: | - npx wp-env run cli "wp core version" - npx wp-env run cli "php --version" + npx wp-env run cli wp core version + npx wp-env run cli php --version - name: Test run: npm run cypress:run @@ -108,7 +108,7 @@ jobs: npx mochawesome-report-generator tests/cypress/reports/mochawesome.json -o tests/cypress/reports/ cat ./tests/cypress/reports/mochawesome.md >> $GITHUB_STEP_SUMMARY - name: Make artifacts available - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: cypress-artifact diff --git a/.github/workflows/generate-zip.yml b/.github/workflows/generate-zip.yml index da116934d..eb8c6c091 100644 --- a/.github/workflows/generate-zip.yml +++ b/.github/workflows/generate-zip.yml @@ -42,7 +42,7 @@ jobs: rm -rf ./release && unzip ${{ github.event.repository.name }}.zip -d ./release - name: Upload the ZIP file as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ github.event.repository.name }} path: release diff --git a/.github/workflows/release-pull-request.yml b/.github/workflows/release-pull-request.yml index 88826afdc..a6e623d53 100644 --- a/.github/workflows/release-pull-request.yml +++ b/.github/workflows/release-pull-request.yml @@ -14,7 +14,7 @@ jobs: BRANCH=${GITHUB_REF##*/} echo $BRANCH VERSION=${BRANCH#'release/'} - echo ::set-output name=result::"Release: ${VERSION}" + echo "result="Release: ${VERSION}"" >> $GITHUB_OUTPUT id: title - name: Create Pull Request run: gh pr create --draft --title "${{ steps.title.outputs.result }}" --body-file ./.github/release-pull-request-template.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d0e76b3f0..406384c47 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,6 +22,10 @@ Pull requests represent a proposed solution to a specified problem. They should For more on how 10up writes and manages code, check out our [10up Engineering Best Practices](https://10up.github.io/Engineering-Best-Practices/). +### Testing + +Helping to test an open source project and provide feedback on success or failure of those tests is also a helpful contribution. You can find details on the Critical Flows and Test Cases in [this project's GitHub Wiki](https://github.com/10up/distributor/wiki/Critical-Flows) as well as details on our overall approach to [Critical Flows and Test Cases in our Open Source Best Practices](https://10up.github.io/Open-Source-Best-Practices/testing/#critial-flows). Submitting the results of testing via our Critical Flows as a comment on a Pull Request of a specific feature or as an Issue when testing the entire project is the best approach for providing testing results. + ## Workflow The `develop` branch is the development branch which means it contains the next version to be released. `stable` contains the current latest release and `trunk` contains the corresponding stable development version. Always work on the `develop` branch and open up PRs against `develop`. diff --git a/README.md b/README.md index 484e183df..a17e3cfbe 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ > Distributor is a WordPress plugin that makes it easy to distribute and reuse content across your websites — whether in a single multisite or across the web. -[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Tests](https://github.com/10up/distributor/actions/workflows/test.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/test.yml) [![Linting](https://github.com/10up/distributor/actions/workflows/lint.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/lint.yml) [![Code scanning](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml) [![Release Version](https://img.shields.io/github/release/10up/distributor.svg)](https://github.com/10up/distributor/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v6.4%20tested-success.svg) [![License](https://img.shields.io/github/license/10up/distributor.svg)](https://github.com/10up/distributor/blob/develop/LICENSE.md) +[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Tests](https://github.com/10up/distributor/actions/workflows/test.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/test.yml) [![Linting](https://github.com/10up/distributor/actions/workflows/lint.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/lint.yml) [![Code scanning](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml) [![Release Version](https://img.shields.io/github/release/10up/distributor.svg)](https://github.com/10up/distributor/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v6.5%20tested-success.svg) [![License](https://img.shields.io/github/license/10up/distributor.svg)](https://github.com/10up/distributor/blob/develop/LICENSE.md) *You can learn more about Distributor's features at [DistributorPlugin.com](https://distributorplugin.com) and documentation at the [Distributor documentation site](https://10up.github.io/distributor/).* diff --git a/distributor.php b/distributor.php index 486b47c71..69626649d 100644 --- a/distributor.php +++ b/distributor.php @@ -5,7 +5,7 @@ * Update URI: https://distributorplugin.com * Description: Makes it easy to distribute and reuse content across your websites, whether inside of a multisite or across the web. * Version: 2.0.4 - * Requires at least: 5.7 + * Requires at least: 6.3 * Requires PHP: 7.4 * Author: 10up Inc. * Author URI: https://distributorplugin.com diff --git a/includes/classes/PullListTable.php b/includes/classes/PullListTable.php index 388e22415..3bc20b4a1 100644 --- a/includes/classes/PullListTable.php +++ b/includes/classes/PullListTable.php @@ -251,13 +251,18 @@ public function column_date( $post ) { } /** - * Output categories column + * Output categories column. * * @param \WP_Post $post Post object. - * @since 0.8 + * @since 2.0.5 */ public function column_categories( $post ) { $categories = $post->terms['category'] ?? []; + + if ( empty( $categories ) ) { + return; + } + echo wp_kses_post( generate_taxonomy_links( 'category', $post, $categories ) ); } @@ -268,7 +273,7 @@ public function column_categories( $post ) { * @param string $column_name Column name. * * @return string. - * @since 0.8 + * @since 2.0.5 */ public function column_default( $item, $column_name ) { if ( 'post_type' === $column_name ) { diff --git a/includes/pull-ui.php b/includes/pull-ui.php index 5127b8b68..fce996899 100644 --- a/includes/pull-ui.php +++ b/includes/pull-ui.php @@ -594,8 +594,10 @@ function output_pull_errors() { if ( is_a( $connection_now, '\Distributor\ExternalConnection' ) ) { $error_key = "external_{$connection_now->id}"; - } else { + } elseif ( is_a( $connection_now, '\Distributor\InternalConnections\NetworkSiteConnection' ) ) { $error_key = "internal_{$connection_now->site->blog_id}"; + } else { + return; } $pull_errors = get_transient( 'dt_connection_pull_errors_' . $error_key ); diff --git a/includes/settings.php b/includes/settings.php index afee92722..8e86456e6 100644 --- a/includes/settings.php +++ b/includes/settings.php @@ -125,7 +125,11 @@ function update_notice( $plugin_file, $plugin_data, $status ) { * @since 1.2 */ function maybe_notice() { - if ( 0 === strpos( get_current_screen()->parent_base, 'distributor' ) ) { + $parent_base = get_current_screen()->parent_base; + if ( ! $parent_base ) { + return; + } + if ( 0 === strpos( $parent_base, 'distributor' ) ) { if ( Utils\is_development_version() ) { ?>
@@ -177,8 +181,7 @@ function admin_enqueue_scripts( $hook ) { if ( file_exists( $asset_file ) ) { $asset_data = require $asset_file; } - - wp_enqueue_style( 'dt-admin-settings', plugins_url( '/dist/css/admin-settings.min.css', __DIR__ ), array(), $asset_data['version'] ); + wp_enqueue_style( 'dt-admin-settings-screen', plugins_url( '/dist/css/admin-settings.min.css', __DIR__ ), array(), $asset_data['version'] ); } } diff --git a/includes/utils.php b/includes/utils.php index ec0c1da8c..3ebdef73b 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -579,11 +579,16 @@ function prepare_meta( $post_id ) { * @param string $taxonomy The taxonomy name. * @param object $post The post object. * @param array $terms Optional. Array of terms. + * * @return string The generated HTML for the taxonomy links. */ function generate_taxonomy_links( $taxonomy, $post, $terms = [] ) { $taxonomy_object = get_taxonomy( $taxonomy ); + if ( ! $taxonomy_object ) { + return ''; + } + if ( ! $terms ) { $terms = get_the_terms( $post, $taxonomy ); } @@ -591,7 +596,7 @@ function generate_taxonomy_links( $taxonomy, $post, $terms = [] ) { /** * Filter the taxonomy terms that should be synced. * - * @since x.x.x + * @since 2.0.5 * @hook dt_syncable_taxonomy_terms * * @param {array} $terms Array of terms. @@ -602,11 +607,10 @@ function generate_taxonomy_links( $taxonomy, $post, $terms = [] ) { */ $terms = apply_filters( "dt_syncable_{$taxonomy}_terms", $terms, $taxonomy, $post ); - /** * Filter the terms that should be synced. * - * @since x.x.x + * @since 2.0.5 * @hook dt_syncable_terms * * @param {array} $terms Array of categories. @@ -645,12 +649,14 @@ function generate_taxonomy_links( $taxonomy, $post, $terms = [] ) { /** * Filters the links in `$taxonomy` column of edit.php. * - * @since x.x.x + * @since 2.0.5 * @hook dt_taxonomy_links * - * @param string[] $term_links Array of term editing links. - * @param string $taxonomy Taxonomy name. - * @param WP_Term[] $terms Array of term objects appearing in the post row. + * @param {string[]} $term_links Array of term editing links. + * @param {string} $taxonomy Taxonomy name. + * @param {WP_Term[]} $terms Array of term objects appearing in the post row. + * + * @return {string[]} Array of term editing links. */ $term_links = apply_filters( 'dt_taxonomy_links', $term_links, $taxonomy, $terms ); @@ -665,11 +671,12 @@ function generate_taxonomy_links( $taxonomy, $post, $terms = [] ) { * * The edit link is created in such a way that it will link to source site. * - * @since x.x.x + * @since 2.0.5 * * @param string[] $args Associative array of URL parameters for the link. * @param string $link_text Link text. * @param string $css_class Optional. Class attribute. Default empty string. + * * @return string The formatted link string. */ function get_edit_link( $args, $link_text, $css_class = '' ) { @@ -677,7 +684,7 @@ function get_edit_link( $args, $link_text, $css_class = '' ) { if ( is_internal_connection() ) { $url = add_query_arg( $args, get_admin_url( null, 'edit.php' ) ); } else { - $url = add_query_arg( $args, get_root_url() . 'wp-admin/edit.php' ); + $url = add_query_arg( $args, trailingslashit( get_root_url() ) . 'wp-admin/edit.php' ); } $class_html = ''; @@ -706,36 +713,47 @@ function get_edit_link( $args, $link_text, $css_class = '' ) { /** * Is current connection an external connection? * + * @since 2.0.5 + * * @return boolean */ function is_external_connection() { global $connection_now; + return is_a( $connection_now, '\Distributor\ExternalConnection' ); } /** * Is current connection an internal connection? * + * @since 2.0.5 + * * @return boolean */ function is_internal_connection() { global $connection_now; + return is_a( $connection_now, '\Distributor\InternalConnections\NetworkSiteConnection' ); } /** * Get the root URL of the current connection * + * @since 2.0.5 + * * @return string */ function get_root_url() { $base_url = get_conn_base_url(); + return str_replace( '/wp-json', '', $base_url ); } /** * Get the base URL of the current connection * + * @since 2.0.5 + * * @return string */ function get_conn_base_url() { @@ -743,6 +761,11 @@ function get_conn_base_url() { return get_site_url(); } global $connection_now; + + if ( ! $connection_now || ! property_exists( $connection_now, 'base_url' ) ) { + return ''; + } + return $connection_now->base_url; } diff --git a/package-lock.json b/package-lock.json index e3afb3daa..f472e27ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,15 +13,16 @@ }, "devDependencies": { "@10up/cypress-wp-utils": "^0.2.0", - "@wordpress/env": "^5.16.0", + "@wordpress/env": "^10.1.0", "@wordpress/scripts": "^26.19.0", "compare-versions": "^4.1.3", "cypress": "^13.1.0", "cypress-mochawesome-reporter": "^3.5.1", "eslint-plugin-cypress": "^2.12.1", - "jsdoc": "^3.6.11", + "jsdoc": "^4.0.2", "mochawesome-json-to-md": "^0.7.2", "node-wp-i18n": "^1.2.6", + "taffydb": "^2.7.3", "wp-hookdoc": "^0.2.0" }, "engines": { @@ -2866,6 +2867,18 @@ "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", "dev": true }, + "node_modules/@jsdoc/salty": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/@jsdoc/salty/-/salty-0.2.7.tgz", + "integrity": "sha512-mh8LbS9d4Jq84KLw8pzho7XC2q2/IJGiJss3xwRoLD1A+EE16SjN4PfaG4jRCzKegTFLlN0Zd8SdUPE6XdoPFg==", + "dev": true, + "dependencies": { + "lodash": "^4.17.21" + }, + "engines": { + "node": ">=v12.0.0" + } + }, "node_modules/@kwsites/file-exists": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", @@ -4801,14 +4814,14 @@ } }, "node_modules/@wordpress/env": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@wordpress/env/-/env-5.16.0.tgz", - "integrity": "sha512-zx6UO8PuJBrQ34cfeedK1HlGHLFaj7oWzTo9tTt+noB79Ttqc4+a0lYwDqBLLJhlHU+cWgcyOP2lB6TboXH0xA==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/@wordpress/env/-/env-10.2.0.tgz", + "integrity": "sha512-EToZYPGXpl42Asw3bxpX8aKmHfRUdGxKPjQ9CHZVQoTAL27Af4FyjyGnepsnDpnYdIeI8VPb2S3k2NL/1+fpIA==", "dev": true, "dependencies": { "chalk": "^4.0.0", "copy-dir": "^1.3.0", - "docker-compose": "^0.22.2", + "docker-compose": "^0.24.3", "extract-zip": "^1.6.7", "got": "^11.8.5", "inquirer": "^7.1.0", @@ -4821,6 +4834,10 @@ }, "bin": { "wp-env": "bin/wp-env" + }, + "engines": { + "node": ">=18.12.0", + "npm": ">=8.19.2" } }, "node_modules/@wordpress/eslint-plugin": { @@ -6089,13 +6106,13 @@ "dev": true }, "node_modules/body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dev": true, "dependencies": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", @@ -6103,7 +6120,7 @@ "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", - "raw-body": "2.5.1", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, @@ -8375,14 +8392,29 @@ } }, "node_modules/docker-compose": { - "version": "0.22.2", - "resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-0.22.2.tgz", - "integrity": "sha512-iXWb5+LiYmylIMFXvGTYsjI1F+Xyx78Jm/uj1dxwwZLbWkUdH6yOXY5Nr3RjbYX15EgbGJCq78d29CmWQQQMPg==", + "version": "0.24.8", + "resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-0.24.8.tgz", + "integrity": "sha512-plizRs/Vf15H+GCVxq2EUvyPK7ei9b/cVesHvjnX4xaXjM9spHe2Ytq0BitndFgvTJ3E3NljPNUEl7BAN43iZw==", "dev": true, + "dependencies": { + "yaml": "^2.2.2" + }, "engines": { "node": ">= 6.0.0" } }, + "node_modules/docker-compose/node_modules/yaml": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.5.tgz", + "integrity": "sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==", + "dev": true, + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -9808,17 +9840,17 @@ "dev": true }, "node_modules/express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "dev": true, "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -9850,9 +9882,9 @@ } }, "node_modules/express/node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", "dev": true, "engines": { "node": ">= 0.6" @@ -10299,9 +10331,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.4", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", - "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "dev": true, "funding": [ { @@ -11491,9 +11523,9 @@ "dev": true }, "node_modules/ip": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", - "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.9.tgz", + "integrity": "sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==", "dev": true }, "node_modules/ipaddr.js": { @@ -13013,12 +13045,13 @@ "dev": true }, "node_modules/jsdoc": { - "version": "3.6.11", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.11.tgz", - "integrity": "sha512-8UCU0TYeIYD9KeLzEcAu2q8N/mx9O3phAGl32nmHlE0LpaJL71mMkP4d+QE5zWfNt50qheHtOZ0qoxVrsX5TUg==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-4.0.2.tgz", + "integrity": "sha512-e8cIg2z62InH7azBBi3EsSEqrKx+nUtAS5bBcYTSpZFA+vhNPyhv8PTFZ0WsjOPDj04/dOLlm08EDcQJDqaGQg==", "dev": true, "dependencies": { - "@babel/parser": "^7.9.4", + "@babel/parser": "^7.20.15", + "@jsdoc/salty": "^0.2.1", "@types/markdown-it": "^12.2.3", "bluebird": "^3.7.2", "catharsis": "^0.9.0", @@ -13031,7 +13064,6 @@ "mkdirp": "^1.0.4", "requizzle": "^0.2.3", "strip-json-comments": "^3.1.0", - "taffydb": "2.6.2", "underscore": "~1.13.2" }, "bin": { @@ -17259,9 +17291,9 @@ } }, "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dev": true, "dependencies": { "bytes": "3.1.2", @@ -18510,9 +18542,9 @@ } }, "node_modules/socks/node_modules/ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", + "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==", "dev": true }, "node_modules/source-map": { @@ -19293,9 +19325,9 @@ } }, "node_modules/taffydb": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", - "integrity": "sha512-y3JaeRSplks6NYQuCOj3ZFMO3j60rTwbuKCvZxsAraGYH2epusatvZ0baZYA01WsGqJBq/Dl6vOrMUJqyMj8kA==", + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.7.3.tgz", + "integrity": "sha512-GQ3gtYFSOAxSMN/apGtDKKkbJf+8izz5YfbGqIsUc7AMiQOapARZ76dhilRY2h39cynYxBFdafQo5HUL5vgkrg==", "dev": true }, "node_modules/tannin": { @@ -20535,9 +20567,9 @@ } }, "node_modules/webpack-dev-middleware": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz", - "integrity": "sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==", + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz", + "integrity": "sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==", "dev": true, "dependencies": { "colorette": "^2.0.10", @@ -23274,6 +23306,15 @@ } } }, + "@jsdoc/salty": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/@jsdoc/salty/-/salty-0.2.7.tgz", + "integrity": "sha512-mh8LbS9d4Jq84KLw8pzho7XC2q2/IJGiJss3xwRoLD1A+EE16SjN4PfaG4jRCzKegTFLlN0Zd8SdUPE6XdoPFg==", + "dev": true, + "requires": { + "lodash": "^4.17.21" + } + }, "@kwsites/file-exists": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", @@ -24787,14 +24828,14 @@ } }, "@wordpress/env": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@wordpress/env/-/env-5.16.0.tgz", - "integrity": "sha512-zx6UO8PuJBrQ34cfeedK1HlGHLFaj7oWzTo9tTt+noB79Ttqc4+a0lYwDqBLLJhlHU+cWgcyOP2lB6TboXH0xA==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/@wordpress/env/-/env-10.2.0.tgz", + "integrity": "sha512-EToZYPGXpl42Asw3bxpX8aKmHfRUdGxKPjQ9CHZVQoTAL27Af4FyjyGnepsnDpnYdIeI8VPb2S3k2NL/1+fpIA==", "dev": true, "requires": { "chalk": "^4.0.0", "copy-dir": "^1.3.0", - "docker-compose": "^0.22.2", + "docker-compose": "^0.24.3", "extract-zip": "^1.6.7", "got": "^11.8.5", "inquirer": "^7.1.0", @@ -25734,13 +25775,13 @@ "dev": true }, "body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dev": true, "requires": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", @@ -25748,7 +25789,7 @@ "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", - "raw-body": "2.5.1", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, @@ -27449,10 +27490,21 @@ } }, "docker-compose": { - "version": "0.22.2", - "resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-0.22.2.tgz", - "integrity": "sha512-iXWb5+LiYmylIMFXvGTYsjI1F+Xyx78Jm/uj1dxwwZLbWkUdH6yOXY5Nr3RjbYX15EgbGJCq78d29CmWQQQMPg==", - "dev": true + "version": "0.24.8", + "resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-0.24.8.tgz", + "integrity": "sha512-plizRs/Vf15H+GCVxq2EUvyPK7ei9b/cVesHvjnX4xaXjM9spHe2Ytq0BitndFgvTJ3E3NljPNUEl7BAN43iZw==", + "dev": true, + "requires": { + "yaml": "^2.2.2" + }, + "dependencies": { + "yaml": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.5.tgz", + "integrity": "sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==", + "dev": true + } + } }, "doctrine": { "version": "3.0.0", @@ -28501,17 +28553,17 @@ "dev": true }, "express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "dev": true, "requires": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -28540,9 +28592,9 @@ }, "dependencies": { "cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", "dev": true }, "debug": { @@ -28900,9 +28952,9 @@ "dev": true }, "follow-redirects": { - "version": "1.15.4", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", - "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "dev": true }, "for-each": { @@ -29772,9 +29824,9 @@ "dev": true }, "ip": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", - "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.9.tgz", + "integrity": "sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==", "dev": true }, "ipaddr.js": { @@ -30892,12 +30944,13 @@ "dev": true }, "jsdoc": { - "version": "3.6.11", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.11.tgz", - "integrity": "sha512-8UCU0TYeIYD9KeLzEcAu2q8N/mx9O3phAGl32nmHlE0LpaJL71mMkP4d+QE5zWfNt50qheHtOZ0qoxVrsX5TUg==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-4.0.2.tgz", + "integrity": "sha512-e8cIg2z62InH7azBBi3EsSEqrKx+nUtAS5bBcYTSpZFA+vhNPyhv8PTFZ0WsjOPDj04/dOLlm08EDcQJDqaGQg==", "dev": true, "requires": { - "@babel/parser": "^7.9.4", + "@babel/parser": "^7.20.15", + "@jsdoc/salty": "^0.2.1", "@types/markdown-it": "^12.2.3", "bluebird": "^3.7.2", "catharsis": "^0.9.0", @@ -30910,7 +30963,6 @@ "mkdirp": "^1.0.4", "requizzle": "^0.2.3", "strip-json-comments": "^3.1.0", - "taffydb": "2.6.2", "underscore": "~1.13.2" }, "dependencies": { @@ -34031,9 +34083,9 @@ "dev": true }, "raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dev": true, "requires": { "bytes": "3.1.2", @@ -34985,9 +35037,9 @@ }, "dependencies": { "ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", + "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==", "dev": true } } @@ -35635,9 +35687,9 @@ } }, "taffydb": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", - "integrity": "sha512-y3JaeRSplks6NYQuCOj3ZFMO3j60rTwbuKCvZxsAraGYH2epusatvZ0baZYA01WsGqJBq/Dl6vOrMUJqyMj8kA==", + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.7.3.tgz", + "integrity": "sha512-GQ3gtYFSOAxSMN/apGtDKKkbJf+8izz5YfbGqIsUc7AMiQOapARZ76dhilRY2h39cynYxBFdafQo5HUL5vgkrg==", "dev": true }, "tannin": { @@ -36571,9 +36623,9 @@ } }, "webpack-dev-middleware": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz", - "integrity": "sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==", + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz", + "integrity": "sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==", "dev": true, "requires": { "colorette": "^2.0.10", diff --git a/package.json b/package.json index eb72c456e..c512c5a3a 100644 --- a/package.json +++ b/package.json @@ -26,15 +26,16 @@ }, "devDependencies": { "@10up/cypress-wp-utils": "^0.2.0", - "@wordpress/env": "^5.16.0", + "@wordpress/env": "^10.1.0", "@wordpress/scripts": "^26.19.0", "compare-versions": "^4.1.3", "cypress": "^13.1.0", "cypress-mochawesome-reporter": "^3.5.1", "eslint-plugin-cypress": "^2.12.1", - "jsdoc": "^3.6.11", + "jsdoc": "^4.0.2", "mochawesome-json-to-md": "^0.7.2", "node-wp-i18n": "^1.2.6", + "taffydb": "^2.7.3", "wp-hookdoc": "^0.2.0" }, "scripts": { @@ -60,8 +61,8 @@ "env:start": "wp-env start", "env:stop": "wp-env stop", "env:destroy": "wp-env destroy", - "to-multisite": "wp-env run tests-cli \"wp core multisite-convert --title='Distributor Multisite'\"", - "copy-htaccess": "wp-env run tests-cli \"cp wp-content/plugins/distributor/tests/cypress/.htaccess .htaccess\"", + "to-multisite": "wp-env run tests-cli wp core multisite-convert --title='Distributor Multisite'", + "copy-htaccess": "wp-env run tests-cli cp wp-content/plugins/distributor/tests/cypress/.htaccess .htaccess", "postenv:start": "./tests/bin/initialize.sh" }, "files": [ diff --git a/readme.txt b/readme.txt index e2eea5b18..f4a5fab65 100644 --- a/readme.txt +++ b/readme.txt @@ -1,9 +1,7 @@ === Distributor === Contributors: 10up Tags: content, distribution, syndication, management -Requires at least: 5.7 -Tested up to: 6.4 -Requires PHP: 7.4 +Tested up to: 6.6 Stable tag: 2.0.4 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html diff --git a/tests/bin/initialize.sh b/tests/bin/initialize.sh index 06c8cae4f..4d2e7d920 100755 --- a/tests/bin/initialize.sh +++ b/tests/bin/initialize.sh @@ -1,21 +1,21 @@ #!/bin/bash set -e -npm run env run tests-wordpress "chmod -c ugo+w /var/www/html" -npm run env run tests-cli "wp rewrite structure '/%postname%/' --hard" +npx wp-env run tests-wordpress chmod -c ugo+w /var/www/html +npx wp-env run tests-cli wp rewrite structure '/%postname%/' --hard status=0 -npm run env run tests-cli "wp site list" || status=$? +npx wp-env run tests-cli wp site list || status=$? if [ $status -eq 0 ] then echo "Multisite already initialized" else echo "Converting to multisite" - npm run env run tests-cli "wp core multisite-convert --title='Distributor Multisite'" - npm run env run tests-cli "wp user create second 'second@admin.local' --user_pass=password --role=administrator" - npm run env run tests-cli "wp site create --slug=second --title='Second Site' --email='second@admin.local'" - npm run env run tests-cli "wp theme enable twentytwentyone --activate" - npm run env run tests-cli "wp theme enable twentytwentyone --url=localhost/second --activate" - npm run env run tests-cli "cp wp-content/plugins/distributor/tests/cypress/.htaccess .htaccess" + npx wp-env run tests-cli wp core multisite-convert --title='Distributor Multisite' + npx wp-env run tests-cli wp user create second 'second@admin.local' --user_pass=password --role=administrator + npx wp-env run tests-cli wp site create --slug=second --title='Second Site' --email='second@admin.local' + npx wp-env run tests-cli wp theme enable twentytwentyone --activate + npx wp-env run tests-cli wp theme enable twentytwentyone --url=localhost/second --activate + npx wp-env run tests-cli cp wp-content/plugins/distributor/tests/cypress/.htaccess .htaccess fi diff --git a/tests/cypress/config.js b/tests/cypress/config.js index 103de3a39..1d34e7abf 100644 --- a/tests/cypress/config.js +++ b/tests/cypress/config.js @@ -1,5 +1,6 @@ const { defineConfig } = require( 'cypress' ); -const { readConfig } = require( '@wordpress/env/lib/config' ); +const { loadConfig } = require( '@wordpress/env/lib/config' ); +const getCacheDirectory = require( '@wordpress/env/lib/config/get-cache-directory' ); module.exports = defineConfig( { chromeWebSecurity: false, @@ -34,7 +35,8 @@ module.exports = defineConfig( { * @return {Object} Updated Cypress Config object. */ const setBaseUrl = async ( on, config ) => { - const wpEnvConfig = await readConfig( 'wp-env' ); + const cacheDirectory = await getCacheDirectory(); + const wpEnvConfig = await loadConfig( cacheDirectory ); if ( wpEnvConfig ) { const port = wpEnvConfig.env.tests.port || null;