Skip to content

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

Closed

Description

@gziolo

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.

Activity

  1. added
    [Type] Task
    [Tool] WP Scripts
    on Dec 19, 2019
  2. bph commented on Dec 19, 2019

    @bph
    Contributor

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

  3. gziolo commented on Feb 25, 2020

    @gziolo
    MemberAuthor

    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.

  4. aduth commented on Mar 23, 2020

    @aduth
    Member

    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.

  5. gziolo commented on Dec 3, 2020

    @gziolo
    MemberAuthor

    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.

  6. skorasaurus commented on Dec 4, 2020

    @skorasaurus
    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)

  7. gziolo commented on Dec 4, 2020

    @gziolo
    MemberAuthor

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

  8. bph commented on Dec 5, 2020

    @bph
    Contributor

    @skorasaurus I am not sure if I understood what you are looking for. Maybe you could benefit from the 'Gutenberg Nightly' version

  9. skorasaurus commented on Dec 5, 2020

    @skorasaurus
    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.

  10. bph commented on Dec 5, 2020

    @bph
    Contributor

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

  11. added
    Needs Dev
    on Feb 1, 2021
  12. self-assigned this
    on Jul 20, 2021
  13. added
    [Status] In Progress
    on Jul 20, 2021
  14. moved this to Todo in WordPresson Nov 24, 2021
  15. moved this from Todo to In Progress in WordPresson Jan 3, 2022
  16. gziolo commented on Jan 3, 2022

    @gziolo
    MemberAuthor

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

  17. moved this from In Progress to Done in WordPresson Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Needs Dev[Status] In Progress[Tool] WP Scripts[Type] Task

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions