Skip to content

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

Merged
gziolo merged 5 commits intomasterfrom
add/blocks-package
Jul 20, 2018
Merged

Packages: Add the blocks module to the packages folder#8046
gziolo merged 5 commits intomasterfrom
add/blocks-package

Conversation

@youknowriad
Copy link
Copy Markdown
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 a team and gziolo July 19, 2018 10:39
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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