Create your plugin distribution file with wp-cli

·

·

With this talk I gave at the WordCamp Madrid 2023, you will learn how to create a distribution file to upload to our websites.

Using this option is best because we maintain versions for the plugins that we are making with WPCLI.

Chat at WC Madrid

Raise your hand who has broken a website by uploading development in Production?

Who has broken a website by uploading development in Production?

Who would like to improve the process?

Who would like to improve the process?

Who would like to improve the process?

Charla Wcmadrid23 Zip 1

So with this talk, we’re going to look at how to work with Version Control, make our file for distribution, and upload it to production.

Charla Wcmadrid23 Zip 2

Since August 11, 2020, with a WordPress ticket that has taken 11 years! Can you imagine a ticket with such a duration? Well, this is an example.

Wcmadrid23 Zip 3 Talk

We have to beat the “bad guy” and save fatal errors in production. With this method we have quite a few benefits:

.

    • We version our development
    • .
    • We do not depend on third-party libraries.
    • We do not depend on third-party libraries.
    • Allows to compare with the current uploaded version.
    • Cleans caches after replacing the plugin. The ZIPs we mount are clean and out of folders that are messy and not needed.
    • It is a fast and reliable method.
  • It is a fast and reliable method.
    Charla Wcmadrid23 Zip 4

    How do we do it? You can see the detail in the section below.

    .

    Charla Wcmadrid23 Zip 5
    Wcmadrid23 Zip 6 Talk

    And we upload to Production.

    Wcmadrid23 Zip 7 Talk

    How to configure our WPCLI command

    .

    In a descriptive way, let’s see how to install our command and then use it.

    Installation:

    Installation.

    wp package install wp-cli/dist-archive-command

    To create a plugin distribution zip, there is a WP-CLI command: wp dist-archive. It takes the files from the folder and names it with plugin.version.zip

    .
     wp dist-archive plugin-name

    To make it ignore files in the distribution, we have to create in the root the file: .distignore which takes into account and does not introduce such files in the zip.

    .distignore
    .editorconfig
    .git
    .gitignore
    .travis.yml
    circle.yml
    .DS_Store
    composer.json
    composer.lock

    The slides of the talk, you can download them below.

    Reactions

    –>
    –>
    –>

Leave a Reply

Your email address will not be published. Required fields are marked *