-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Block: Add optional support for wp-env #28234
Conversation
eb50796
to
369c177
Compare
Size Change: 0 B Total Size: 1.28 MB ℹ️ View Unchanged
|
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.
Love the idea of this and the code works 👍
info( '' ); | ||
code( ` $ cd ${ slug }` ); | ||
code( ` $ npm start` ); | ||
code( ' $ npx wp-env start' ); |
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.
@noahtallen or @noisysocks, I chose to install @wordpress/env
as a local package:
https://github.com/WordPress/gutenberg/blob/master/packages/env/README.md#installation-as-a-local-package
The documentation recommends putting it inside the scripts
section. I skipped that in favor of:
npx wp-env start
I'm not sure what would be the best way here. I proposed we make wp-env
integration with Create Block optional. How would you approach it? Global or local installation? Can you install it globally from the Node process in the first place?
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.
Global install works via npm i -g @wordpress/env
, which is then accessible on the CLI as wp-env
That said, for local projects which you know will support wp-env for the environment, I do like installing it locally. Then, you know exactly what version is available for everyone, and no one has to do yet another extra set up command, since wp-env is included already.
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.
@noahtallen, thank you very much for the clarification. Everything is configured properly in that case 😄
Description
This PR adds a new CLI option
--wp-env
that lets users override the setting that the template defines for integration with@wordpress/env
package. This makes it possible to test the scaffolded block in the WordPress instance created by@wordpress/env
.How has this been tested?
To create a block
Then:
cd my-block npx wp-env start
Go to the browser and visit:
https://localhost:8888/wp-admin/
Insert a new post and enjoy the possibility to enter newly scaffolded block 🎉
Types of changes
New feature (non-breaking change which adds functionality).
Checklist: