-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
[Tool] WP Scripts/packages/scripts/packages/scripts[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
Originally reported in this comment.
The plugin-zip command refers to the files field in package.json and allows you to include directories and files other than the default in the zip file:
@wordpress/scripts – Block Editor Handbook > plugin-zip
However, if this field is defined, it seems that both package.json and readme.txt are always included in the zip. This means that if you want to include non-default assets in the plugin-zip command, these two files will always be included. Especially when it comes to package.json, you often don't want to include it when you want to publish your plugin.
I tried defining package.json as below, but the result did not change.
{
"name": "test-block",
"scripts": {
"plugin-zip": "wp-scripts plugin-zip"
},
"devDependencies": {
"@wordpress/scripts": "^27.7.0"
},
"files": []
}
{
"name": "test-block",
"scripts": {
"plugin-zip": "wp-scripts plugin-zip"
},
"devDependencies": {
"@wordpress/scripts": "^27.7.0"
},
"files": [ "!package.json" ]
}
{
"name": "test-block",
"scripts": {
"plugin-zip": "wp-scripts plugin-zip"
},
"devDependencies": {
"@wordpress/scripts": "^27.7.0"
},
"files": [ "!readme.txt" ]
}Log output:
npm run plugin-zip
> plugin-zip
> wp-scripts plugin-zip
Creating archive for `test-block` plugin... 🎁
Using the `files` field from `package.json` to detect files:
Adding `package.json`.
Adding `readme.txt`.
Done. `test-block.zip` is ready! 🎉
Step-by-step reproduction instructions
- Run
npx @wordpress/create-block test-block cd test-block- Update the
filesfield inpackage.json - Run
npm run plugin-zip
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
huubl and medavidallsop
Metadata
Metadata
Assignees
Labels
[Tool] WP Scripts/packages/scripts/packages/scripts[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended