Merge branch 'trunk' into feature/marketplace

This commit is contained in:
Kyle Nel 2023-08-22 13:16:13 +02:00 committed by GitHub
commit f2446da15f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
517 changed files with 54114 additions and 5807 deletions

View File

@ -24,9 +24,10 @@ runs:
run: |
sla_timestamp=$(date -d "+ 5 hours" -u +%s)
echo "sla_timestamp=$sla_timestamp" >> $GITHUB_OUTPUT
- name: Notify Slack
- name: Notify Slack Open
uses: archive/github-actions-slack@d9dae40827adf93bddf939db6552d1e392259d7d
id: notify
id: notify-open
if: steps.get_pr_status.outputs.pr_status == 'open'
with:
slack-bot-user-oauth-access-token: ${{ inputs.TEST_ASSISTANCE_BOT_TOKEN }}
slack-channel: ${{ inputs.WOO_PR_TESTING_ANALYSIS_SLACK_CHANNEL }}
@ -36,3 +37,15 @@ runs:
*SLA:* <!date^${{ steps.calculate_sla.outputs.sla_timestamp }}^{date_short_pretty} at {time}|5 hours from now>
slack-optional-unfurl_links: false
slack-optional-unfurl_media: false
- name: Notify Slack Merged
uses: archive/github-actions-slack@d9dae40827adf93bddf939db6552d1e392259d7d
id: notify-merged
if: steps.get_pr_status.outputs.pr_status == 'merged'
with:
slack-bot-user-oauth-access-token: ${{ inputs.TEST_ASSISTANCE_BOT_TOKEN }}
slack-channel: ${{ inputs.WOO_PR_TESTING_ANALYSIS_SLACK_CHANNEL }}
slack-text: |
There is a new *${{ steps.get_pr_status.outputs.pr_status }}* PR to analyze.
<${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}> :thread:
slack-optional-unfurl_links: false
slack-optional-unfurl_media: false

View File

@ -1,50 +0,0 @@
name: Build release asset
on:
release:
types: [published]
permissions: {}
jobs:
build:
name: Build release asset
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
with:
build: false
- name: Build zip
working-directory: plugins/woocommerce
run: bash bin/build-zip.sh
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: plugins/woocommerce/woocommerce.zip
asset_name: woocommerce.zip
asset_content_type: application/zip
update-code-reference:
if: github.event.release.prerelease == false && github.event.release.draft == false && github.repository_owner == 'woocommerce'
name: Update Code Reference
needs: build
runs-on: ubuntu-20.04
steps:
- name: Invoke Code Reference build and deploy workflow
uses: aurelien-baudet/workflow-dispatch@v2
with:
workflow: GitHub Pages deploy
repo: woocommerce/code-reference
token: ${{ secrets.CUSTOM_GH_TOKEN }}
ref: refs/heads/trunk
inputs: '{ "version": "${{ github.event.release.tag_name }}" }'

View File

@ -17,7 +17,7 @@ permissions: {}
jobs:
test:
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }} - ${{ matrix.unittests }}
timeout-minutes: 30
runs-on: ubuntu-20.04
permissions:

View File

@ -9,8 +9,6 @@ defaults:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PHPCS: ./plugins/woocommerce/vendor/bin/phpcs # Run WooCommerce phpcs setup in phpcs-changed instead of default
permissions: {}
@ -30,6 +28,7 @@ jobs:
id: changed-files
uses: tj-actions/changed-files@v32
with:
path: plugins/woocommerce
files: |
**/*.php
@ -41,6 +40,7 @@ jobs:
- name: Tool versions
if: steps.changed-files.outputs.any_changed == 'true'
working-directory: plugins/woocommerce
run: |
php --version
composer --version
@ -48,6 +48,7 @@ jobs:
- name: Run PHPCS
if: steps.changed-files.outputs.any_changed == 'true'
working-directory: plugins/woocommerce
run: |
HEAD_REF=$(git rev-parse HEAD)
git checkout $HEAD_REF

54
.github/workflows/pr-lint-js.yml vendored Normal file
View File

@ -0,0 +1,54 @@
name: Lint JS packages
on:
pull_request:
paths-ignore:
- '**/changelog/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
lint-test-js:
name: Lint
runs-on: ubuntu-20.04
permissions:
contents: read
# This is required to allow the action to annotate the PR with the linting results.
checks: write
pull-requests: read
steps:
- uses: actions/checkout@v3
- name: Setup PNPM
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd
with:
version: '8.6.7'
- name: Setup Node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version-file: .nvmrc
cache: pnpm
registry-url: 'https://registry.npmjs.org'
- name: Install prerequisites
run: |
# ignore scripts is faster, and postinstall should not be needed for lint.
pnpm install --ignore-scripts
- name: Lint
run: pnpm run -r --filter='release-posts' --filter='woocommerce/client/admin...' --filter='@woocommerce/monorepo-utils' --filter='!@woocommerce/e2e*' --filter='!@woocommerce/api' --color lint
continue-on-error: true
- name: Collect and Combine Eslint Reports
run: node ./.github/workflows/scripts/collect-eslint-reports.js
- name: Annotate Code Linting Results
uses: ataylorme/eslint-annotate-action@a1bf7cb320a18aa53cb848a267ce9b7417221526
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
report-json: 'combined_eslint_report.json'

64
.github/workflows/pr-lint-markdown.yml vendored Normal file
View File

@ -0,0 +1,64 @@
name: MarkdownLint on PR
on:
pull_request:
paths-ignore:
- '**/changelog/**'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
with:
files: |
**/*.md
- name: Setup PNPM
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd
with:
version: '8.6.7'
- name: Setup Node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version-file: .nvmrc
cache: pnpm
registry-url: 'https://registry.npmjs.org'
- name: Install prerequisites
run: |
pnpm i -g markdownlint-cli
- name: Lint changed markdown files
run: |
RED="\e[1;31m"
GREEN="\e[1;32m"
NC="\e[0m"
set -e
rc=0
changed_files="${{ steps.changed-files.outputs.all_changed_files }}"
if [ -n "$changed_files" ]; then
lint_results=""
for file in $changed_files; do
lint_result=$( { cat "$file" | markdownlint --stdin ; } 2>&1 ) || rc="$?"
if [ $rc -ne 0 ]; then
lint_results="$lint_results\n>>>Linting failed for file: $file <<<\n$lint_result\n--------"
fi
done
if [ $rc -ne 0 ]; then
echo -e "${RED}Linting failed for one or more files${NC}"
echo -e "$lint_results"
exit 1
else
echo -e "${GREEN}Linting successful for all files.${NC}"
fi
else
echo "No markdown files changed."
fi

View File

@ -1,29 +0,0 @@
name: Lint and tests for JS packages and woocommerce-admin/client
on:
pull_request:
paths-ignore:
- '**/changelog/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
lint-test-js:
name: Lint and Test JS
runs-on: ubuntu-20.04
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
- name: Lint
run: pnpm run -r --filter='release-posts' --filter='woocommerce/client/admin...' --filter='@woocommerce/monorepo-utils' --filter='!@woocommerce/e2e*' --filter='!@woocommerce/api' --color lint
- name: Test
run: pnpm run test --filter='woocommerce/client/admin...' --filter='@woocommerce/monorepo-utils' --filter='!@woocommerce/e2e*' --filter='@woocommerce/monorepo-utils' --filter='!@woocommerce/api' --color

40
.github/workflows/pr-test-js.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: Run tests for JS packages and woocommerce-admin/client
on:
pull_request:
paths-ignore:
- '**/changelog/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
test-js:
name: Run JS Tests
runs-on: ubuntu-20.04
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- name: Setup PNPM
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd
with:
version: '8.6.7'
- name: Setup Node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version-file: .nvmrc
cache: pnpm
registry-url: 'https://registry.npmjs.org'
- name: Install prerequisites
run: |
# ignore scripts is faster, and postinstall should not be needed for tests.
pnpm install --ignore-scripts
- name: Test
run: pnpm run test --filter='woocommerce/client/admin...' --filter='@woocommerce/monorepo-utils' --filter='!@woocommerce/e2e*' --filter='@woocommerce/monorepo-utils' --filter='!@woocommerce/api' --color

View File

