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

Update jetpack CLI command to generate new blocks using block.json #33173

Closed
Tracked by #32602
jeherve opened this issue Sep 19, 2023 · 0 comments · Fixed by #33883
Closed
Tracked by #32602

Update jetpack CLI command to generate new blocks using block.json #33173

jeherve opened this issue Sep 19, 2023 · 0 comments · Fixed by #33883
Assignees
Labels
[Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Pri] Normal [Tools] Development CLI The tools/cli to assist during JP development. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Comments

@jeherve
Copy link
Member

jeherve commented Sep 19, 2023

Following #32697, we should encourage folks to use block.json to register new blocks in Jetpack. Updating the Jetpack CLI command would go a long way to do that:

/**
* Creates the essential files in Jetpack to start building a Gutenberg block or plugin.
*
* ## TYPES
*
* block: it creates a Jetpack block. All files will be created in a directory under extensions/blocks named based on the block title or a specific given slug.
*
* ## BLOCK TYPE OPTIONS
*
* The first parameter is the block title and it's not associative. Add it wrapped in quotes.
* The title is also used to create the slug and the edit PHP class name. If it's something like "Logo gallery", the slug will be 'logo-gallery' and the class name will be LogoGalleryEdit.
* --slug: Specific slug to identify the block that overrides the one generated based on the title.
* --description: Allows to provide a text description of the block.
* --keywords: Provide up to three keywords separated by comma so users can find this block when they search in Gutenberg's inserter.
* --variation: Allows to decide whether the block should be a production block, experimental, or beta. Defaults to Beta when arg not provided.
*
* ## BLOCK TYPE EXAMPLES
*
* wp jetpack scaffold block "Cool Block"
* wp jetpack scaffold block "Amazing Rock" --slug="good-music" --description="Rock the best music on your site"
* wp jetpack scaffold block "Jukebox" --keywords="music, audio, media"
* wp jetpack scaffold block "Jukebox" --variation="experimental"
*
* @subcommand scaffold block
* @synopsis <type> <title> [--slug] [--description] [--keywords] [--variation]
*
* @param array $args Positional parameters, when strings are passed, wrap them in quotes.
* @param array $assoc_args Associative parameters like --slug="nice-block".
*/
public function scaffold( $args, $assoc_args ) {


Primary issue: #32602

@jeherve jeherve added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Tools] Development CLI The tools/cli to assist during JP development. [Pri] Normal labels Sep 19, 2023
@jeherve jeherve self-assigned this Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Pri] Normal [Tools] Development CLI The tools/cli to assist during JP development. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant