Skip to content

[DO NOT MERGE] Test @wordpress/*@next packages#46397

Closed
manzoorwanijk wants to merge 32 commits intotrunkfrom
test/wordpress-packages
Closed

[DO NOT MERGE] Test @wordpress/*@next packages#46397
manzoorwanijk wants to merge 32 commits intotrunkfrom
test/wordpress-packages

Conversation

@manzoorwanijk
Copy link
Copy Markdown
Member

Testing the @wordpress/* packages as requested in WordPress/gutenberg#73822 (comment)

Proposed changes:

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Go to '..'

@anomiex
Copy link
Copy Markdown
Contributor

anomiex commented Jan 12, 2026

There are both 06ee73755 and old ba3aee3a2 versions of packages and I'm unable to deduplicate them.

Looks like part of the problem there is that a version like 1.2.3-next.ba3aee3a2.0 compares as newer than 1.2.3-next.06ee73755.0 (because ba3aee3a2 > 06ee73755 as a string comparison), so it tends to incorrectly prefer the former for a caret version.

@anomiex
Copy link
Copy Markdown
Contributor

anomiex commented Jan 12, 2026

I fixed the questionable imports in WordPress/gutenberg#74530 and published a new next version, with the 06ee73755 hash.

Looks like you missed one: https://github.com/WordPress/gutenberg/pull/74530/changes#r2683062457 🙂

@jsnajdr
Copy link
Copy Markdown
Member

jsnajdr commented Jan 12, 2026

version like 1.2.3-next.ba3aee3a2.0 compares as newer than 1.2.3-next.06ee73755.0 (because ba3aee3a2 > 06ee73755 as a string comparison)

Well that's bad, and it's a bug in Gutenberg's version naming scheme for next packages. Let me see what we can do about it.

Looks like you missed one:

The moment-timezone omission was intentional, as it's the consumer (Jetpack) who should define an alias to a more optimized version.

On a second thought, I should probably have resolved this also to moment-timezone.js, and let consumers specify the alias for the name including the .js suffix.

@anomiex
Copy link
Copy Markdown
Contributor

anomiex commented Jan 12, 2026

Well that's bad, and it's a bug in Gutenberg's version naming scheme for next packages. Let me see what we can do about it.

One straightforward fix would be to name it like 1.2.3-next.$timestamp.$sha.0. Or, if these are always created via a build system and the build system has a monotonic build ID of some sort, that could work too.

The moment-timezone omission was intentional, as it's the consumer (Jetpack) who should define an alias to a more optimized version.

I don't see that documented in the package?

On a second thought, I should probably have resolved this also to moment-timezone.js, and let consumers specify the alias for the name including the .js suffix.

👍

@jsnajdr
Copy link
Copy Markdown
Member

jsnajdr commented Jan 13, 2026

One straightforward fix would be to name it like 1.2.3-next.$timestamp.$sha.0.

I'm trying to fix this in WordPress/gutenberg#74589, with a slightly different approach where the version number is 1.2.3-next.0+$sha. The .0 suffix added by Lerna should provide the auto-incrementing prerelease version number. And the commit SHA is only after the +, not affecting the semver comparison between two versions.

@anomiex
Copy link
Copy Markdown
Contributor

anomiex commented Jan 13, 2026

That sounds like it should work. 👍

@anomiex
Copy link
Copy Markdown
Contributor

anomiex commented Jan 13, 2026

Well, going forward anyway. 1.2.3-next.1 will be counted as being before 1.2.3-next.somesha by semver rules ("Numeric identifiers always have lower precedence than non-numeric identifiers.").

@jsnajdr
Copy link
Copy Markdown
Member

jsnajdr commented Jan 14, 2026

Well, going forward anyway. 1.2.3-next.1 will be counted as being before 1.2.3-next.somesha by semver rules

That's why I in the end merged a version that uses the 1.2.3-next.v.1 format. The v bit ensures that the version is always considered newer than any possible somesha one. And we can remove the v after the next public release that bumps the main 1.2.3 part of the version.

@jsnajdr
Copy link
Copy Markdown
Member

jsnajdr commented Jan 14, 2026

@anomiex @manzoorwanijk I updated this branch to the latest .next.v.0 packages and the results are very good: just one e2e failure for Jetpack sync. Can you determine if that's just a flaky test or is something still broken?

@manzoorwanijk
Copy link
Copy Markdown
Member Author

Yeah, the results are great. @anomiex Should we also see if we can clean up the .pnpmfile.cjs file?

@anomiex
Copy link
Copy Markdown
Contributor

anomiex commented Jan 14, 2026

I removed one unnecessary item from pnpmfile. For the real upgrade, we'll want most of what's left. We'd leave out the change to "next" on line 220. The extra .replace() on line 103 also isn't necessary, but won't hurt anything.

We'll also need the fix in projects/plugins/jetpack/tools/webpack.config.extensions.js, and the react deps in tools/js-tools/package.json thanks to @wordpress/stylelint-config adding a dep on @wordpress/theme.

@manzoorwanijk
Copy link
Copy Markdown
Member Author

Following WordPress/gutenberg#74576, we should be able to completely get rid of this file.

import apiFetchMod from '@wordpress/api-fetch';
/**
* Types
*/
import type { APIFetchOptions } from '@wordpress/api-fetch';
// @wordpress/api-fetch (as of 6.47.0) declares itself in such a way that tsc and node see the function at apiFetchMod.default
// while some other environments (including code running inside WordPress itself) see it at apiFetch.
// See https://arethetypeswrong.github.io/?p=@wordpress/api-fetch@6.47.0
// This is a helper to simplify the usage of the api-fetch module on the ai-client package.
const apiFetch = 'default' in apiFetchMod ? apiFetchMod.default : apiFetchMod;

