Jetpack: Gutenberg: add mentions of the canonical source of all blocks

Created on 5 Nov 2018  Â·  8Comments  Â·  Source: Automattic/jetpack

It would be nice if contributors could quickly see where to go if they want to:

  • See the blocks' code uncompiled.
  • Make changes to one of the blocks.
  • See where the blocks are built.
  • Audit the contents of a block.

We could:

  • mention it in the Gutenberg readme.
  • add a comment at the top of the built files.
  • add a readme file in the Blocks directory.
Gutenberg [Type] Enhancement

Most helpful comment

A few thoughts…

  • The SDK is intended to compile source code that may not necessarily be part of Calypso. The SDK Gutenberg command isn't intended to be Jetpack specific. We should be wary of making it overly Jetpack specific.
  • The BannerPlugin placeholders aren't all that helpful because they the don't have enough info to build a link to the file in the Calypso repository. The banners would still be pretty generic.
  • The current set-up with the preset editor.js files, index.json and index-beta.json further complicate things. A banner /*! */ comment in editor.js would be compiled for Calypso but not for the bundle. Adding a shared file that only contains a comment would require a fair amount of logic to get it into the editor bundle and the individual view files.

I'm not sure what the best way forward is right now 😞

cc: @Automattic/luna @Automattic/poseidon

All 8 comments

I like adding it at the top of the built files so when folks are looking through the code to figure out how something works, it is right there. The readme file in the blocks directory would be my second.

@sirreal Do you think that is something we could do in Calypso when building the blocks, with something like Webpack's BannerPlugin?

It does look like something that wouldn't be too difficult with the BannerPlugin and placeholders:

https://webpack.js.org/plugins/banner-plugin/#placeholders

This _should_ be simple so we _should_ be able to get this ready for the next release, but I don't have time right now so I'll leave this issue up for grabs.

A few thoughts…

  • The SDK is intended to compile source code that may not necessarily be part of Calypso. The SDK Gutenberg command isn't intended to be Jetpack specific. We should be wary of making it overly Jetpack specific.
  • The BannerPlugin placeholders aren't all that helpful because they the don't have enough info to build a link to the file in the Calypso repository. The banners would still be pretty generic.
  • The current set-up with the preset editor.js files, index.json and index-beta.json further complicate things. A banner /*! */ comment in editor.js would be compiled for Calypso but not for the bundle. Adding a shared file that only contains a comment would require a fair amount of logic to get it into the editor bundle and the individual view files.

I'm not sure what the best way forward is right now 😞

cc: @Automattic/luna @Automattic/poseidon

I would say lets go with the minimum which is to add readme into the preset. Which then gets added to jetpack/_inc/blocks.

We can always add more info later if we need to.

+100 for a simple approach as a first iteration.

We also might need to figure out also how to ship non-minified versions of bundles to Jetpack, so that folks have easier time to debug clashes with our scripts with WP_DEBUG turned on.

@jeherve do you recon the readme is enough and this could be closed?

https://github.com/Automattic/jetpack/tree/fbc64c64878dc2c88b2605b3464244d477219180/extensions

Yeah, I think that's fine now that the files live in the repo.

Was this page helpful?
0 / 5 - 0 ratings