-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Create Block: Add lifecycle script execution support #71072
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 lifecycle script execution support #71072
Conversation
- Execute postinstall script after npm install if present in package.json Fixes WordPress#71069
postinstall lifecycle script execution support|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
It looks like |
|
@gziolo Thanks for the feedback! I think the more idiomatic way would be to run a single |
…process to support lifecycle scripts
|
@gziolo, should we use |
This is exactly what @bacoords and I were thinking as well. Doing that would also allow us to potentially include a |
|
I updated the branch with the latest changes from |
@gziolo Thanks for the suggestion about unifying the I'd be happy to work on a follow-up PR |


What?
Closes #71069
Currently, when using custom templates with
@wordpress/create-block,postinstallscript is being ignored during the scaffolding process. They get added to the generatedpackage.jsonfile but are never executed during the initial setup.Why?
This is particularly problematic for external templates like WooCommerce's that rely on
postinstallscript for additional configuration and setup steps.How?
Added lifecycle script execution support in the
init-wp-scripts.js.Testing Instructions
Create a test template with a
postinstallscript inpackage.json:{ "scripts": { "postinstall": "echo 'Custom post-install setup complete'" } }Run
node packages/create-block/index.js test-block --template=./path/to/your/templatewith the templateVerify the lifecycle script executes and you see the logging output
Confirm the script runs successfully and the scaffolding process completes