Skip to content
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

Scripts: Add new command which generates zip file for the plugin #19237

Closed
gziolo opened this issue Dec 19, 2019 · 10 comments · Fixed by #37687
Closed

Scripts: Add new command which generates zip file for the plugin #19237

gziolo opened this issue Dec 19, 2019 · 10 comments · Fixed by #37687
Assignees
Labels
Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress [Tool] WP Scripts /packages/scripts [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@gziolo
Copy link
Member

gziolo commented Dec 19, 2019

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.

@gziolo gziolo added [Type] Task Issues or PRs that have been broken down into an individual action to take [Tool] WP Scripts /packages/scripts labels Dec 19, 2019
@bph
Copy link
Contributor

bph commented Dec 19, 2019

For completeness sake: The quoted workaround above 'omits' the step to add the node-module directory to the .gitignore file.

@gziolo
Copy link
Member Author

gziolo commented 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-block as an opt-in option.

@aduth
Copy link
Member

aduth commented 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_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.

@gziolo
Copy link
Member Author

gziolo commented Dec 3, 2020

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?

Update: there is also prepack and postpack available which makes it even more interesting, see https://docs.npmjs.com/cli/v6/commands/npm-pack.

@skorasaurus
Copy link
Member

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
Copy link
Member Author

gziolo commented Dec 4, 2020

Yes, it's different. The one you shared is unique to Gutenberg plugin.

@bph
Copy link
Contributor

bph commented 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
Copy link
Member

@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
Copy link
Contributor

bph commented Dec 5, 2020

You are welcome! Glad to read, most use cases are solved with the 'Nightly' 👍

@gziolo gziolo added the Needs Dev Ready for, and needs developer efforts label Feb 1, 2021
@gziolo gziolo self-assigned this Jul 20, 2021
@gziolo gziolo added the [Status] In Progress Tracking issues with work in progress label Jul 20, 2021
@gziolo gziolo moved this to Todo in WordPress Nov 24, 2021
@gziolo gziolo added this to WordPress Nov 24, 2021
@gziolo gziolo moved this from Todo to In Progress in WordPress Jan 3, 2022
@gziolo
Copy link
Member Author

gziolo commented Jan 3, 2022

I finally found some time to implement the new plugin-zip command in @wordpress/scripts with #37687.

@gziolo gziolo moved this from In Progress to Done in WordPress Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Dev Ready for, and needs developer efforts [Status] In Progress Tracking issues with work in progress [Tool] WP Scripts /packages/scripts [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants