Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 798 forks source link

Block Editor Tools: revisit registration and directory structure #16816

Open jeherve opened 4 years ago

jeherve commented 4 years ago

Following-up from this comment and the conversation above: https://github.com/Automattic/jetpack/pull/16746#issuecomment-672771493

As we extend the type of editor tools we have in Jetpack (blocks, extended core blocks, sidebar plugins), I think it would be worth revisiting our directory structure in /extensions, as well as our registration tools.

Maybe we could have jetpack_register_block, jetpack_extend_block, and jetpack_register_plugin, all handling plan gating behind the scenes, and have a matching directory structure like:

extensions
|
`- shared          -- for utilties
- blocks          -- for blocks created by Jetpack
- plugins         -- for sidebar plugins like Social Previews, shortlinks, Publicize, ...
- extended-blocks -- for things like the VideoPress feature, the cover block extension, ...

This is not a small refactor, but I think it would be worth it to avoid further confusion in future work, by all the teams that contribute blocks to Jetpack.

cc @getdave @marekhrabe @retrofox @pablinos

This feels even more relevant now that we're working on updating the Paid flows (#16611).

retrofox commented 4 years ago

extensions | `- shared -- for utilties

  • blocks -- for blocks created by Jetpack
  • plugins -- for sidebar plugins like Social Previews, shortlinks, Publicize, ...
  • extended-blocks -- for things like the VideoPress feature, the cover block extension, ...

Some time ago, we've created ./extensions/shared/blocks/cover to extend the core/cover block.If I'm not misunderstanding, we should move it to /extensions/extended-blocks/cover. Is it correct?

Also, we should keep in mind we can extend many blocks from the same core/file/lib/whatever. This is the case of ./extensions/shared/premium-blocks developed in https://github.com/Automattic/jetpack/pull/16611. Should we move/create a folder into /extended-blocks for this too?

jeherve commented 4 years ago

If I'm not misunderstanding, we should move it to /extensions/extended-blocks/cover. Is it correct?

Right. This is just an idea that I had, though, I'm happy to discuss this further with y'all. I think it may be easier to find and understand for other contributors, but I may be wrong.

getdave commented 4 years ago

I did start on something like this here https://github.com/Automattic/jetpack/pull/16804

retrofox commented 4 years ago

I've moved the code of Paid blocks to ./extensions/extended-blocks/paid-blocks because basically, it extends blocks :smart:. I think it fits pretty well.