You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scripts: Add new command which generates zip file for the plugin #19237
Plugin developers could benefit from having one command to run to output the zip file with all assets that should be included for the plugin to work in WordPress.
I discussed it with @bph and she raised the concern that having big folders like the node_modules one included might be not the best experience. She shared her workaround:
I worked ‘around’ it to upload it to GitHub which is probably where it all ends up in the end. But it would be great for local testing without the need to use the GitHub repository and have the zip file easy to produce.
Is it something which Gutenberg could use for its own plugin distribution? It would be nice to "dog-food" this solution.
On the point about node_modules and the fact that Gutenberg defines its own whitelisting of files to include, maybe it's something where it could support a feature like npm's files setting? .gitignore could work as well, though it's not clear this would have the desired effect, considering that the built outputs of the plugin should in most cases be included in a project's .gitignore.
On the point about node_modules and the fact that Gutenberg defines its own whitelisting of files to include, maybe it's something where it could support a feature like npm's files setting?
It made me think about using files In package.json as a primary way to source the list of included files for the plugin’s zip file. The nice side-effect would be the possibility to run npm pack which generates the tarball file. In fact, you could as well publish the package to npm and consume the tarball from there. Unless the tarball isn’t an option?
I ask because I'm looking for a command that would build a 'lean' zip of Gutenberg (like that command does) but that commands deletes node_modules, etc locally on my computer; and I found this issue.
(For use cases, I then use that zip on another testing wordpress site on a remote server, without having to install node, etc on said server)
Activity
bph commentedon Dec 19, 2019
For completeness sake: The quoted workaround above 'omits' the step to add the node-module directory to the .gitignore file.
gziolo commentedon Feb 25, 2020
There is also this article from @mkaz explaining how to automate plugin publishing with GitHub action created by @helen and @10up:
https://mkaz.blog/wordpress/deploy-wordpress-plugin-using-github-actions/
It's something that could be integrated with
@wordpress/create-blockas an opt-in option.aduth commentedon Mar 23, 2020
Is it something which Gutenberg could use for its own plugin distribution? It would be nice to "dog-food" this solution.
On the point about
node_modulesand the fact that Gutenberg defines its own whitelisting of files to include, maybe it's something where it could support a feature like npm'sfilessetting?.gitignorecould work as well, though it's not clear this would have the desired effect, considering that the built outputs of the plugin should in most cases be included in a project's.gitignore.gziolo commentedon Dec 3, 2020
It made me think about using
filesInpackage.jsonas a primary way to source the list of included files for the plugin’szipfile. The nice side-effect would be the possibility to runnpm packwhich generates the tarball file. In fact, you could as well publish the package to npm and consume the tarball from there. Unless the tarball isn’t an option?Update: there is also
prepackandpostpackavailable which makes it even more interesting, see https://docs.npmjs.com/cli/v6/commands/npm-pack.skorasaurus commentedon Dec 4, 2020
Is this requesting something different than
npm run build:plugin-zip? (https://github.com/WordPress/gutenberg/blob/master/bin/build-plugin-zip.sh)I ask because I'm looking for a command that would build a 'lean' zip of Gutenberg (like that command does) but that commands deletes node_modules, etc locally on my computer; and I found this issue.
(For use cases, I then use that zip on another testing wordpress site on a remote server, without having to install node, etc on said server)
gziolo commentedon Dec 4, 2020
Yes, it's different. The one you shared is unique to Gutenberg plugin.
bph commentedon Dec 5, 2020
@skorasaurus I am not sure if I understood what you are looking for. Maybe you could benefit from the 'Gutenberg Nightly' version
skorasaurus commentedon Dec 5, 2020
@bph Thanks for the mention and your work on this! I wasn't aware of it and that solves most of my use cases.
bph commentedon Dec 5, 2020
You are welcome! Glad to read, most use cases are solved with the 'Nightly' 👍
gziolo commentedon Jan 3, 2022
I finally found some time to implement the new
plugin-zipcommand in@wordpress/scriptswith #37687.