-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Composer's requiered packages not included in the zip archive with plugin-zip #47660
Comments
Hi @maeseoki, If you want to customize the files to be included in the zip file, the files field in package.json would be useful. For example: {
"name": "test-block",
"scripts": {
"plugin-zip": "wp-scripts plugin-zip"
},
"files": [
"vendor/your-package/**",
"build/**",
"includes/**",
"languages/**",
"test-block.php",
"uninstall.php",
"block.json",
"changelog.*",
"license.*",
"readme.*"
]
} |
Hi. Edit: As @t-hamano noted add /vendor/** to the files array and add a new script: This way you just include Composer's runtime dependencies and a faster autoloader and after plugin-zip you get again your dev dependencies. Composer will just remove dev dependencies and autoload classes with a classmap and then reinstall them so it's pretty fast. |
is it possible to exclude |
@dashkevych Thanks for the report. I was able to reproduce the problem, so I summarized it in #61171. |
Description
The script
plugin-zip
is not including composer's requiered packages to the final zip archive.When you're developing a plugin that requires some composer's dependencies for production those are not included in the final zip archive. Can't belive I'm the first one facing this issue.
As I can see in the
plugin-zip
script, the only files/folder included in the package are the ones included in the Wordpress' Best Practices:Is there any way to solve this?
Perfect solution is to include somehow just the
required
packages and not thedev-required
in the zip. A fast but lesser accurate is to include the vendor folder (but without modifying the script itself in node_modules wich is a problem for npm updates). And last but not least is to move composer's requiered packages to another folder, like includes.¿Any ideas about this?
Step-by-step reproduction instructions
Create a plugin with, for example,
npx create-block
.Then code your plugin and require a production dependency for php with composer (like chillerlan's qr-code)
Run the
plugin-zip
script with npm.Enjoy the fatal error you get.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: