-
Notifications
You must be signed in to change notification settings - Fork 221
Conversation
This is set to |
Moving the config to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on @senadir 👏 This is going to be really useful for the work we're doing in this repo and gating things until it's ready for release. However, there are some problems with the current implementation and I also have some things I think we should consider:
- the frontend builds (
getFrontConfig
) andcoreConfig
might have gating as well so we should probably include the plugin definition in those configs too. I think this should be done before merging this pull. - While this works well for gating what javascript executes or not, there is no gating php side, so that means built javascript for gated features will still be enqueued and loaded. I don't think we need to tackle that in this pull but we probably should create a follow-up issue to discuss how we might handle that (or if we should bother).
71a289b
to
c36080c
Compare
So my latest changes are not complete. I addressed the feedback and added even more gating, since we output a js file for each block (well, 2 files), i moved those to this will cause some html errors since PHP will enqueue a nonexistent file, I'm adding some feature gating to PHP as well, but we still need a way to define the constant at run time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Liking how this is coming along! Thanks for addressing all the feedback. Just a few more things to take care of 👇
// cart & checkout blocks | ||
const experimentalMainEntry = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea to split out the stable from experimental configuration!
package.json
Outdated
"release": "sh ./bin/wordpress-deploy.sh", | ||
"build": "cross-env BABEL_ENV=default NODE_ENV=production webpack", | ||
"build:ci": "npm run build && npm run size-check && npm run lint:js && npm run lint:css", | ||
"start": "cross-env BABEL_ENV=default webpack --watch --info-verbosity none", | ||
"start": "cross-env WOOCOMMERCE_BLOCKS_PHASE=experimental BABEL_ENV=default webpack --watch --info-verbosity none", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed if the default is experimental
(npm build
or npm build:ci
executed on their own will be using experimental
too)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that we have default values in PHP as well, we don’t need to pass this yeah.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome Nadir! Soooo close to merge ready. I've tested and verified that the woo-blocks.ini
file has the correct value written to it depending on the WOOCOMMERCE_BLOCKS_PHASE
environment 👍
I just have a few more comments that should be addressed.
97fa606
to
043ba9b
Compare
@nerrad addressed the latest comments, this is ready for another spin |
d0ce5e9
to
d0aa8d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a suggestion for improving the php side detection of the blocks phase flag.
PHPUnit test jobs for travis are currently broken because of the default to stable
when the block.ini
file isn't present. We don't run webpack in the phpunit jobs because that extends the time of the job run unnecessarily. One thing you could do to resolve this is detect for a environment variable (using getenv('WOOCOMMERCE_BLOCKS_PHASE')
for the flag as a fallback. That way you can use that to alternatively set the flag instead of block.ini for environments like travis where we don't need to do a build step for php only tests. You can then just define the environment variable in the .travis.yml
config file for the phpunit jobs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 🌮 Woot! Another great pull to merge, awesome work @senadir!!!
This PR introduces a simple feature flag and gate features, as a start, it will only prevent Checkout and Cart from being registered.
It introduces
3 flags2 flags:Core,Stable, and Experimental.Any code not gated is considered stable enough to be included in Woo Core.
Experimental is code that is not stable yet to be shipped, think Cart and Checkout blocks by the end of last cycle.
For development purposes, the default flag will be
experimental
.We also append
WOOCOMMERCE_BLOCKS_PHASE="stable"
to the build command innpm run deploy
.To achieve this, I used a combo of
DefinePlugin
of webpack and an env variableWOOCOMMERCE_BLOCKS_PHASE
.This code heavily inspires from WordPress/gutenberg#13324
Fixes #1500