@ -15,7 +15,7 @@ permissions: {}
jobs:
test:
if: ${{ github.event.pull_request.user.login != 'github-actions[bot]' }}
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }} ${{ matrix.hpos && 'HPOS' || '' }}
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }} - ${{ matrix.unittests }} ${{ matrix.hpos && 'HPOS' || '' }}
timeout-minutes: 30
runs-on: ubuntu-20.04
permissions:

View File

@ -20,6 +20,10 @@ jobs:
- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
- name: Lint
working-directory: plugins/woocommerce-beta-tester
run: composer run phpcs
- name: Build WooCommerce Beta Tester Zip
working-directory: plugins/woocommerce-beta-tester
run: pnpm build:zip

View File

@ -0,0 +1,34 @@
const fs = require( 'fs' );
const path = require( 'path' );
const rootDirectory = path.resolve( __dirname, '..', '..', '..' );
const allReports = [];
function collectReports( directory ) {
const files = fs.readdirSync( directory );
for ( const file of files ) {
const fullPath = path.join( directory, file );
const isDirectory = fs.statSync( fullPath ).isDirectory();
if ( isDirectory && file !== 'node_modules' && file !== 'vendor' ) {
const reportPath = path.join( fullPath, 'eslint_report.json' );
if ( fs.existsSync( reportPath ) ) {
// an array of items
const report = require( reportPath );
// add the report to the allReports array
allReports.push( ...report );
}
collectReports( fullPath );
}
}
}
collectReports( rootDirectory );
fs.writeFileSync(
'combined_eslint_report.json',
JSON.stringify( allReports, null, 2 )
);

3
.gitignore vendored
View File

@ -22,8 +22,9 @@ none
# Logs
logs/
# Eslint Cache
# Eslint
.eslintcache
eslint_report.json
# Environment files
wp-cli.local.yml

8
.markdownlint.json Normal file
View File

@ -0,0 +1,8 @@
{
"default": true,
"MD003": { "style": "atx" },
"MD007": { "indent": 4 },
"MD013": { "line_length": 9999 },
"no-hard-tabs": false,
"whitespace": false
}

View File

