Update to pnpm 9.1 (#47385)

* Update to pnpm 9.1 and fix a mini css bug

* Add changefile(s) from automation for the following project(s): @woocommerce/tracks, @woocommerce/product-editor, @woocommerce/onboarding, @woocommerce/number, @woocommerce/notices, @woocommerce/navigation, @woocommerce/internal-js-tests, @woocommerce/extend-cart-checkout-block, @woocommerce/expression-evaluation, @woocommerce/explat, @woocommerce/experimental, @woocommerce/eslint-plugin, @woocommerce/dependency-extraction-webpack-plugin, @woocommerce/date, @woocommerce/data, @woocommerce/customer-effort-score, @woocommerce/currency, @woocommerce/csv-export, @woocommerce/create-woo-extension, @woocommerce/create-product-editor-block, @woocommerce/components, @woocommerce/api, @woocommerce/ai, @woocommerce/admin-e2e-tests, woocommerce-blocks, woocommerce-beta-tester, woocommerce, woo-ai

* temporarily disable swallowing build output to diagnose issue with perf workflow

* Ignore some type issues that commonly resurface when deps slightly change

* Fix persistent type issues that have recurred many times

* Add more ignores

* Fix lint issue

* Revert change to swallow build error

* Improve access of the config that needs updated build dir.

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Sam Seay 2024-05-13 21:57:39 +08:00 committed by GitHub
parent 69fa74ef8d
commit 2db29164f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
100 changed files with 30732 additions and 23246 deletions

View File

@ -12,7 +12,7 @@
"dependencies": [
"pnpm"
],
"pinVersion": "^8.12.1",
"pinVersion": "^9.1.0",
"packages": [
"**"
]

View File

@ -5,7 +5,7 @@
"homepage": "https://woocommerce.com/",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"private": true,
"repository": {

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -6,7 +6,7 @@
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/admin-e2e-tests/README.md",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"repository": {
"type": "git",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -2,12 +2,14 @@
* External dependencies
*/
const WebpackRTLPlugin = require( 'webpack-rtl-plugin' );
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
/**
* Internal dependencies
*/
const { webpackConfig } = require( '@woocommerce/internal-style-build' );
const {
webpackConfig,
plugin,
} = require( '@woocommerce/internal-style-build' );
const NODE_ENV = process.env.NODE_ENV || 'development';
@ -24,7 +26,7 @@ module.exports = {
rules: webpackConfig.rules,
},
plugins: [
new MiniCssExtractPlugin( {
new plugin( {
filename: ( data ) => {
return data.chunk.name.startsWith( '/build/blocks' )
? `[name].css`

View File

@ -5,7 +5,7 @@
"main": "index.js",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"scripts": {
"e2e": "jest",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -6,7 +6,7 @@
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/api/README.md",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"repository": {
"type": "git",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -6,7 +6,7 @@
"license": "GPL-3.0-or-later",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"keywords": [
"wordpress",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -7,7 +7,7 @@
"main": "index.js",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"scripts": {
"changelog": "composer install && composer exec -- changelogger"

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -5,7 +5,7 @@
"main": "index.js",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"repository": {
"type": "git",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -6,7 +6,7 @@
"license": "GPL-3.0-or-later",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"keywords": [
"wordpress",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -11,7 +11,7 @@
],
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/currency/README.md",
"repository": {

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -10,7 +10,7 @@
],
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/customer-effort-score/README.md",
"repository": {

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -11,7 +11,7 @@
],
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/data/README.md",
"repository": {

View File

@ -118,6 +118,8 @@ export const useUserPreferences = () => {
// Get our dispatch methods now - this can't happen inside the callback below.
const dispatch = useDispatch( STORE_NAME );
const { addEntities, receiveCurrentUser, saveEntityRecord } = dispatch;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
let { saveUser } = dispatch;
const userData = useSelect( ( select ) => {
@ -125,8 +127,14 @@ export const useUserPreferences = () => {
getCurrentUser,
getEntity,
getEntityRecord,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
getLastEntitySaveError,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
hasStartedResolution,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
hasFinishedResolution,
} = select( STORE_NAME );
@ -149,8 +157,8 @@ export const useUserPreferences = () => {
) => {
// WP 5.3.x doesn't have the User entity defined.
if ( typeof saveUser !== 'function' ) {
// Polyfill saveUser() - wrapper of saveEntityRecord.
// @ts-expect-error No types exist.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
saveUser = async ( userToSave: {
id: number;
woocommerce_meta: { [ key: string ]: boolean };

View File

@ -16,7 +16,8 @@ import { WCUser } from './types';
*/
export const useUser = () => {
const userData = useSelect( ( select ) => {
// TODO: Update @types/wordpress__core-data to include the 'hasStartedResolution', 'hasFinishedResolution' method.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { getCurrentUser, hasStartedResolution, hasFinishedResolution } =
select( STORE_NAME );

View File

@ -25,6 +25,8 @@ export const withCurrentUserHydration = ( currentUser: WCUser ) =>
if ( ! currentUser ) {
return;
}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { isResolving, hasFinishedResolution } =
select( STORE_NAME );
return (
@ -33,6 +35,8 @@ export const withCurrentUserHydration = ( currentUser: WCUser ) =>
);
} );
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { startResolution, finishResolution, receiveCurrentUser } =
useDispatch( STORE_NAME );

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -11,7 +11,7 @@
],
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/date/README.md",
"repository": {

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -10,7 +10,7 @@
],
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/dependency-extraction-webpack-plugin/README.md",
"repository": {

View File

@ -10,7 +10,7 @@
"license": "GPL-3.0+",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"main": "build/index.js",
"module": "build-module/index.js",

View File

@ -12,7 +12,7 @@
],
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/e2e-environment/README.md",
"bugs": {

View File

@ -10,7 +10,7 @@
"license": "GPL-3.0+",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"main": "build/index.js",
"module": "build-module/index.js",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -6,7 +6,7 @@
"license": "GPL-2.0-or-later",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"keywords": [
"wordpress",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -6,7 +6,7 @@
"license": "GPL-3.0-or-later",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"keywords": [
"wordpress",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -6,7 +6,7 @@
"license": "GPL-2.0-or-later",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"keywords": [
"wordpress",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -12,7 +12,7 @@
],
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/expression-evaluation/README.md",
"repository": {

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -5,7 +5,7 @@
"main": "index.js",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"repository": {
"type": "git",

View File

@ -10,7 +10,7 @@
],
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"bin": {
"e2e-builds": "./build.js"

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -6,7 +6,7 @@
"license": "GPL-2.0-or-later",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/internal-js-tests/README.md",
"repository": {

View File

@ -11,6 +11,7 @@ const StyleAssetPlugin = require( './style-asset-plugin' );
const NODE_ENV = process.env.NODE_ENV || 'development';
module.exports = {
plugin: MiniCssExtractPlugin,
webpackConfig: {
parser: {
javascript: {

View File

@ -6,7 +6,7 @@
"license": "GPL-2.0-or-later",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"keywords": [
"wordpress",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -6,7 +6,7 @@
"license": "GPL-3.0-or-later",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"keywords": [
"wordpress",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -6,7 +6,7 @@
"license": "GPL-2.0-or-later",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"keywords": [
"wordpress",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -6,7 +6,7 @@
"license": "GPL-3.0-or-later",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"keywords": [
"wordpress",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -6,7 +6,7 @@
"license": "GPL-3.0-or-later",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"keywords": [
"wordpress",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -39,7 +39,8 @@ export function Edit( {
const displayBlocks = useSelect(
( select ) => {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const product: Product = select( 'core' ).getEditedEntityRecord(
'postType',
postType,

View File

@ -73,7 +73,8 @@ export const CreateTaxonomyModal: React.FC< CreateTaxonomyModalProps > = ( {
setErrorMessage( null );
setIsCreating( true );
try {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const newTaxonomy: Taxonomy = await saveEntityRecord(
'taxonomy',
slug,
@ -81,7 +82,8 @@ export const CreateTaxonomyModal: React.FC< CreateTaxonomyModalProps > = ( {
name,
parent: parent ? parent.id : null,
},
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
{
throwOnError: true,
}

View File

@ -44,7 +44,8 @@ export function Edit( {
const blockProps = useWooBlockProps( attributes );
const { hierarchical }: TaxonomyMetadata = useSelect(
( select ) =>
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
select( 'core' ).getTaxonomy( attributes.slug ) || {
hierarchical: false,
}

View File

@ -45,7 +45,8 @@ export function NameBlockEdit( {
}: ProductEditorBlockEditProps< NameBlockAttributes > ) {
const blockProps = useWooBlockProps( attributes );
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { editEntityRecord, saveEntityRecord } = useDispatch( 'core' );
const { hasEdit } = useProductEdits();
@ -55,7 +56,8 @@ export function NameBlockEdit( {
const productId = useEntityId( 'postType', 'product' );
const product: Product = useSelect( ( select ) =>
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
select( 'core' ).getEditedEntityRecord(
'postType',
'product',
@ -217,7 +219,8 @@ export function NameBlockEdit( {
onCancel={ () => setShowProductLinkEditModal( false ) }
onSaved={ () => setShowProductLinkEditModal( false ) }
saveHandler={ async ( updatedSlug ) => {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { slug, permalink }: Product =
await saveEntityRecord( 'postType', 'product', {
id: product.id,

View File

@ -37,7 +37,8 @@ export function Edit( {
isParentResolving,
}: { parentName: string; isParentResolving: boolean } = useSelect(
( select ) => {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { getEditedEntityRecord, hasFinishedResolution } =
select( 'core' );
const { name }: Product = getEditedEntityRecord(

View File

@ -75,7 +75,8 @@ export function ProductDetailsSectionDescriptionBlockEdit( {
const productId = useEntityId( 'postType', 'product' );
const { validate } = useValidations< Product >();
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { editEntityRecord, saveEditedEntityRecord, saveEntityRecord } =
useDispatch( 'core' );
const { createSuccessNotice, createErrorNotice } =
@ -94,7 +95,8 @@ export function ProductDetailsSectionDescriptionBlockEdit( {
const { isSaving } = useSelect(
( select ) => {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { isSavingEntityRecord } = select( 'core' );
return {
@ -253,7 +255,8 @@ export function ProductDetailsSectionDescriptionBlockEdit( {
},
],
},
// @ts-expect-error Expected 3 arguments, but got 4.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
{
throwOnError: true,
}

View File

@ -58,7 +58,9 @@ export function Header( {
{ enabled: productId !== -1 }
);
const lastPersistedProduct = useSelect(
const lastPersistedProduct = useSelect< Product | null >(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
( select ) => {
const { getEntityRecord } = select( 'core' );
return productId !== -1
@ -88,6 +90,8 @@ export function Header( {
} );
}, [ sidebarWidth ] );
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const isVariation = lastPersistedProduct?.parent_id > 0;
const selectedImage = isVariation ? product?.image : product?.images;
@ -222,6 +226,8 @@ export function Header( {
) : (
getHeaderTitle(
editedProductName,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - Arg is not typed correctly.
lastPersistedProduct?.name
)
) }
@ -235,12 +241,16 @@ export function Header( {
{ ! isVariation && (
<SaveDraftButton
productType={ productType }
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - Prop is not typed correctly.
productStatus={ lastPersistedProduct?.status }
/>
) }
<PreviewButton
productType={ productType }
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - Prop is not typed correctly.
productStatus={ lastPersistedProduct?.status }
/>

View File

@ -41,7 +41,8 @@ export function usePreview( {
const { hasEdits, isDisabled } = useSelect(
( select ) => {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { hasEditsForEntityRecord, isSavingEntityRecord } =
select( 'core' );
const isSaving = isSavingEntityRecord< boolean >(
@ -66,7 +67,8 @@ export function usePreview( {
const ariaDisabled = disabled || isDisabled || isValidating;
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { editEntityRecord, saveEditedEntityRecord } = useDispatch( 'core' );
/**

View File

@ -38,7 +38,8 @@ export function useSaveDraft( {
const { hasEdits, isDisabled } = useSelect(
( select ) => {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { hasEditsForEntityRecord, isSavingEntityRecord } =
select( 'core' );
const isSaving = isSavingEntityRecord< boolean >(
@ -67,7 +68,8 @@ export function useSaveDraft( {
( productStatus !== 'publish' && ! hasEdits ) ||
isValidating;
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { editEntityRecord, saveEditedEntityRecord } = useDispatch( 'core' );
async function saveDraft() {

View File

@ -37,7 +37,8 @@ export function Tabs( { onChange = () => {} }: TabsProps ) {
'id'
);
const product: Product = useSelect( ( select ) =>
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
select( 'core' ).getEditedEntityRecord(
'postType',
'product',

View File

@ -277,7 +277,8 @@ export function useVariations( { productId }: UseVariationsProps ) {
{ product_id: productId, id: variationId },
variation
).then( async ( response: ProductVariation ) => {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await dispatch( 'core' ).invalidateResolution( 'getEntityRecord', [
'postType',
'product_variation',
@ -305,14 +306,16 @@ export function useVariations( { productId }: UseVariationsProps ) {
} ).then( async ( response: ProductVariation ) => {
onSelect( response )( false );
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await dispatch( 'core' ).invalidateResolution( 'getEntityRecord', [
'postType',
'product',
productId,
] );
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await dispatch( 'core' ).invalidateResolution( 'getEntityRecord', [
'postType',
'product_variation',
@ -331,7 +334,8 @@ export function useVariations( { productId }: UseVariationsProps ) {
}
async function onBatchUpdate( values: PartialProductVariation[] ) {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { invalidateResolution: coreInvalidateResolution } =
dispatch( 'core' );
@ -399,7 +403,8 @@ export function useVariations( { productId }: UseVariationsProps ) {
}
async function onBatchDelete( values: PartialProductVariation[] ) {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { invalidateResolution: coreInvalidateResolution } =
dispatch( 'core' );

View File

@ -19,7 +19,8 @@ export function useConfirmUnsavedProductChanges(
const { hasEdits } = useProductEdits( productType );
const { isSaving } = useSelect(
( select ) => {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { isSavingEntityRecord } = select( 'core' );
return {

View File

@ -26,7 +26,8 @@ export function useProductEdits( productType = <string>'product' ) {
const { edits } = useSelect(
( select ) => {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { getEntityRecordNonTransientEdits } = select( 'core' );
const _edits = getEntityRecordNonTransientEdits(

View File

@ -61,7 +61,8 @@ export function useProductManager< T = Product >( postType: string ) {
const { isValidating, validate } = useValidations< T >();
const { isDirty } = useSelect(
( select ) => ( {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
isDirty: select( 'core' ).hasEditsForEntityRecord(
'postType',
postType,
@ -78,8 +79,11 @@ export function useProductManager< T = Product >( postType: string ) {
await validate( extraProps );
const { saveEntityRecord } = dispatch( 'core' );
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { blocks, content, selection, ...editedProduct } =
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
wpSelect( 'core' ).getEntityRecordEdits(
'postType',
postType,
@ -94,7 +98,8 @@ export function useProductManager< T = Product >( postType: string ) {
...extraProps,
id,
},
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
{
throwOnError: true,
}
@ -148,7 +153,8 @@ export function useProductManager< T = Product >( postType: string ) {
await validate();
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { deleteEntityRecord, saveEditedEntityRecord } =
dispatch( 'core' );

View File

@ -22,12 +22,14 @@ function useProductMetadata( options?: Options ) {
const thisId = useEntityId( 'postType', postType );
const id = options?.id || thisId;
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { editEntityRecord } = useDispatch( 'core' );
const { isLoading, meta_data } = useSelect(
( select ) => {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { getEditedEntityRecord, hasFinishedResolution } =
select( 'core' );
const { meta_data: metadata }: Product = getEditedEntityRecord(

View File

@ -112,7 +112,8 @@ export function useProductVariationsHelper() {
await Promise.all(
variations.map( ( variationId ) =>
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
dispatch( 'core' ).invalidateResolution( 'getEntityRecord', [
'postType',
'product_variation',
@ -157,7 +158,8 @@ export function useProductVariationsHelper() {
}
)
.then( async ( response ) => {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await dispatch( 'core' ).invalidateResolution(
'getEntityRecord',
[ 'postType', 'product', productId ]

View File

@ -16,7 +16,8 @@ export function useVariationSwitcher( {
parentId,
parentProductType,
}: VariationSwitcherProps ) {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { invalidateResolution } = useDispatch( 'core' );
const { invalidateResolutionForStoreSelector } = useDispatch(
EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME
@ -27,6 +28,8 @@ export function useVariationSwitcher( {
return {};
}
const { getEntityRecord } = select( 'core' );
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const parentProduct = getEntityRecord(
'postType',
parentProductType || 'product',
@ -35,13 +38,19 @@ export function useVariationSwitcher( {
if (
variationId !== undefined &&
parentProduct &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
parentProduct.variations
) {
const activeVariationIndex =
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
parentProduct.variations.indexOf( variationId );
const previousVariationIndex =
activeVariationIndex > 0 ? activeVariationIndex - 1 : null;
const nextVariationIndex =
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
activeVariationIndex !== parentProduct.variations.length - 1
? activeVariationIndex + 1
: null;
@ -50,14 +59,20 @@ export function useVariationSwitcher( {
activeVariationIndex,
nextVariationIndex,
previousVariationIndex,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
numberOfVariations: parentProduct.variations.length,
previousVariationId:
previousVariationIndex !== null
? parentProduct.variations[ previousVariationIndex ]
? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
parentProduct.variations[ previousVariationIndex ]
: null,
nextVariationId:
nextVariationIndex !== null
? parentProduct.variations[ nextVariationIndex ]
? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
parentProduct.variations[ nextVariationIndex ]
: null,
};
}

View File

@ -28,11 +28,15 @@ export default async function getRelatedProducts(
options: getRelatedProductsOptions = {}
): Promise< Product[] | undefined > {
const { getEntityRecord } = select( 'core' );
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const product = getEntityRecord( 'postType', 'product', productId );
if ( ! product ) {
return;
}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
let relatedProductIds = product?.related_ids;
if ( ! relatedProductIds?.length ) {
if ( ! options?.fallbackToRandomProducts ) {
@ -80,6 +84,7 @@ type getSuggestedProductsForOptions = {
/**
* Get suggested products for a given post ID.
*
*
* @param { getSuggestedProductsForOptions } options - Options.
* @return { Promise<Product[] | undefined> } Suggested products.
*/
@ -89,7 +94,8 @@ export async function getSuggestedProductsFor( {
forceRequest = false,
exclude = [],
}: getSuggestedProductsForOptions ): Promise< Product[] | undefined > {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { getEditedEntityRecord } = select( 'core' );
const data: Product = getEditedEntityRecord( 'postType', postType, postId );

View File

@ -21,7 +21,8 @@ export function useEvaluationContext( context: Record< string, unknown > ) {
const productId = useEntityId( 'postType', postType );
const getEvaluationContext = ( select: typeof WPSelect ) => {
// @ts-expect-error There are no types for this.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const editedProduct = select( 'core' ).getEditedEntityRecord(
'postType',
postType,

View File

@ -2,7 +2,6 @@
* External dependencies
*/
const CopyWebpackPlugin = require( 'copy-webpack-plugin' );
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
const path = require( 'path' );
const RemoveEmptyScriptsPlugin = require( 'webpack-remove-empty-scripts' );
const WebpackRTLPlugin = require( 'webpack-rtl-plugin' );
@ -12,6 +11,7 @@ const WebpackRTLPlugin = require( 'webpack-rtl-plugin' );
*/
const {
webpackConfig,
plugin,
StyleAssetPlugin,
} = require( '@woocommerce/internal-style-build' );
const {
@ -37,7 +37,7 @@ module.exports = {
},
plugins: [
new RemoveEmptyScriptsPlugin(),
new MiniCssExtractPlugin( {
new plugin( {
filename: ( data ) => {
return data.chunk.name.startsWith( '/build/blocks' )
? `[name].css`

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -6,7 +6,7 @@
"license": "GPL-3.0-or-later",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"keywords": [
"wordpress",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -94,7 +94,7 @@
},
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"lint-staged": {
"*.php": [

View File

@ -229,6 +229,8 @@ export const NoAIBanner = ( {
}
const currentTheme = useSelect( ( select ) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return select( 'core' ).getCurrentTheme() as Theme;
}, [] );

View File

@ -14,6 +14,8 @@ export const useSiteVisibilityTour = () => {
const { getCurrentUser } = select( 'core' );
const wasTourShown =
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
( getCurrentUser() as { meta?: { [ key: string ]: string } } )
?.meta?.[ LYS_TOUR_HIDDEN ] === 'yes';
@ -30,6 +32,8 @@ export const useSiteVisibilityTour = () => {
} );
const onClose = () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
dispatch( 'core' ).saveUser( {
id: window?.wcSettings?.currentUserId,
meta: {

View File

@ -62,6 +62,8 @@ export default function Products( props: ProductsProps ) {
}
const currentTheme = useSelect( ( select ) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return select( 'core' ).getCurrentTheme() as Theme;
}, [] );
const isDefaultTheme = currentTheme?.stylesheet === 'twentytwentyfour';

View File

@ -242,7 +242,7 @@
},
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"config": {
"ci": {

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -89,7 +89,7 @@
},
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"lint-staged": {
"*.php": [

View File

@ -273,7 +273,7 @@
},
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"dependencies": {
"@ariakit/react": "^0.4.4",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update pnpm to 9.1.0

View File

@ -368,7 +368,7 @@
},
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"browserslist": [
"> 0.1%",

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,7 @@
},
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"config": {
"ci": {

View File

@ -1,17 +1,34 @@
const packageJson = require( '../../package.json' );
let pnpm_package = 'pnpm';
const path = require( 'path' );
if ( packageJson.engines.pnpm ) {
pnpm_package = `pnpm@${ packageJson.engines.pnpm }`;
}
const getPnpmPackage = ( sourceDir ) => {
const packageJson = require( path.join( sourceDir, 'package.json' ) );
let pnpm_package = 'pnpm';
if ( packageJson.engines.pnpm ) {
pnpm_package = `pnpm@${ packageJson.engines.pnpm }`;
}
return pnpm_package;
};
const config = {
gitRepositoryURL: 'https://github.com/woocommerce/woocommerce.git',
setupTestRunner: `npm install -g ${ pnpm_package } && pnpm install --filter="@woocommerce/plugin-woocommerce" &> /dev/null && cd plugins/woocommerce && pnpm exec playwright install chromium`,
setupCommand: `npm install -g ${ pnpm_package } && pnpm install &> /dev/null && pnpm build &> /dev/null`,
pluginPath: '/plugins/woocommerce',
testsPath: '/plugins/woocommerce/tests/metrics/specs',
testCommand: `npm install -g ${ pnpm_package } && cd plugins/woocommerce && pnpm test:metrics`,
getSetupTestRunner: ( sourceDir ) => {
const pnpm_package = getPnpmPackage( sourceDir );
return `npm install -g ${ pnpm_package } && pnpm install --filter="@woocommerce/plugin-woocommerce" &> /dev/null && cd plugins/woocommerce && pnpm exec playwright install chromium`;
},
getSetupCommand: ( sourceDir ) => {
const pnpm_package = getPnpmPackage( sourceDir );
return `npm install -g ${ pnpm_package } && pnpm install &> /dev/null && pnpm build &> /dev/null`;
},
getTestCommand: ( sourceDir ) => {
const pnpm_package = getPnpmPackage( sourceDir );
return `npm install -g ${ pnpm_package } && cd plugins/woocommerce && pnpm test:metrics`;
},
};
module.exports = config;

View File

@ -19,6 +19,6 @@
},
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
}
}

View File

@ -87,7 +87,7 @@ function median( array ) {
*/
async function runTestSuite( testSuite, testRunnerDir, runKey ) {
await runShellScript(
`${ config.testCommand } ${ testSuite }`,
`${ config.getTestCommand( testRunnerDir ) } ${ testSuite }`,
testRunnerDir,
{
...process.env,
@ -211,7 +211,9 @@ async function runPerformanceTests( branches, options ) {
logAtIndent( 2, 'Installing dependencies and building' );
await runShellScript(
`bash -c "source $HOME/.nvm/nvm.sh && nvm install && ${ config.setupTestRunner }"`,
`bash -c "source $HOME/.nvm/nvm.sh && nvm install && ${ config.getSetupTestRunner(
testRunnerDir
) }"`,
testRunnerDir
);
@ -252,7 +254,9 @@ async function runPerformanceTests( branches, options ) {
logAtIndent( 3, 'Installing dependencies and building' );
await runShellScript(
`bash -c "source $HOME/.nvm/nvm.sh && nvm install && ${ config.setupCommand }"`,
`bash -c "source $HOME/.nvm/nvm.sh && nvm install && ${ config.getSetupCommand(
buildDir
) }"`,
buildDir
);

View File

@ -63,7 +63,7 @@
},
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"types": "dist/index.d.ts",
"config": {

View File

@ -67,7 +67,7 @@
},
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"config": {
"ci": {

View File

@ -58,7 +58,7 @@
},
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"types": "dist/index.d.ts",
"config": {

View File

@ -11,7 +11,7 @@
"license": "GPL-2.0-or-later",
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"devDependencies": {
"@tsconfig/node16": "^1.0.4",

View File

@ -19,7 +19,7 @@
},
"engines": {
"node": "^20.11.1",
"pnpm": "^8.12.1"
"pnpm": "^9.1.0"
},
"bugs": {
"url": "https://github.com/woocommerce/woocommerce/issues"