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

Extensions: add a new option to deliver an "Experimental" subset of blocks. #14104

Merged
merged 11 commits into from
Dec 19, 2019

Conversation

jeherve
Copy link
Member

@jeherve jeherve commented Nov 22, 2019

Changes proposed in this Pull Request:

We currently have 2 options when building and loading Jetpack blocks in the editor:
- Production blocks
- Beta blocks (loading production blocks and a small set of Beta blocks), available when using the JETPACK_BETA_BLOCKS constant.

This PR introduces a third option, aka variation, named "Experimental". This option loads both production blocks and a set of experimental blocks. It is automatically enabled if you use the Gutenberg plugin or the Full Site Editing plugin on your site. In practice, that would make that option available on all Atomic sites right away. The option can also be used when you don't use those plugins, via the JETPACK_EXPERIMENTAL_BLOCKS constant.

Is this a new feature or does it add/remove features to an existing part of Jetpack?

  • Internal reference: p4hfux-50G-p2#comment-7336

cc @dereksmart @kraftbj since we recently discussed different options.

Testing instructions:

  • Check out this PR.
  • Add define( 'JETPACK_BETA_BLOCKS', true ); to your site's wp-config.php file and make sure you can still see all blocks, including the Pinterest block (currently in Beta).
  • Remove that line.
  • Add define( 'JETPACK_EXPERIMENTAL_BLOCKS', true ); to your site's wp-config.php file and make sure you cannot still see the Pinterest block (currently in Beta).
  • Remove that line.
  • Activate the Gutenberg plugin.
  • Make sure you still cannot see the Pinterest block (currently in Beta).
  • Use yarn docker:wp jetpack scaffold block jeremy --variation="experimental" to create a brand new block.
  • Run yarn build-extensions to build that new block.
  • Make sure that:
    • that block was added to the experimental subset in extensions/index.json
    • that block is available to you as long as the Gutenberg plugin is active.
    • that block disappears from the block picker as soon as you deactivate Gutenberg.

Proposed changelog entry for your changes:

  • Extensions: add a new option to deliver an "Experimental" subset of blocks.

This will allow one to get a different list of extensions based on different parameters:
- plugin active
- constant
- filter
We now build 3 bundles:
- The default production bundle with just the production blocks.
- The experimental bundle with production blocks as well as experimental blocks.
- The beta bundle with all the blocks: production, experimental, and beta.
- When using the experimental variation, we need both prod and experimental blocks.
- When using beta blocks, we need all blocks.
@jeherve jeherve added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress [Pri] Normal [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack Build labels Nov 22, 2019
@jeherve jeherve added this to the 8.1 milestone Nov 22, 2019
@jeherve jeherve requested a review from a team as a code owner November 22, 2019 12:18
@jeherve jeherve self-assigned this Nov 22, 2019
@jetpackbot
Copy link

jetpackbot commented Nov 22, 2019

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

Scheduled Jetpack release: January 14, 2020.
Scheduled code freeze: January 7, 2020

Generated by 🚫 dangerJS against 8f12adb

@jeherve jeherve added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] In Progress labels Nov 22, 2019
extensions/README.md Outdated Show resolved Hide resolved
class.jetpack-gutenberg.php Outdated Show resolved Hide resolved
Copy link
Contributor

@kraftbj kraftbj left a comment

Choose a reason for hiding this comment

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

This all works well with virtually all documentation suggestions. Once the confirmation text on the CLI command is updated at least, ready to merge.

class.jetpack-cli.php Outdated Show resolved Hide resolved
...presetProductionBlocks,
..._.get( presetIndex, [ 'experimental' ], [] ),
];
const presetBetaBlocks = [ ...presetExperimentalBlocks, ..._.get( presetIndex, [ 'beta' ], [] ) ];
Copy link
Contributor

Choose a reason for hiding this comment

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

To me, when I hear "experimental", I think almost like it is "alpha" code and so seeing that experimental blocks are included in beta at first feels like the opposite of expectation.

With the block set meant to roll on special platforms (e.g. our Atomic infra), it makes sense since we don't want to roll beta out to them.

If there isn't a better word other than experimental, let's be very explicit that beta blocks includes experimental everywhere we discuss the concept or the constant.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, "experimental" may not be the best word for it. That's all I could come up with though :\

extensions/README.md Show resolved Hide resolved
extensions/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@kraftbj kraftbj left a comment

Choose a reason for hiding this comment

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

This all works well with virtually all documentation suggestions. Once the confirmation text on the CLI command is updated at least, ready to merge.

@kraftbj
Copy link
Contributor

kraftbj commented Dec 19, 2019

Also, in thinking about this as a set of blocks expecting the latest version of WP and/or the Gutenberg plugin, should we just call a spade and a spade and check for that?

Ensure the latest version of Gutenberg is installed (as a MVP we can hardcode the version and document that it should be bumped as new code is merged) before loading the experimental set? Since the beta package would have the same requirement, do we need to do that?

Or is that something that we document is the expectation (beta or experimental blocks expect Gutenberg and expect it to be kept up to date?)

@kraftbj
Copy link
Contributor

kraftbj commented Dec 19, 2019

Thanks for the updates! I'm good with this, so merge when you're happy!

@kraftbj kraftbj added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Dec 19, 2019
@jeherve
Copy link
Member Author

jeherve commented Dec 19, 2019

in thinking about this as a set of blocks expecting the latest version of WP and/or the Gutenberg plugin, should we just call a spade and a spade and check for that?

This was my first thought as well, but I ended up rollbacking based on our discussion in #14104 (comment)

I am happy to take a third approach though: have experimental blocks enabled if you use the constant AND the latest version of WP AND the latest version of Gutenberg. This way we wouldn't have to take any extra precautions when working on those blocks?

I'll merge this for now and we can iterate later.

@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello jeherve! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D36968-code before merging this PR. Thank you!

@jeherve jeherve merged commit c9e2901 into master Dec 19, 2019
@jeherve jeherve deleted the add/experimental-block-variation branch December 19, 2019 16:31
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Dec 19, 2019
@kraftbj
Copy link
Contributor

kraftbj commented Dec 19, 2019

Sounds good. I don't have a dog in the fight, just want to be sure we're setting the stage right if those blocks realistically are expecting latest Gutenberg.

jeherve added a commit that referenced this pull request Mar 6, 2020
Follow-up from #14104.

In some environments (like on WordPress.com), it may be easier to use a filter to change the way we load blocks.
kraftbj pushed a commit that referenced this pull request Mar 6, 2020
Follow-up from #14104.

In some environments (like on WordPress.com), it may be easier to use a filter to change the way we load blocks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Pri] Normal Touches WP.com Files [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants