-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Build: Update Gutenberg => Core integration #10638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build: Update Gutenberg => Core integration #10638
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @1178653+wordpress-develop-pr-bot[bot]@users.noreply.github.com. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Looks like there's an infinite loop because wp-build use time based hashes which triggers the "commit unsaved changes" on each commit. I'm going to disable that workflow temporarily. |
d03d49e to
cd57438
Compare
|
This is exciting! Also paves the way to run Gutenberg e2e tests :) |
db3c280 to
e9cd417
Compare
e9cd417 to
d2d8179
Compare
|
What I like about this process is that it actually clarifies what it takes to "integrate Gutenberg into Core" it all happens in a single command. While previously it was scattered all over the place. |
bd0eee2 to
cd9bf2c
Compare
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
cd9bf2c to
eff7b55
Compare
|
Ok I think this is ready to land personally. I'd love reviews though :) |
| /src/wp-includes/class-wp-block-parser-block.php | ||
| /src/wp-includes/class-wp-block-parser-frame.php | ||
| /src/wp-includes/theme.json | ||
| /src/wp-includes/theme-i18n.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we need to manually add this to svnignore too
|
|
||
| env: | ||
| PUPPETEER_SKIP_DOWNLOAD: ${{ true }} | ||
| NODE_OPTIONS: --max-old-space-size=4096 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typescript building on MacOS consumes more memory than the default allocated memory to node processes. I recall we had to do something similar elsewhere. (Without it the build fails on MacOS on CI)
ce9e365 to
0ef1698
Compare
Lower options_count threshold from 100 to 1 to avoid intermittent failures caused by InnoDB's TABLE_ROWS estimate fluctuations.
Trac ticket: https://core.trac.wordpress.org/ticket/64393
Summary
This PR changes WordPress Core's Gutenberg integration from npm packages to a checkout-and-build approach. Instead of syncing individual npm packages, Core now checks out the Gutenberg repository, builds it, and copies the build artifacts. This enables Core to use Gutenberg's advanced features like route-based navigation, full-page rendering, and the new Font Library. But also offers us the possibility to streamline more backports later (an example in this PR is the automatic copy of theme.json file). Check the issue for more details on the problem at hand.
New Build Pipeline
npm run gutenberg:checkoutclones Gutenberg at a specified refnpm run gutenberg:buildruns Gutenberg's build processnpm run gutenberg:copycopies and transforms build output to Corenpm run gutenberg:integrateruns all three stepsWhat Gets Copied
From Gutenberg build to Core:
/build/routes/→/src/wp-includes/build/routes//build/pages/→/src/wp-includes/build/pages//build/modules/→/src/wp-includes/js/dist/script-modules//build/scripts/→/src/wp-includes/js/dist//build/styles/→/src/wp-includes/css/dist//build/blocks/→/src/wp-includes/blocks/Path Transformations
The copy script transforms Gutenberg plugin paths to Core paths:
plugins_url()→includes_url()plugin_dir_path()→ABSPATH . WPINC . '/build/'Ideally these transformations shouldn't be needed, maybe we can make our "build" tool more generic to streamline the integration better and allow "building for core" directly. I'll look into that separately.
Webpack Changes
Removed webpack configs that are now replaced by Gutenberg's build:
tools/webpack/blocks.js- Using Gutenberg's block buildstools/webpack/packages.js- Using Gutenberg's script buildstools/webpack/script-modules.js- Using Gutenberg's module buildstools/webpack/development.js- Using Gutenberg's dev buildstools/webpack/vendors.js- Using Gutenberg's vendorstools/webpack/media.js- Kept (Core-specific files). to be honest, I'm not really sure if Webpack is needed for these files but I kept it unchanged for now, we could decide to remove the webpack dependency later entirely.Font Library Integration
Added
/wp-admin/font-library.phpas the first proof-of-concept using this new architecture.Some other changes.
src/wp-includes/script-modules.php@wordpress/interactivity(this has been removed from Gutenberg)Gruntfile.jspackage.jsonwp/*release branches in Gutenberg.Testing
I think there are a lot of simplifications we could do later (specially to the copy script) by aligning the folder structures more closely together (the build folder of Gutenberg, and the file structure for built scripts, styles, modules, pages... on Core). It does require changing some paths on Core. I do think it would be for the better but I kept it out of this PR.