Skip to content
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

Packages: Add the blocks module to the packages folder #8046

Merged
merged 5 commits into from
Jul 20, 2018

Conversation

youknowriad
Copy link
Contributor

Description

Part of #3955.

This PR extracts new @wordpress/blocks package.

How has this been tested?

Make sure all tests pass

@youknowriad youknowriad added the npm Packages Related to npm packages label Jul 19, 2018
@youknowriad youknowriad self-assigned this Jul 19, 2018
@youknowriad youknowriad requested review from gziolo and a team July 19, 2018 10:39
@@ -78,6 +78,13 @@ function gutenberg_register_scripts_and_styles() {
// WordPress packages.
wp_register_script( 'wp-tinymce', includes_url( 'js/tinymce/' ) . 'wp-tinymce.php', array() );

wp_register_script(
'wp-autop',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, autop was not a separate script but was bundled.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url and wordcount are also bundled into something, I bet editor or edit-post.

@youknowriad youknowriad force-pushed the add/blocks-package branch 2 times, most recently from 1f708c1 to 87a7c23 Compare July 19, 2018 10:43
/**
* External dependencies
*/
import { equal } from 'assert';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed assert in favor of Jest built-in asserters in all these tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, I like this 💯

*
* @param {Object} definitions Server-side block definitions
*/
export function unstable__bootstrapServerSideBlockDefinitions( definitions ) { // eslint-disable-line camelcase
Copy link
Contributor Author

@youknowriad youknowriad Jul 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows us to get rid of the global but it's unstable because the way we do this will change when we do #6733. I'm leaving the work for the final API here for the server-side registration work.

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added 4 very tiny commits to make Travis happy and ensure package.json aligns with others.

Everything looks great and tests well. Let's get it in and continue our efforts with the remaining modules 🎉

Awesome work @youknowriad 🥇

wp_localize_script( 'wp-blocks', '_wpBlocks', gutenberg_prepare_blocks_for_js() );
wp_add_inline_script(
'wp-blocks',
'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . json_encode( gutenberg_prepare_blocks_for_js() ) . ');'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, nice 👍

@gziolo gziolo added this to the 3.3 milestone Jul 20, 2018
@gziolo gziolo added the [Package] Blocks /packages/blocks label Jul 20, 2018
@gziolo gziolo merged commit 81d5569 into master Jul 20, 2018
@gziolo gziolo deleted the add/blocks-package branch July 20, 2018 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
npm Packages Related to npm packages [Package] Blocks /packages/blocks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants