npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wpzip

v1.0.4

Published

Creates a theme distribution zip file. Excludes files in .distignore

Downloads

21

Readme

wpZip

Creates a wordpress distribution archive file

One of the best things about wordpress development is tools like wp-cli. However this is designed around the premise that you will be developing your theme or plugin within the wordpress directory structure. I don't always want to do this. Sometimes I want to build my plugin elsewhere and push the distribution files to the theme or plugins folder. Whilst wp-cli has a plugin called dist-archive that builds a distribution archive excluding files that are in the .distignore it only works within the wp structure.

In the past i've done this using bash files but I want to use modern tools like gulp to make the process easier.

So I have lovingly crafted this Node package to facilitate that.

To install run

npm i wpzip --save-dev

include it in a gulp task as follows

async function generateZip( )
{
    var ProjectPath = "./";   // Path of the folder you wish to create a release for
    var version = '1.0.0';  // This should match your theme or plugin version number 

    var zipName = "./project-"+version+".zip";  // The name of the zip file 

    var targetPath = "theme"+version;       // Name of the root path the files are stored in the zip file 
                                            // This will be the name within the wp themes folder

    var compression = 7;    // default level is 9 so you only need to pass it if you need a lower level 

    zip.wpZip ( zipName, ProjectPath, targetPath, compression );

}

gulp.task( 'release', generateZip );

I combine this package with my themeVersion package as follows

const tv = require( 'themeversion' );

.
.
.

async function generateZip( )
{
    var ProjectPath = "./";

    try {
        // Get the version number from the style.css file
        const version = await tv.getVersion( path.join( ProjectPath, 'style.css') );

        var zipName = "./project-"+version+".zip";  // name of the zip file

        var targetPath = "theme"+version;       // Name of the root path the files are stored in the zip file 
                                                // This will be the name within the wp themes folder

        zip.wpZip ( zipName, ProjectPath, targetPath );
    }
    catch( e )
    {
        console.log( e );
    }
}

You can find themeVersion here https://www.npmjs.com/package/themeversion

I would consider this an early Beta version so use at your own risk.

Thanks

This makes use of the following node packages

Glob which can you can find out more details about here (https://www.npmjs.com/package/glob)[https://www.npmjs.com/package/glob]

and

Archive which can you can find out more about here (https://www.npmjs.com/package/archiver)[https://www.npmjs.com/package/archiver]