@jsnajdr
Copy link
Copy Markdown
Member

jsnajdr commented Jan 15, 2026

we should be able to completely get rid of this file.

The caveat is that you never use the default export of api-fetch, only the new named one. The bug with the default export is not yet fixed. To fix that, we'll need to start providing dual .d.ts files. Instead of the current build-types/index.d.ts, which is always interpreted as CJS, we'll need to have also build-types/index.d.mjs.

@manzoorwanijk
Copy link
Copy Markdown
Member Author

The caveat is that you never use the default export of api-fetch, only the new named one.

Yes, that is what I meant. Using named import can help us get rid of that file.

@anomiex
Copy link
Copy Markdown
Contributor

anomiex commented Jan 15, 2026

Following WordPress/gutenberg#74576, we should be able to completely get rid of this file.

I think we'll need to wait for a few WordPress releases though, until that change is in the Core-bundled copy of the lowest version we support.

@anomiex
Copy link
Copy Markdown
Contributor

anomiex commented Jan 19, 2026

I think we're good to close this now. Most of it was incorporated into #46647, and the rest of what we need from here is in #46430 (a989ca8).

@anomiex anomiex closed this Jan 19, 2026
@anomiex anomiex deleted the test/wordpress-packages branch January 19, 2026 18:23
simison pushed a commit that referenced this pull request Jan 26, 2026
* Update dependency @wordpress/dataviews to v11.2.0
* Add needed fixes from #46397 not already included in #46647

---------

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Brad Jorsch <brad.jorsch@automattic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE don't merge it! E2E Tests [Feature] Forms [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations [Feature] Publicize Now Jetpack Social, auto-sharing [Feature] Theme Tools [Feature] WooCommerce Analytics [JS Package] AI Client [JS Package] API [JS Package] Base Styles [JS Package] Boost Score Api [JS Package] Charts [JS Package] Components [JS Package] Connection [JS Package] Eslint Config Target Es [JS Package] I18n Loader Webpack Plugin [JS Package] IDC [JS Package] Licensing [JS Package] Number Formatters [JS Package] Partner Coupon [JS Package] Publicize Components [JS Package] Scan [JS Package] Shared Extension Utils [JS Package] Social Logos [JS Package] Social Previews [JS Package] Storybook [JS Package] Webpack Config [Package] Assets [Package] Backup [Package] Blaze [Package] Classic Theme Helper [Package] Connection [Package] Explat [Package] External Connections [Package] External Media [Package] Forms [Package] Jetpack mu wpcom WordPress.com Features [Package] Jitm [Package] Masterbar [Package] My Jetpack [Package] Newsletter [Package] Paypal Payments [Package] Post List [Package] Publicize [Package] Search Contains core Search functionality for Jetpack and Search plugins [Package] Subscribers Dashboard [Package] VideoPress [Package] WooCommerce Analytics Enhanced analytics for WooCommerce users [Package] Yoast Promo [Plugin] Automattic For Agencies Client [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Classic Theme Helper Plugin [Plugin] CRM Issues about the Jetpack CRM plugin [Plugin] Inspect [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Paypal Payment Buttons [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Starter Plugin [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. RNA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants