Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#64222 new feature request

Improve the upgrade process for the Twemoji library

Reported by: desrosj's profile desrosj Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: 2nd-opinion
Focuses: javascript Cc:

Description

The current process for upgrading the Twemoji library is as follows:

  1. The new image assets from the Twemoji release must be uploaded to the wordpress.org CDN. This must be done before any testing occurs. Hitting the URL where a character is expected to be will prime the CDN's cache and should be viewed as having an indefinite lifespan.
    • When only new files/Emoji are added, the previous folder can be used. Since only the new files need to be fetched, it can help to save requests refetching the same asset at a new URL.
    • When old files/Emoji are modified and the modifications change the meaning or how the Emoji is interpreted, a new folder should be added to the CDN. For an example of this, see #51356 and the changes to the kneeling Emoji.
    • When old files/Emoji are modified and the modifications do not change the meaning or interpretation of the character, a new folder is not always necessary.
  2. Update the src/js/_enqueues/vendor/twemoji.js file to include the latest changes. There are WP specific changes in this file that must be preserved.
  3. The values of baseUrl, svgUrl, and $cdn_url variables in src/wp-includes/formatting.php and $png_cdn/$svg_cdn in tests/phpunit/tests/formatting/emoji.php should be updated to reflect the new paths for the w.org CDN locations.
  4. The Twemoji version queried in the replace:emoji-regex Grunt task found in Gruntfile.js should be updated to ensure the correct list of characters is retrieved.
  5. Run npm run grunt precommit:emoji to update the list of entities and partials in src/wp-includes/formatting.php.
  6. The emoji case within browserSupportsEmoji()` should be updated to test for a character in the most recently supported version of Emoji to ensure all characters are properly displayed.
  7. When a new flag is added or adjusted, the conditions used to the browser properly supports the latest version of Emoji in src/js/_enqueues/lib/emoji-loader.js` should be examined.
    • When a new letter locale flag is added, there is a check that should be updated to replace the previous, most recent one (currently Sark as of Emoji 16/[60227]).
    • There may be additional edge cases that warrant new checks. For example, England is a country within the United Kingdom and does not have a two letter locale. It's character sequence is represented by (black flag emoji + [G] + [B] + [E] + [N] + [G]).
    • The transgender flag is the (white flag emoji + transgender symbol) combined with either a ZWJ or zero-width space.
  8. The assertions performed in Tests_Formatting_Emoji::test_wp_emoji_list_returns_data are updated to reflect the update being applied.

Other notes:

Some of the steps above can and should be automated using a build task to help prevent mistakes when upgrading the library. For example, logic can be added to the precommit:emoji task to insert the two WordPress specific changes from [55186] into the final version of the file that's shipped in WordPress. Then, the package can be re-added as to the list of dependencies in the package.json file, and a new emoji-upgrade Grunt task could:

  • Update the library to the latest version (if there is one).
  • Update the version reference in the precommit:emoji Grunt task.
  • Perform the precommit:emoji Grunt task.

Change History (1)

#1 @desrosj
4 weeks ago

I've gone and created a page in the Core Handbook that documents the steps listed above for upgrading the Twemoji library.

Note: See TracTickets for help on using tickets.