@ -76,7 +76,7 @@
"packages": [
"**"
],
"pinVersion": "^4.9.5"
"pinVersion": "^5.1.6"
},
{
"dependencies": [

View File

@ -1,5 +1,102 @@
== Changelog ==
= 8.0.2 2023-08-15 =
* Fix - Fix an issue which was causing some attributes to default to a minimum length of 3. [#39686](https://github.com/woocommerce/woocommerce/pull/39686)
= 8.0.1 2023-08-09 =
* Fix - bump WooCommerce blocks version to 10.6.5 [#39642](https://github.com/woocommerce/woocommerce/pull/39642)
= 8.0.0 2023-08-08 =
**WooCommerce**
* Fix - Set the order table exist options value when its not present for smooth upgradation from lower WC versions. [#39616](https://github.com/woocommerce/woocommerce/pull/39616)
* Fix - Add derivative features to legacy list so that warning is not generated for them. [#39537](https://github.com/woocommerce/woocommerce/pull/39537)
* Fix - Dequeue blocktheme styles on WooCommerce Admin pages when product block editor is enabled. [#39478](https://github.com/woocommerce/woocommerce/pull/39478)
* Fix - Do not disable "Used for variations" checkbox on attribute. [#39502](https://github.com/woocommerce/woocommerce/pull/39502)
* Fix - Adds a grace period during which email verification will not be needed before the order confirmation (or payment) page is rendered. [#39191](https://github.com/woocommerce/woocommerce/pull/39191)
* Fix - Fix turn off the new block experience when tracking is turned off [#39317](https://github.com/woocommerce/woocommerce/pull/39317)
* Fix - Restore woocommerce_variations_added jQuery trigger. [#39301](https://github.com/woocommerce/woocommerce/pull/39301)
* Fix - Add wrapper to the content generated by wc_empty_cart_message [[#38738]](https://github.com/woocommerce/woocommerce/pull/38738)
* Fix - Allow to add custom metabox to custom order edit page by setting the correct screen id. [[#38938]](https://github.com/woocommerce/woocommerce/pull/38938)
* Fix - Bootstrap server side block definitions [[#39027]](https://github.com/woocommerce/woocommerce/pull/39027)
* Fix - Comment: Fix "Used for variations" checkbox being disabled on Variable products [[#39106]](https://github.com/woocommerce/woocommerce/pull/39106)
* Fix - Convert DatabaseUtil::get_index_columns() to use SHOW INDEX FROM instead of INFORMATION_SCHEMA query [[#36427]](https://github.com/woocommerce/woocommerce/pull/36427)
* Fix - Decrease product total sales when an order is reversed [[#37842]](https://github.com/woocommerce/woocommerce/pull/37842)
* Fix - Do not show "Adding new attribute failed" error message when loading of product screens is interrupted by page unload. [[#38815]](https://github.com/woocommerce/woocommerce/pull/38815)
* Fix - do not use image size cache while in customizer [[#38875]](https://github.com/woocommerce/woocommerce/pull/38875)
* Fix - Fix attribute taxonomy templates when a templates for specific product attribute exists. [[#37552]](https://github.com/woocommerce/woocommerce/pull/37552)
* Fix - Fixed failing shipping zones tests and cleaned up locators [[#38949]](https://github.com/woocommerce/woocommerce/pull/38949)
* Fix - Fix grey background when menu is collapsed #38887 [[#38941]](https://github.com/woocommerce/woocommerce/pull/38941)
* Fix - Fix links under "Help" panel on Home screen [[#38817]](https://github.com/woocommerce/woocommerce/pull/38817)
* Fix - Fix Minimum Requirements in readme.txt file [[#39078]](https://github.com/woocommerce/woocommerce/pull/39078)
* Fix - Fix the issue of stores sending frequent Helper API requests when the store databases disk is full. [[#37378]](https://github.com/woocommerce/woocommerce/pull/37378)
* Fix - Fix the layout of View Cart link on the posts/pages [[#38950]](https://github.com/woocommerce/woocommerce/pull/38950)
* Fix - Fix undismissable store alert when using language localization [[#38967]](https://github.com/woocommerce/woocommerce/pull/38967)
* Fix - Fix unexpected gap on ipad and ipad mini [[#39108]](https://github.com/woocommerce/woocommerce/pull/39108)
* Fix - Linting fix to webpack config. [[#38920]](https://github.com/woocommerce/woocommerce/pull/38920)
* Fix - Make `WC_Order::get_item_subtotal()` always return a float. [[#36760]](https://github.com/woocommerce/woocommerce/pull/36760)
* Fix - OrdersTableDataStore: capture and log errors when populating order properties [[#38840]](https://github.com/woocommerce/woocommerce/pull/38840)
* Fix - Revert "Always show pricing group fields, disable if not available for a product type" [[#38964]](https://github.com/woocommerce/woocommerce/pull/38964)
* Fix - Support dynamic prop setting to use in refunds for setting correct props. [[#39219]](https://github.com/woocommerce/woocommerce/pull/39219)
* Fix - Trigger "woocommerce_newly_installed" hook for new installations [[#38694]](https://github.com/woocommerce/woocommerce/pull/38694)
* Fix - When dormant customer accounts are removed, their content should be preserved. [[#38837]](https://github.com/woocommerce/woocommerce/pull/38837)
* Fix - [HPOS] Backfill to post table only after order has persisted in orders table. [[#39196]](https://github.com/woocommerce/woocommerce/pull/39196)
* Add - Add support for BG, CZ, HR, HU, RO and SE in WCPay [[#38109]](https://github.com/woocommerce/woocommerce/pull/38109)
* Add - Add synchronization of deleted orders for HPOS [[#37050]](https://github.com/woocommerce/woocommerce/pull/37050)
* Add - Add Variations tab to Product block editor [[#38921]](https://github.com/woocommerce/woocommerce/pull/38921)
* Add - Allow registered React-powered pages to specify a parent navigation menu item to highlight when active. [[#39116]](https://github.com/woocommerce/woocommerce/pull/39116)
* Add - Introduce the add and edit view Tracks events in the new form [[#39186]](https://github.com/woocommerce/woocommerce/pull/39186)
* Add - Register woocommerce/product-variations-fields block [[#39038]](https://github.com/woocommerce/woocommerce/pull/39038)
* Add - Removed Avalara from Tax task list item [[#39238]](https://github.com/woocommerce/woocommerce/pull/39238)
* Add - Show create campaign button when there are campaign types in marketing page. [[#38825]](https://github.com/woocommerce/woocommerce/pull/38825)
* Update - Update WooCommerce Blocks to 10.6.4 [#39582](https://github.com/woocommerce/woocommerce/pull/39582)
* Update - Update WooCommerce Blocks to 10.6.3 [#39560](https://github.com/woocommerce/woocommerce/pull/39560)
* Update - Update WooCommerce Blocks to 10.6.2 [#39492](https://github.com/woocommerce/woocommerce/pull/39492)
* Update - Fix grammar in data-sharing agreement copy [#39327](https://github.com/woocommerce/woocommerce/pull/39327)
* Update - Update WooCommerce Blocks to 10.6.1 [#39299](https://github.com/woocommerce/woocommerce/pull/39299)
* Update - Add Klaviyo into onboarding marketing task list. [[#39087]](https://github.com/woocommerce/woocommerce/pull/39087)
* Update - Analytics API: A new filter_empty parameter that allows to remove from result customers with given empty fields [[#38827]](https://github.com/woocommerce/woocommerce/pull/38827)
* Update - Analytics API: Search for customers by all of the available fields instead of having to choose one [[#38628]](https://github.com/woocommerce/woocommerce/pull/38628)
* Update - Branding rollout - change WooCommerce Payments to WooPayments [[#39188]](https://github.com/woocommerce/woocommerce/pull/39188)
* Update - Change button text from "Install plugin" to "Install extension" in Marketing page. [[#39130]](https://github.com/woocommerce/woocommerce/pull/39130)
* Update - Remove TikTok from plugin suggestion list [[#39135]](https://github.com/woocommerce/woocommerce/pull/39135)
* Update - Update the call to marketing extensions recommendations API from version 1.2 to version 1.3 with new recommendation Klaviyo. [[#38974]](https://github.com/woocommerce/woocommerce/pull/38974)
* Update - Update WooCommerce Blocks to 10.6.0 [[#39144]](https://github.com/woocommerce/woocommerce/pull/39144)
* Update - Use wp_json_encode instead of print_r in output for HPOS-related WP CLI commands. [[#38699]](https://github.com/woocommerce/woocommerce/pull/38699)
* Dev - Add more assertions to `can add custom product attributes` E2E test. [[#39139]](https://github.com/woocommerce/woocommerce/pull/39139)
* Dev - Add pnpm commands for easier PHP linting [[#38727]](https://github.com/woocommerce/woocommerce/pull/38727)
* Dev - Cleanup global state after testing `wc_load_cart()`. [[#39136]](https://github.com/woocommerce/woocommerce/pull/39136)
* Dev - Enable HPOS through the `wp option` command. [[#39095]](https://github.com/woocommerce/woocommerce/pull/39095)
* Dev - Ensure `can discard industry changes when navigating back to "Store Details"'` can run independent from previous tests [[#38715]](https://github.com/woocommerce/woocommerce/pull/38715)
* Dev - Fix skipping of core profiler in page-loads.spec.js. [[#39084]](https://github.com/woocommerce/woocommerce/pull/39084)
* Dev - Improvements to the DI related unit testing infrastructure [[#38849]](https://github.com/woocommerce/woocommerce/pull/38849)
* Dev - Replace deprecated page methods. [[#38344]](https://github.com/woocommerce/woocommerce/pull/38344)
* Dev - Skip failing e2e test preventing PRs being merged. GH fails but local works [[#38855]](https://github.com/woocommerce/woocommerce/pull/38855)
* Dev - Update locators in `order-emails` and `order-email-receiving` specs so that they pass on WP 6.3. [[#39159]](https://github.com/woocommerce/woocommerce/pull/39159)
* Dev - Update locators in `order-emails` spec, and use the latest version of WP Mail Logging. [[#39013]](https://github.com/woocommerce/woocommerce/pull/39013)
* Dev - Update pnpm monorepo-wide to 8.6.5 [[#38990]](https://github.com/woocommerce/woocommerce/pull/38990)
* Dev - Update `wp-env` to version 8.2.0. [[#39100]](https://github.com/woocommerce/woocommerce/pull/39100)
* Dev - Use grunt-contrib-uglify-es to handle legacy es6" [[#38342]](https://github.com/woocommerce/woocommerce/pull/38342)
* Tweak - Add autoFocus attribute to product-name-field block [[#39050]](https://github.com/woocommerce/woocommerce/pull/39050)
* Tweak - Corrects a minor issue (incorrect HTML markup) in the System Status Report. [[#39053]](https://github.com/woocommerce/woocommerce/pull/39053)
* Tweak - Remove letter-spacing from the core profiler headers; Use 500 for font-weight. [[#39042]](https://github.com/woocommerce/woocommerce/pull/39042)
* Tweak - Replace "Proceed" with "Continue" to be more consistent [[#38961]](https://github.com/woocommerce/woocommerce/pull/38961)
* Tweak - Restore user's plugin selection when there is an installation error [[#38922]](https://github.com/woocommerce/woocommerce/pull/38922)
* Tweak - Update CSS styles for the core profiler header [[#39059]](https://github.com/woocommerce/woocommerce/pull/39059)
* Tweak - Use existing table instead of 'DUAL' to support hosts which do not support 'DUAL'. [[#39111]](https://github.com/woocommerce/woocommerce/pull/39111)
* Tweak - When detecting which plugins are WooCommerce-aware, improve accuracy by ignoring cached plugin data. [[#38836]](https://github.com/woocommerce/woocommerce/pull/38836)
* Tweak - When displaying partial consumer keys in the REST API settings, replace ellipses with asterisks.
* Enhancement - Add action for 'order_edit_form_top' as a replacement to edit_form_top for HPOS. [[#39165]](https://github.com/woocommerce/woocommerce/pull/39165)
* Enhancement - Add filter `woocommerce_redirect_order_location` for consistency with posts and HPOS. [[#39193]](https://github.com/woocommerce/woocommerce/pull/39193)
* Enhancement - New product block editor modal text enhancements [[#39055]](https://github.com/woocommerce/woocommerce/pull/39055)
* Enhancement - Refresh UX to enable HPOS to make it user friendly. [[#38993]](https://github.com/woocommerce/woocommerce/pull/38993)
= 7.9.0 2023-07-17 =
**WooCommerce**
@ -1224,7 +1321,7 @@
* Update - Update WooCommerce Blocks to 8.7.5 [#35428](https://github.com/woocommerce/woocommerce/pull/35428)
* Update - Improve the warnings about incompatibilities between plugins and features [#35198](https://github.com/woocommerce/woocommerce/pull/35198)
* Update - Additional payment methods on new WCPay promotion page (payment-welcome) [#34581](https://github.com/woocommerce/woocommerce/pull/34581)
* Update - Add Tiktok to free grow extensions list [#34953](https://github.com/woocommerce/woocommerce/pull/34953)
* Update - Add TikTok to free grow extensions list [#34953](https://github.com/woocommerce/woocommerce/pull/34953)
* Update - Allowing generic item type in new experimental SelectControl. [#34547](https://github.com/woocommerce/woocommerce/pull/34547)
* Update - Change order data store internal key to props for better representation. [#34627](https://github.com/woocommerce/woocommerce/pull/34627)
* Update - Changing inbox display to only 5 notes with the ability to load more. [#35003](https://github.com/woocommerce/woocommerce/pull/35003)

View File

@ -0,0 +1,191 @@
Like many WordPress plugins, WooCommerce provides a range of actions and filters through which developers can extend and modify the platform.
Often, when writing new code or revising existing code, there is a desire to add new hooks—but this should always be done with thoughtfulness and care. This document aims to provide high-level guidance on the matter.
Practices we generally allow, support and encourage include:
* [Using existing hooks (or other alternatives) in preference to adding new hooks](#prefer-existing-hooks-or-other-alternatives)
* [Adding lifecycle hooks](#adding-lifecycle-hooks)
* [Optional escape hooks](#escape-hooks)
* [Modifying the inputs and outputs of global rendering functions](#modifying-function-input-and-output-global-rendering-functions)
* [Preferring the passing of objects over IDs](#prefer-passing-objects-over-ids)
On the flip side, there are several practices we discourage:
* [Tying lifecycle hooks to methods of execution](#tying-lifecycle-hooks-to-methods-of-execution)
* [Using filters as feature flags](#using-filters-as-feature-flags)
* [Placing filter hooks inside templates and data stores](#placement-of-filter-hooks)
* [Enumeration values within hook names](#enumeration-values-inside-hook-names)
Beyond those items, we generally otherwise adhere to WordPress coding standards. In regards to hooks, that specifically means following the:
* [Documentation standards for hooks](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/#4-hooks-actions-and-filters)
* [Guidance on Dynamic hook names](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#interpolation-for-naming-dynamic-hooks)
Please note that we provide example code throughout this guide to help illustrate some of the principles. However, to keep things concise, we usually omit unnecessary detail, including doc blocks (in practice, though, hooks should always be accompanied by doc blocks!).
### Prefer existing hooks (or other alternatives)
Hooks come with a long-term obligation: the last thing we want is to add a new hook that developers come to depend on, only to strip it away again. However, this can lead to difficulties when the time comes to refactor a piece of code that contains hooks, sometimes delaying meaningful change or limiting how easily we can implement a change without compromising on backward compatibility commitments.
For those reasons, we always prefer that—wherever reasonable—an existing hook or alternative approach in preference to adding a new hook.
### Adding lifecycle hooks
Lifecycle hooks can be used to communicate that a lifecycle event is about to start, or that it has concluded. Examples of such events include:
* Main product loop
* Dispatching emails
* Rendering a template
* Product or order status changes
In general, lifecycle hooks:
* Come in pairs (before and after)
* Are always actions, never filters
* The before hook will generally always provide callbacks with the arguments array, if there is one
* The after hook will generally also provide callbacks with the functions return value, if there is one
Note that lifecycle hooks primarily exist to let other systems observe, rather than to modify the result. Of course, this does not stop the function author from additionally providing a filter hook that serves this function.
For example, noting that it is the process of fetching the promotions which we view as the “lifecycle event”, and not the function itself:
```php
function woocommerce_get_current_promotions( ...$args ) {
/* Any initial prep, then first lifecycle hook... */
do_action( 'woocommerce_before_get_current_promotions', $args );
/* ...Do actual work, then final lifecycle hook... */
do_action( 'woocommerce_after_get_current_promotions', $result, $args );
/* ...Return the result, optionally via a filter... */
return apply_filters( 'woocommerce_get_current_promotions', $result, $args );
}
```
### Escape hooks
In some cases, it may be appropriate to support short-circuiting of functions or methods. This is what we call an escape hook, and can be useful as a means of overriding code when a better way of doing so is not available.
* Escape hooks are always filters
* They should always supply null as the initial filterable value
* If the value is changed to a non-null value, then the function should exit early by returning that new value
For type safety, care should be taken to ensure that, if a function is short-circuited, the return type matches the function signature and/or return type stated in the function doc block.
Example:
```php
function get_product_metrics( $args ): array {
$pre = apply_filters( 'pre_woocommerce_get_product_metrics', null, $args );
if ( $pre !== null ) {
return (array) $pre;
}
/* ...Default logic... */
return $metrics;
}
```
### Modifying function input and output (global rendering functions)
In the case of global rendering or formatting functions (so-called “template tags”), where it is not readily possible to implement better alternatives, it is permissible to add filters for both the function arguments and the functions return value.
This should be done sparingly, and only where necessary. Remember that while providing opportunities for other components to perform extensive customization, it can potentially derail other components which expect unmodified output.
Example:
```php
function woocommerce_format_sale_price( ...$args ): string {
/* Prep to fill in any missing $args values... */
$args = (array) apply_filters( 'woocommerce_format_sale_price_args', $args );
/* ...Actual work to determine the $price string... */
return (string) apply_filters( 'woocommerce_format_sale_price', $price, $args );
}
```
### Prefer passing objects over IDs
Some actions or filters provide an object ID (such as a product ID) as their primary value, while others will provide the actual object itself (such as a product object). For consistency, it is preferred that objects be passed.
Example:
```php
function get_featured_product_for_current_customer( ) {
/* ...Logic to find the featured product for this customer… */
return apply_filters(
'woocommerce_featured_product_for_current_customer',
$product, /* WC_Product */
$customer
);
}
```
### Tying lifecycle hooks to methods of execution
There can sometimes be multiple paths leading to the same action. For instance, an order can be updated via the REST API, through the admin environment, or on the front end. It may additionally happen via ajax, or via a regular request.
It is important however not to tie hooks for high-level processes to specific execution paths. For example, an action that fires when an order is created must not only be fired when this happens in the admin environment via an ajax request.
Instead, prefer a more generic hook that passes context about the method of execution to the callback.
Example of what we wish to avoid:
```php
/**
* Pretend this function is only called following an ajax request
* (perhaps it is itself hooked in using a `wp_ajax_*` action).
*/
function on_ajax_order_creation() {
/* Avoid this! */
do_action( 'woocommerce_on_order_creation' );
}
```
### Using filters as feature flags
It is sometimes tempting to use a filter as a sort of feature flag, that enables or disables a piece of functionality. This should be avoided! Prefer using an option:
* Options persist in the database.
* Options are already filterable (ideal for a temporary override).
Example of what we wish to avoid:
```php
/* Avoid this */
$super_products_enabled = (bool) apply_filters( 'woocommerce_super_products_are_enabled', true );
/* Prefer this */
$super_products_enabled = get_option( 'woocommerce_super_products_are_enabled', 'no' ) === 'yes';
```
### Placement of filter hooks
Filters should not be placed inside templates—only actions. If it is important that a value used within a template be filterable, then the relevant logic should be moved to whichever function or method decides to load the template—the result being passed in as a template variable.
It is also preferred that filter hooks not be placed inside data-store classes, as this can reduce the integrity of those components: since, by design, they are replaceable by custom implementations—the risk of accidentally breaking those custom stores is higher.
### Enumeration values inside hook names
Though there is a case for dynamic hook names (where part of the hook name is created using a variable), a good rule of thumb is to avoid this if the variable contains what might be considered an enumeration value.
This might for instance include a case where an error code forms part of the hook name.
Example (of what we wish to avoid):
```php
if ( is_wp_error( $result ) ) {
/* Avoid this */
$error_code = $result->get_error_code();
do_action( "woocommerce_foo_bar_{$error_code}_problem", $intermediate_result );
/* Prefer this */
do_action( 'woocommerce_foo_bar_problem', $result );
}
```
The primary reason for avoiding this is that the more values there are in the enumeration set, the more filters developers have to include in their code.
### Summary
This document is a high-level guide to the inclusion and placement of hooks, not an exhaustive list. There will occasionally be exceptions, and there may be good rules and methodologies we are missing: if you have suggestions or ideas for improvement, please reach out!

View File

@ -4,4 +4,4 @@ Various code snippets you can add to your site to enable custom functionality:
- [Add a message above the login / register form](./before-login--register-form.md)
- [Change number of related products output](./number-of-products-per-row.md)
- [Unhook and remove WooCommerce emails](./unhook--remove-woocommerce-emails.md);
- [Unhook and remove WooCommerce emails](./unhook--remove-woocommerce-emails.md)

View File

@ -26,7 +26,7 @@
"clean": "pnpm store prune && git clean -fx **/node_modules && pnpm i",
"preinstall": "npx only-allow pnpm",
"postinstall": "pnpm git:update-hooks",
"git:update-hooks": "rm -r .git/hooks && mkdir -p .git/hooks && husky install",
"git:update-hooks": "if test -d .git; then rm -r .git/hooks && mkdir -p .git/hooks && husky install; else husky install; fi",
"create-extension": "node ./tools/create-extension/index.js",
"cherry-pick": "node ./tools/cherry-pick/bin/run",
"sync-dependencies": "pnpm exec syncpack -- fix-mismatches",
@ -60,7 +60,7 @@
"sass-loader": "^10.4.1",
"syncpack": "^10.7.3",
"turbo": "^1.10.7",
"typescript": "^4.9.5",
"typescript": "^5.1.6",
"url-loader": "^1.1.2",
"webpack": "^5.76.2"
},

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Make eslint emit JSON report for annotating PRs.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Upgrade TypeScript to 5.1.6

View File

@ -50,7 +50,7 @@
"jest-mock-extended": "^1.0.18",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.9.5"
"typescript": "^5.1.6"
},
"publishConfig": {
"access": "public"
@ -60,7 +60,7 @@
"prepare": "composer install",
"changelog": "composer exec -- changelogger",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"lint": "eslint src",
"lint": "eslint --output-file eslint_report.json --format json src",
"start": "tsc --project tsconfig.json --watch",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"lint:fix": "eslint src --fix",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Make eslint emit JSON report for annotating PRs.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Upgrade TypeScript to 5.1.6

View File

@ -33,7 +33,7 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"lint": "eslint src",
"lint": "eslint --output-file eslint_report.json --format json src",
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"build:css": "webpack",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",
@ -56,7 +56,7 @@
"react-dom": "^17.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"typescript": "^4.9.5",
"typescript": "^5.1.6",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
},

View File

@ -0,0 +1,4 @@
Significance: minor
Type: update
Returning promise from requestCompletion instead of event source.

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Make eslint emit JSON report for annotating PRs.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Upgrade TypeScript to 5.1.6

View File

@ -67,7 +67,7 @@
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"typescript": "^4.9.5",
"typescript": "^5.1.6",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
},
@ -79,7 +79,7 @@
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint src",
"lint": "eslint --output-file eslint_report.json --format json src",
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"build:css": "webpack",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",

View File

@ -109,7 +109,16 @@ export const useCompletion = ( {
completionSource.current = suggestionsSource;
return suggestionsSource;
return new Promise( ( resolve ) => {
( completionSource.current as EventSource ).addEventListener(
'message',
( event: MessageEvent ) => {
if ( event.data === '[DONE]' ) {
resolve( event.data );
}
}
);
} );
} catch ( e ) {
throw createExtendedError(
'An error occurred while connecting to the completion service',

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Make eslint emit JSON report for annotating PRs.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Upgrade TypeScript to 5.1.6

View File

@ -1,6 +1,6 @@
{
"name": "@woocommerce/api",
"version": "0.2.0",
"version": "0.3.0",
"author": "Automattic",
"description": "A simple interface for interacting with a WooCommerce installation.",
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/api/README.md",
@ -39,7 +39,7 @@
"compile": "tsc --project tsconfig.json",
"prepack": "pnpm run build",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"lint": "eslint src",
"lint": "eslint --output-file eslint_report.json --format json src",
"lint:fix": "eslint src --fix"
},
"dependencies": {
@ -58,7 +58,7 @@
"eslint": "^8.32.0",
"jest": "^27",
"ts-jest": "^27",
"typescript": "^4.9.5"
"typescript": "^5.1.6"
},
"publishConfig": {
"access": "public"

View File

@ -1,14 +1,11 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"types": [ "node", "jest", "axios", "create-hmac" ],
"types": [ "node", "jest", "create-hmac" ],
"rootDir": "src",
"outDir": "dist",
"target": "es5",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
"typeRoots": [ "./node_modules/@types" ]
},
"include": [ "src/" ]
}

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Add Tooltip to each list item when need it

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Allow users to select multiple items from the media library while adding images #39741

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Make eslint emit JSON report for annotating PRs.

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Upgraded Storybook to 6.5.17-alpha.0 for TypeScript 5 compatibility

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Upgrade TypeScript to 5.1.6

View File

@ -0,0 +1,4 @@
Significance: minor
Type: update
Update ImageGallery block toolbar, moving some options to an ellipsis dropdown menu.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
Categories dropdown display error #39810

View File

@ -100,18 +100,18 @@
"devDependencies": {
"@babel/core": "^7.17.5",
"@babel/runtime": "^7.17.2",
"@storybook/addon-actions": "^6.4.0",
"@storybook/addon-actions": "^6.5.17-alpha.0",
"@storybook/addon-console": "^1.2.3",
"@storybook/addon-controls": "^6.4.19",
"@storybook/addon-docs": "^6.4.19",
"@storybook/addon-controls": "^6.5.17-alpha.0",
"@storybook/addon-docs": "^6.5.17-alpha.0",
"@storybook/addon-knobs": "^6.4.0",
"@storybook/addon-links": "^6.4.19",
"@storybook/addons": "^6.4.0",
"@storybook/api": "^6.4.0",
"@storybook/components": "^6.4.0",
"@storybook/core-events": "^6.4.0",
"@storybook/react": "^6.4.19",
"@storybook/theming": "^6.4.0",
"@storybook/addon-links": "^6.5.17-alpha.0",
"@storybook/addons": "^6.5.17-alpha.0",
"@storybook/api": "^6.5.17-alpha.0",
"@storybook/components": "^6.5.17-alpha.0",
"@storybook/core-events": "^6.5.17-alpha.0",
"@storybook/react": "^6.5.17-alpha.0",
"@storybook/theming": "^6.5.17-alpha.0",
"@testing-library/dom": "^8.11.3",
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.3",
@ -141,7 +141,8 @@
"react": "^17.0.2",
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6",
"uuid": "^8.3.0",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
@ -153,11 +154,11 @@
"changelog": "composer exec -- changelogger",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint src --ext=js,ts,tsx",
"lint": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src",
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"build:css": "webpack",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"lint:fix": "eslint src --ext=js,ts,tsx --fix",
"lint:fix": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src --fix",
"prepack": "pnpm run clean && pnpm run build",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",
"test:update-snapshots": "pnpm run test -- --updateSnapshot",

View File

@ -1,6 +1,7 @@
/**
* External dependencies
*/
import { Tooltip } from '@wordpress/components';
import { createElement, CSSProperties, ReactElement } from 'react';
/**
@ -15,6 +16,7 @@ export type MenuItemProps< ItemType > = {
children: ReactElement | string;
getItemProps: getItemPropsType< ItemType >;
activeStyle?: CSSProperties;
tooltipText?: string;
};
export const MenuItem = < ItemType, >( {
@ -24,14 +26,27 @@ export const MenuItem = < ItemType, >( {
isActive,
activeStyle = { backgroundColor: '#bde4ff' },
item,
tooltipText,
}: MenuItemProps< ItemType > ) => {
return (
<li
style={ isActive ? activeStyle : {} }
{ ...getItemProps( { item, index } ) }
className="woocommerce-experimental-select-control__menu-item"
>
{ children }
</li>
);
function renderListItem() {
return (
<li
style={ isActive ? activeStyle : {} }
{ ...getItemProps( { item, index } ) }
className="woocommerce-experimental-select-control__menu-item"
>
{ children }
</li>
);
}
if ( tooltipText ) {
return (
<Tooltip text={ tooltipText } position="top center">
{ renderListItem() }
</Tooltip>
);
}
return renderListItem();
};

View File

@ -181,6 +181,7 @@ function SelectControl< ItemType = DefaultItemType >( {
highlightedIndex,
getItemProps,
selectItem,
// @ts-expect-error - TODO fix this type.
selectedItem: comboboxSingleSelectedItem,
openMenu,
closeMenu,
@ -203,6 +204,7 @@ function SelectControl< ItemType = DefaultItemType >( {
onInputChange( value, changes );
}
},
// @ts-expect-error - TODO fix this type.
stateReducer: ( state, actionAndChanges ) => {
const { changes, type } = actionAndChanges;
let newChanges;

View File

@ -104,6 +104,7 @@ export const SelectTreeMenu = ( {
}
) }
position={ position }
flip={ false }
animate={ false }
onFocusOutside={ ( event ) => {
if ( isEventOutside( event ) ) {

View File

@ -1,6 +1,6 @@
.woocommerce-image-gallery__item {
height: 146px;
width: 146px;
height: 146px;
width: 146px;
position: relative;
&.is-toolbar-visible {
@ -9,40 +9,38 @@
}
}
&:not(.is-toolbar-visible){
&:not(.is-toolbar-visible) {
img:hover {
border: 1.5px solid #007cba;
}
}
img {
img {
border: 1px solid $gray-200;
border-radius: 3px;
box-sizing: border-box;
object-fit: cover;
width: 100%;
height: 146px;
}
}
.woocommerce-pill {
background: var(--wp-admin-theme-color);
border: 0;
color: $white;
padding-top: 2px;
padding-bottom: 2px;
position: absolute;
top: 10px;
left: 10px;
}
.woocommerce-pill {
background: var(--wp-admin-theme-color);
border: 0;
color: $white;
padding-top: 2px;
padding-bottom: 2px;
position: absolute;
top: 10px;
left: 10px;
}
.components-toolbar-group {
flex-wrap: inherit;
border-right: 1px solid #ccc;
svg {
width: 24px;
margin-top: $gap-smallest;
}
}
}

View File

@ -0,0 +1,6 @@
// Hack to hide when the media modal is open
// Otherwise in Firefox the popover remains visible on top of the modal
// Changing the z-index of Popovers have wider implications.
.modal-open .woocommerce-image-gallery__toolbar-dropdown-popover {
display: none;
}

View File

@ -0,0 +1,101 @@
/**
* External dependencies
*/
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
import { moreVertical } from '@wordpress/icons';
import {
Children,
cloneElement,
createElement,
Fragment,
isValidElement,
} from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { MediaItem, MediaUpload } from '@wordpress/media-utils';
/**
* Internal dependencies
*/
import { MediaUploadComponentType } from './types';
const POPOVER_PROPS = {
className: 'woocommerce-image-gallery__toolbar-dropdown-popover',
placement: 'bottom-start',
};
type ImageGalleryToolbarDropdownProps = {
onReplace: ( media: { id: number } & MediaItem ) => void;
onRemove: () => void;
canRemove?: boolean;
removeBlockLabel?: string;
MediaUploadComponent: MediaUploadComponentType;
};
export function ImageGalleryToolbarDropdown( {
children,
onReplace,
onRemove,
canRemove,
removeBlockLabel,
MediaUploadComponent = MediaUpload,
...props
}: React.PropsWithChildren< ImageGalleryToolbarDropdownProps > ) {
return (
<DropdownMenu
icon={ moreVertical }
label={ __( 'Options', 'woocommerce' ) }
className="woocommerce-image-gallery__toolbar-dropdown"
popoverProps={ POPOVER_PROPS }
{ ...props }
>
{ ( { onClose } ) => (
<>
<MenuGroup>
<MediaUploadComponent
onSelect={ ( media ) => {
onReplace( media as MediaItem );
onClose();
} }
allowedTypes={ [ 'image' ] }
render={ ( { open } ) => (
<MenuItem
onClick={ () => {
open();
} }
>
{ __( 'Replace', 'woocommerce' ) }
</MenuItem>
) }
/>
</MenuGroup>
{ typeof children === 'function'
? children( { onClose } )
: Children.map(
children,
( child ) =>
isValidElement< { onClose: () => void } >(
child
) &&
cloneElement< { onClose: () => void } >(
child,
{ onClose }
)
) }
{ canRemove && (
<MenuGroup>
<MenuItem
onClick={ () => {
onClose();
onRemove();
} }
>
{ removeBlockLabel ||
__( 'Remove', 'woocommerce' ) }
</MenuItem>
</MenuGroup>
) }
</>
) }
</DropdownMenu>
);
}

View File

@ -1,4 +1,5 @@
.woocommerce-image-gallery__toolbar {
width: max-content;
position: absolute;
top: -58px;
left: 50%;

View File

@ -2,17 +2,25 @@
* External dependencies
*/
import { createElement } from '@wordpress/element';
import { Toolbar, ToolbarButton, ToolbarGroup } from '@wordpress/components';
import { chevronRight, chevronLeft, trash } from '@wordpress/icons';
import { MediaItem, MediaUpload } from '@wordpress/media-utils';
import { __ } from '@wordpress/i18n';
import {
Toolbar,
ToolbarButton,
ToolbarGroup,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore No types for this exist yet.
// eslint-disable-next-line @woocommerce/dependency-group
ToolbarItem,
} from '@wordpress/components';
/**
* Internal dependencies
*/
import { CoverImageIcon } from './icons';
import { SortableHandle } from '../sortable';
import { MediaUploadComponentType } from './types';
import { ImageGalleryToolbarDropdown } from './image-gallery-toolbar-dropdown';
export type ImageGalleryToolbarProps = {
childIndex: number;
@ -88,31 +96,60 @@ export const ImageGalleryToolbar: React.FC< ImageGalleryToolbarProps > = ( {
<ToolbarGroup>
<ToolbarButton
onClick={ () => setAsCoverImage( childIndex ) }
icon={ CoverImageIcon }
label={ __( 'Set as cover', 'woocommerce' ) }
>
{ __( 'Set as cover', 'woocommerce' ) }
</ToolbarButton>
</ToolbarGroup>
) }
{ isCoverItem && (
<ToolbarGroup className="woocommerce-image-gallery__toolbar-media">
<MediaUploadComponent
onSelect={ ( media ) =>
replaceItem( childIndex, media as MediaItem )
}
allowedTypes={ [ 'image' ] }
render={ ( { open } ) => (
<ToolbarButton onClick={ open }>
{ __( 'Replace', 'woocommerce' ) }
</ToolbarButton>
) }
/>
</ToolbarGroup>
) }
<ToolbarGroup className="woocommerce-image-gallery__toolbar-media">
<MediaUploadComponent
onSelect={ ( media ) =>
replaceItem( childIndex, media as MediaItem )
}
allowedTypes={ [ 'image' ] }
render={ ( { open } ) => (
<ToolbarButton onClick={ open }>
{ __( 'Replace', 'woocommerce' ) }
</ToolbarButton>
) }
/>
</ToolbarGroup>
<ToolbarGroup>
<ToolbarButton
onClick={ () => removeItem( childIndex ) }
icon={ trash }
label={ __( 'Remove', 'woocommerce' ) }
/>
</ToolbarGroup>
{ isCoverItem && (
<ToolbarGroup>
<ToolbarButton
onClick={ () => removeItem( childIndex ) }
icon={ trash }
label={ __( 'Remove', 'woocommerce' ) }
/>
</ToolbarGroup>
) }
{ ! isCoverItem && (
<ToolbarGroup>
<ToolbarItem>
{ ( toggleProps: {
'data-toolbar-item': boolean;
ref: React.ForwardedRef<
typeof ImageGalleryToolbarDropdown
>;
} ) => (
<ImageGalleryToolbarDropdown
canRemove={ true }
onRemove={ () => removeItem( childIndex ) }
onReplace={ ( media ) =>
replaceItem( childIndex, media )
}
MediaUploadComponent={
MediaUploadComponent
}
{ ...toggleProps }
/>
) }
</ToolbarItem>
</ToolbarGroup>
) }
</Toolbar>
</div>
);

View File

@ -129,6 +129,20 @@ export const ImageGallery: React.FC< ImageGalleryProps > = ( {
event.relatedTarget as Element
).closest(
'.media-modal, .components-modal__frame'
) ) ||
( event.relatedTarget &&
// Check if not a button within the toolbar is clicked, to prevent hiding the toolbar.
(
event.relatedTarget as Element
).closest(
'.woocommerce-image-gallery__toolbar'
) ) ||
( event.relatedTarget &&
// Prevent toolbar from hiding if the dropdown is clicked within the toolbar.
(
event.relatedTarget as Element
).closest(
'.woocommerce-image-gallery__toolbar-dropdown-popover'
) )
) {
return;

View File

@ -1,3 +1,4 @@
@import 'image-gallery.scss';
@import 'image-gallery-item.scss';
@import 'image-gallery-toolbar.scss';
@import "image-gallery.scss";
@import "image-gallery-item.scss";
@import "image-gallery-toolbar.scss";
@import "image-gallery-toolbar-dropdown.scss";

View File

@ -24,7 +24,7 @@ type MediaUploaderProps = {
MediaUploadComponent?: < T extends boolean = false >(
props: MediaUpload.Props< T >
) => JSX.Element;
multipleSelect?: boolean;
multipleSelect?: boolean | string;
onSelect?: (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
value: ( { id: number } & { [ k: string ]: any } ) | MediaItem[]
@ -96,6 +96,7 @@ export const MediaUploader = ( {
<MediaUploadComponent
onSelect={ onSelect }
allowedTypes={ allowedMediaTypes }
// @ts-expect-error - TODO multiple also accepts string.
multiple={ multipleSelect }
render={ ( { open } ) => (
<Button

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Bump required PHP version to 7.4

View File

@ -10,7 +10,7 @@
* Version: {{version}}
* Requires at least: 6.2
* WC requires at least: 7.8
* Requires PHP: 7.3
* Requires PHP: 7.4
{{#author}}
* Author: {{author}}
{{/author}}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Make eslint emit JSON report for annotating PRs.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Upgrade TypeScript to 5.1.6

View File

@ -41,7 +41,7 @@
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint src",
"lint": "eslint --output-file eslint_report.json --format json src",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
"prepack": "pnpm run clean && pnpm run build",
"lint:fix": "eslint src --fix",
@ -58,7 +58,7 @@
"concurrently": "^7.0.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.9.5"
"typescript": "^5.1.6"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Make eslint emit JSON report for annotating PRs.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Upgrade TypeScript to 5.1.6

View File

@ -44,7 +44,7 @@
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint src",
"lint": "eslint --output-file eslint_report.json --format json src",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
"prepack": "pnpm run clean && pnpm run build",
"lint:fix": "eslint src --fix",
@ -61,7 +61,7 @@
"concurrently": "^7.0.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.9.5"
"typescript": "^5.1.6"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Make eslint emit JSON report for annotating PRs.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Upgrade TypeScript to 5.1.6

View File

@ -64,7 +64,7 @@
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"typescript": "^4.9.5",
"typescript": "^5.1.6",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
},
@ -80,7 +80,7 @@
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint src",
"lint": "eslint --output-file eslint_report.json --format json src",
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"build:css": "webpack",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Add catalog_visibility property to the Product type

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Add default attributes property to the Product type

View File

@ -0,0 +1,4 @@
Significance: patch
Type: add
Add additional UserPreferences option type.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Add isGeneratingVariations selector to product variations store.

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Make eslint emit JSON report for annotating PRs.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Upgrade TypeScript to 5.1.6

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Update ProductAttributeTerms action types and include it as part of @wordpress/data module

View File

@ -0,0 +1,4 @@
Significance: patch
Type: tweak
Fix unintended reset of isRequesting when updating settings, add preemptive set isRequesting when optimistically updating settings

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Add new user preference to UserPreferences type.

View File

@ -71,7 +71,7 @@
"redux": "^4.1.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.9.5"
"typescript": "^5.1.6"
},
"peerDependencies": {
"@wordpress/core-data": "wp-6.0",
@ -87,7 +87,7 @@
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint src",
"lint": "eslint --output-file eslint_report.json --format json src",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
"prepack": "pnpm run clean && pnpm run build",
"lint:fix": "eslint src --fix",

View File

@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { combineReducers, registerStore, StoreConfig } from '@wordpress/data';
import { registerStore, StoreConfig } from '@wordpress/data';
import { Reducer } from 'redux';
/**
@ -28,8 +28,6 @@ export const createCrudDataStore = ( {
pluralResourceName,
storeConfig = {},
}: CrudDataStore ) => {
const crudReducer = createReducer();
const crudActions = createDispatchActions( {
resourceName,
namespace,
@ -54,13 +52,10 @@ export const createCrudDataStore = ( {
controls = {},
} = storeConfig;
const crudReducer = createReducer( reducer );
registerStore( storeName, {
reducer: reducer
? ( combineReducers( {
crudReducer,
reducer,
} ) as Reducer )
: ( crudReducer as Reducer< ResourceState > ),
reducer: crudReducer as Reducer< ResourceState >,
actions: { ...crudActions, ...actions },
selectors: { ...crudSelectors, ...selectors },
resolvers: { ...crudResolvers, ...resolvers },

View File

@ -27,7 +27,9 @@ export type ResourceState = {
requesting: Record< string, boolean >;
};
export const createReducer = () => {
export const createReducer = (
additionalReducer?: Reducer< ResourceState >
) => {
const reducer: Reducer< ResourceState, Actions > = (
state = {
items: {},
@ -284,11 +286,11 @@ export const createReducer = () => {
) ]: true,
},
};
default:
return state;
}
}
if ( additionalReducer ) {
return additionalReducer( state, payload );
}
return state;
};

View File

@ -1,8 +1,16 @@
/**
* External dependencies
*/
import { SelectFromMap } from '@automattic/data-stores';
/**
* Internal dependencies
*/
import { STORE_NAME, WC_PRODUCT_ATTRIBUTE_TERMS_NAMESPACE } from './constants';
import { createCrudDataStore } from '../crud';
import { ActionDispatchers, ProductAttributeTermsSelectors } from './types';
import { WPDataSelectors } from '../types';
import { PromiseifySelectors } from '../types/promiseify-selectors';
createCrudDataStore( {
storeName: STORE_NAME,
@ -12,3 +20,14 @@ createCrudDataStore( {
} );
export const EXPERIMENTAL_PRODUCT_ATTRIBUTE_TERMS_STORE_NAME = STORE_NAME;
declare module '@wordpress/data' {
// TODO: convert action.js to TS
function dispatch( key: typeof STORE_NAME ): ActionDispatchers;
function select(
key: typeof STORE_NAME
): SelectFromMap< ProductAttributeTermsSelectors > & WPDataSelectors;
function resolveSelect(
key: typeof STORE_NAME
): PromiseifySelectors< SelectFromMap< ProductAttributeTermsSelectors > >;
}

View File

@ -40,7 +40,7 @@ type MutableProperties = Partial<
type ProductAttributeTermActions = CrudActions<
'ProductAttributeTerm',
ProductAttributeTerm,
ProductAttributeTerm & { attribute_id: string },
MutableProperties,
'name'
>;

View File

@ -1,4 +1,6 @@
export enum TYPES {
GENERATE_VARIATIONS_REQUEST = 'GENERATE_VARIATIONS_REQUEST',
GENERATE_VARIATIONS_SUCCESS = 'GENERATE_VARIATIONS_SUCCESS',
GENERATE_VARIATIONS_ERROR = 'GENERATE_VARIATIONS_ERROR',
BATCH_UPDATE_VARIATIONS_ERROR = 'BATCH_UPDATE_VARIATIONS_ERROR',
}

View File

@ -2,6 +2,7 @@
* External dependencies
*/
import { apiFetch } from '@wordpress/data-controls';
import { controls } from '@wordpress/data';
/**
* Internal dependencies
@ -10,22 +11,67 @@ import { getUrlParameters, getRestPath, parseId } from '../crud/utils';
import TYPES from './action-types';
import { IdQuery, IdType, Item } from '../crud/types';
import { WC_PRODUCT_VARIATIONS_NAMESPACE } from './constants';
import type { BatchUpdateRequest, BatchUpdateResponse } from './types';
import type {
BatchUpdateRequest,
BatchUpdateResponse,
GenerateRequest,
} from './types';
import CRUD_ACTIONS from './crud-actions';
import { ProductAttribute } from '../products/types';
export function generateProductVariationsError( key: IdType, error: unknown ) {
return {
type: TYPES.GENERATE_VARIATIONS_ERROR as const,
key,
error,
errorType: 'GENERATE_VARIATIONS',
errorType: CRUD_ACTIONS.GENERATE_VARIATIONS,
};
}
export const generateProductVariations = function* ( idQuery: IdQuery ) {
export function generateProductVariationsRequest( key: IdType ) {
return {
type: TYPES.GENERATE_VARIATIONS_REQUEST as const,
key,
};
}
export function generateProductVariationsSuccess( key: IdType ) {
return {
type: TYPES.GENERATE_VARIATIONS_SUCCESS as const,
key,
};
}
export const generateProductVariations = function* (
idQuery: IdQuery,
productData: {
type?: string;
attributes: ProductAttribute[];
},
data: GenerateRequest
) {
const urlParameters = getUrlParameters(
WC_PRODUCT_VARIATIONS_NAMESPACE,
idQuery
);
const { key } = parseId( idQuery, urlParameters );
yield generateProductVariationsRequest( key );
try {
yield controls.dispatch(
'core',
'saveEntityRecord',
'postType',
'product',
{
id: urlParameters[ 0 ],
...productData,
}
);
} catch ( error ) {
yield generateProductVariationsError( key, error );
throw error;
}
try {
const result: Item = yield apiFetch( {
@ -35,12 +81,12 @@ export const generateProductVariations = function* ( idQuery: IdQuery ) {
urlParameters
),
method: 'POST',
data,
} );
yield generateProductVariationsSuccess( key );
return result;
} catch ( error ) {
const { key } = parseId( idQuery, urlParameters );
yield generateProductVariationsError( key, error );
throw error;
}
@ -86,3 +132,9 @@ export function* batchUpdateProductVariations(
throw error;
}
}
export type Actions = ReturnType<
| typeof generateProductVariationsRequest
| typeof generateProductVariationsError
| typeof generateProductVariationsSuccess
>;

View File

@ -0,0 +1,5 @@
export enum CRUD_ACTIONS {
GENERATE_VARIATIONS = 'GENERATE_VARIATIONS',
}
export default CRUD_ACTIONS;

View File

@ -1,9 +1,17 @@
/**
* External dependencies
*/
import { Reducer } from 'redux';
/**
* Internal dependencies
*/
import { STORE_NAME, WC_PRODUCT_VARIATIONS_NAMESPACE } from './constants';
import { createCrudDataStore } from '../crud';
import * as actions from './actions';
import * as selectors from './selectors';
import { reducer } from './reducer';
import { ResourceState } from '../crud/reducer';
createCrudDataStore( {
storeName: STORE_NAME,
@ -11,7 +19,9 @@ createCrudDataStore( {
pluralResourceName: 'ProductVariations',
namespace: WC_PRODUCT_VARIATIONS_NAMESPACE,
storeConfig: {
reducer: reducer as Reducer< ResourceState >,
actions,
selectors,
},
} );

View File

@ -0,0 +1,73 @@
/**
* External dependencies
*/
import { Reducer } from 'redux';
/**
* Internal dependencies
*/
import { Actions } from './actions';
import { TYPES } from './action-types';
import { ResourceState } from '../crud/reducer';
import { getRequestIdentifier } from '../crud/utils';
import CRUD_ACTIONS from './crud-actions';
const reducer: Reducer< ResourceState, Actions > = (
state = {
items: {},
data: {},
itemsCount: {},
errors: {},
requesting: {},
},
payload
) => {
if ( payload && 'type' in payload ) {
switch ( payload.type ) {
case TYPES.GENERATE_VARIATIONS_REQUEST:
return {
...state,
requesting: {
...state.requesting,
[ getRequestIdentifier(
CRUD_ACTIONS.GENERATE_VARIATIONS,
payload.key
) ]: true,
},
};
case TYPES.GENERATE_VARIATIONS_SUCCESS:
return {
...state,
requesting: {
...state.requesting,
[ getRequestIdentifier(
CRUD_ACTIONS.GENERATE_VARIATIONS,
payload.key
) ]: false,
},
};
case TYPES.GENERATE_VARIATIONS_ERROR:
return {
...state,
errors: {
...state.errors,
[ getRequestIdentifier(
payload.errorType,
payload.key
) ]: payload.error,
},
requesting: {
...state.requesting,
[ getRequestIdentifier(
CRUD_ACTIONS.GENERATE_VARIATIONS,
payload.key
) ]: false,
},
};
default:
return state;
}
}
return state;
};
export { reducer };

View File

@ -0,0 +1,24 @@
/**
* Internal dependencies
*/
import { ResourceState } from '../crud/reducer';
import { IdQuery } from '../crud/types';
import { getRequestIdentifier, getUrlParameters, parseId } from '../crud/utils';
import { WC_PRODUCT_VARIATIONS_NAMESPACE } from './constants';
import CRUD_ACTIONS from './crud-actions';
export const isGeneratingVariations = (
state: ResourceState,
idQuery: IdQuery
) => {
const urlParameters = getUrlParameters(
WC_PRODUCT_VARIATIONS_NAMESPACE,
idQuery
);
const { key } = parseId( idQuery, urlParameters );
const itemQuery = getRequestIdentifier(
CRUD_ACTIONS.GENERATE_VARIATIONS,
key
);
return state.requesting[ itemQuery ];
};

View File

@ -94,6 +94,10 @@ export type ProductVariationSelectors = CrudSelectors<
export type ActionDispatchers = DispatchFromMap< ProductVariationActions >;
export type GenerateRequest = {
delete?: boolean;
};
export type BatchUpdateRequest = {
create?: Partial< Omit< ProductVariation, 'id' > >[];
update?: ( Pick< ProductVariation, 'id' > &

View File

@ -36,12 +36,36 @@ export type ProductAttribute = {
options: string[];
};
/**
* Product - Default attributes properties
*/
export type ProductDefaultAttribute = {
/**
* Attribute ID.
*/
id: number;
/**
* Attribute name.
*/
name: string;
/**
* Selected attribute term name.
*/
option: string;
};
export type ProductDimensions = {
width: string;
height: string;
length: string;
};
export type ProductCatalogVisibility =
| 'visible'
| 'catalog'
| 'search'
| 'hidden';
export type Product< Status = ProductStatus, Type = ProductType > = Omit<
Schema.Post,
'status' | 'categories'
@ -53,12 +77,14 @@ export type Product< Status = ProductStatus, Type = ProductType > = Omit<
backorders_allowed: boolean;
button_text: string;
categories: Pick< ProductCategory, 'id' | 'name' | 'slug' >[];
catalog_visibility: ProductCatalogVisibility;
date_created: string;
date_created_gmt: string;
date_modified: string;
date_modified_gmt: string;
date_on_sale_from_gmt: string | null;
date_on_sale_to_gmt: string | null;
default_attributes: ProductDefaultAttribute[];
description: string;
dimensions: ProductDimensions;
download_expiry: number;

View File

@ -131,6 +131,8 @@ export function* updateAndPersistSettingsForGroup(
group: string,
data: Settings
) {
// Preemptively set requesting to allow for loading UI when optimistically updating settings.
yield setIsRequesting( group, true );
yield updateSettingsForGroup( group, data );
yield* persistSettingsForGroup( group );
}

View File

@ -89,7 +89,7 @@ const reducer: Reducer< SettingsState, Actions > = ( state = {}, action ) => {
: groupIds,
error,
lastReceived: time,
isRequesting: false,
isRequesting: state[ group ]?.isRequesting || false,
dirty:
state[ group ] && state[ group ].dirty
? union( state[ group ].dirty, groupIds )

View File

@ -26,7 +26,9 @@ export type UserPreferences = {
};
taxes_report_columns?: string;
variable_product_tour_shown?: string;
variable_product_block_tour_shown?: string;
variations_report_columns?: string;
product_block_variable_options_notice_dismissed?: string;
};
export type WoocommerceMeta = UserPreferences & {

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Make eslint emit JSON report for annotating PRs.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Upgrade TypeScript to 5.1.6

View File

@ -48,7 +48,7 @@
"concurrently": "^7.0.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.9.5"
"typescript": "^5.1.6"
},
"peerDependencies": {
"lodash": "^4.17.0"
@ -64,7 +64,7 @@
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint src",
"lint": "eslint --output-file eslint_report.json --format json src",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
"prepack": "pnpm run clean && pnpm run build",
"lint:fix": "eslint src --fix",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Make eslint emit JSON report for annotating PRs.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Upgrade TypeScript to 5.1.6

View File

@ -35,14 +35,14 @@
"jest-cli": "^27.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.9.5",
"typescript": "^5.1.6",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
},
"scripts": {
"prepare": "composer install",
"changelog": "composer exec -- changelogger",
"lint": "eslint src",
"lint": "eslint --output-file eslint_report.json --format json src",
"lint:fix": "eslint src --fix"
},
"lint-staged": {

View File

@ -57,8 +57,8 @@
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"clean": "rm -rf ./build ./build-module",
"compile": "e2e-builds",
"lint": "eslint src --ext=js,ts,tsx",
"lint:fix": "eslint src --ext=js,ts,tsx --fix"
"lint": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src",
"lint:fix": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src --fix"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -78,8 +78,8 @@
"test:e2e": "bash ./bin/wait-for-build.sh && ./bin/e2e-test-integration.js",
"test:e2e-debug": "bash ./bin/wait-for-build.sh && ./bin/e2e-test-integration.js --dev --debug",
"test:e2e-dev": "bash ./bin/wait-for-build.sh && ./bin/e2e-test-integration.js --dev",
"lint": "eslint src --ext=js,ts,tsx",
"lint:fix": "eslint src --ext=js,ts,tsx --fix"
"lint": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src",
"lint:fix": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src --fix"
},
"bin": {
"wc-e2e": "bin/wc-e2e.sh"

View File

@ -52,8 +52,8 @@
"clean": "rm -rf ./build ./build-module",
"compile": "e2e-builds",
"prepack": "pnpm run build",
"lint": "eslint src --ext=js,ts,tsx",
"lint:fix": "eslint src --ext=js,ts,tsx --fix"
"lint": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src",
"lint:fix": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src --fix"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Upgrade TypeScript to 5.1.6

View File

@ -53,7 +53,7 @@
"jest-cli": "^27.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.9.5"
"typescript": "^5.1.6"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Make eslint emit JSON report for annotating PRs.

Some files were not shown because too many files have changed in this diff Show More