Repository navigation
Conversation
Requires linking Calypso to Jetpack manually and Automattic/wp-calypso#26273
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
This is testing great! Also code looks good. Great work! 💯
I've left some comments and suggestions, nothing critical.
My $0.02: this is a wonderful example of a good developer experience from the plugin point of view. I'd like to see how that evolves as we bring pieces together for building the blocks in Calypso.
| blocks.forEach( block => { | ||
| console.log( `Building ${ block }` ); | ||
| // Relative to wp-calypso | ||
| const inputFile = path.join( 'client/gutenberg/extensions/', block ); |
There was a problem hiding this comment.
It would be good if we can change this directory when running the command.
There was a problem hiding this comment.
Yeah, I'd love to get rid of "client/gutenberg/extensions/" bit here because Jetpack shouldn't need to care about Calypso's internal structure.
There was a problem hiding this comment.
Maybe at least set it as a const at the top so it can be easily switched out later?
| "install-if-deps-outdated": "yarn check 2> /dev/null || yarn install --check-files", | ||
| "distclean": "rm -rf node_modules && yarn cache clean", | ||
| "build": "yarn install-if-deps-outdated && yarn build-client", | ||
| "build-blocks": "node ./bin/build-blocks.js", |
There was a problem hiding this comment.
What do you think about a single build-block command that would allow us to build a single block instead of all of them? For example we would want to build the one we're changing only, and not all of them every time.
There was a problem hiding this comment.
maybe this is a good optimization for later? what's the benefit? a slightly shorter built time?
There was a problem hiding this comment.
Yup, that's definitely good for later for when we build a ton of blocks this way, and it would make a difference.
| // 'jetpack/tiled-gallery/tiled-gallery.jsx', | ||
| ]; | ||
|
|
||
| const outputDir = path.resolve( '_inc/build/blocks' ); |
There was a problem hiding this comment.
This directory makes sense to me, but I'd like to confirm with someone from @Automattic/jetpack-crew that this is the right directory we'll want to place the externally built blocks.
There was a problem hiding this comment.
True; it probably isn't the right place. We'll need to wait for convos with @dereksmart and @oskosk
|
This will need some modifications because of Automattic/wp-calypso#26320 |
|
Shall we close this as superseded by #10279? |
|
Closing as per discussion in Slack. We are now going another way, with #10279 |
Adds a script to build all the blocks from Calypso, using Calypso as a dependency:
Does this approach make sense regarding developer-experience?
Currently, blocks live inside Calypso codebase but as the block builder evolves, blocks could live also inside Jetpack or in a separate repository.
This doesn't include yet anything regarding PHP, styles or i18n stuff yet since we don't have any of that in the builder neither.
This PR is just to add the first iteration of the entry point in Jetpack for all the work that is Calypso SDK block builder. We will keep iterating on developer experience further down the road.
Testing
Requires linking Calypso to Jetpack manually (temporarily until it can be pulled in as a dependency).
Inside Calypso folder:
Inside Jetpack folder:
Finally, you can run:
You should end up with
_inc/build/blocks/hello-dolly/blocks-hello-dolly.js-file in Jetpack.