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: Build individual blocks #31294

Closed
wants to merge 5 commits into from
Closed

Conversation

monsieur-z
Copy link
Contributor

@monsieur-z monsieur-z commented Jun 9, 2023

Fixes 1200913650729635-as-1199344868865051

Proposed changes:

This PR enables the loading of individual blocks assets (as opposed to chunk of assets).

In more details:

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

1200913650729635-as-1199344868865051

Does this pull request change what data or activity we track or use?

No.

Testing instructions:

TBD

@monsieur-z monsieur-z requested a review from a team June 9, 2023 13:05
@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Block] Business Hours Single labels Jun 9, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2023

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ⚠️ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team Review" label and ask someone from your team review the code. Once reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Jetpack plugin:

  • Next scheduled release: July 5, 2023.
  • Scheduled code freeze: June 26, 2023.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2023

Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run

bin/jetpack-downloader test jetpack update/extensions-build
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/extensions-build

to get started. More details: p9dueE-5Nn-p2

@@ -1017,6 +1017,11 @@ public static function get_extensions_preset_for_variation( $preset_extensions_m
$preset_extensions = array_unique( array_merge( $preset_extensions, $production_extensions ) );
}

$single_extensions = isset( $preset_extensions_manifest->single )
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sure blocks defined in the single array of the manifest are loaded in the backend.

*/
function register_block() {
$dir = dirname( JETPACK__PLUGIN_FILE );
$json_dir = $dir . '/_inc/blocks/' . FEATURE_NAME;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Path to folder containing built assets and the copy of block.json.

@@ -268,4 +301,53 @@ module.exports = [
} ),
],
},
{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Build assets (JS and CSS) for "single" blocks. It also copies the block.json file.

@monsieur-z monsieur-z added the DO NOT MERGE don't merge it! label Jun 20, 2023
@monsieur-z monsieur-z changed the title Update/extensions build Extensions: Build individual blocks Jun 21, 2023
@monsieur-z monsieur-z closed this Jun 29, 2023
@@ -39,7 +39,7 @@ class Blocks {
*
* @return WP_Block_Type|false The registered block type on success, or false on failure.
*/
public static function jetpack_register_block( $slug, $args = array() ) {
public static function jetpack_register_block( $slug, $args = array(), $metadata_dir = '' ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Directory holding the block.json metadata file.

@andrii-lysenko andrii-lysenko mentioned this pull request Jul 25, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Business Hours Single Blocks V2 DO NOT MERGE don't merge it! [Package] Blocks [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant