npx @wordpress/create-block@latest blockname --template @wordpress/create-block-interactive-template
Some other options :
npx @wordpress/create-block@latest blockname --variant dynamic
npx @wordpress/create-block@latest blockname --variant dynamic --template es5
→ no node module, great for simple block, remove –variant for a static one.
To register the block : register_block_type( ${path of directory containing the block.json} );
In case of several block, optional but perfomance improving : wp_register_block_metadata_collection( $path, $manifest );
To generate a manifest : wp-scripts build-blocks-manifest
Sources: