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

zip-clear-webpack-plugin

v1.0.4

Published

zip and clear zip webpack plugin

Downloads

6

Readme

zip-clear-webpack-plugin

插件用于将 webpack 构建输出目录进行压缩处理。在压缩之前,会把之前生成的 zip 包清除。

安装

使用 yarn:

yarn add zip-clear-wepback-plugin -D

使用 npm:

npm install zip-clear-wepback-plugin -D

使用


const ClearPlugin = require('zip-clear-webpack-plugin')

// 零配置使用
module.exports = {
  plugins:[
    new ClearPlugin(),
  ]
}

// 可以指定配置
module.exports = {
  plugins:[
    new ClearPlugin({
      outpath: path.join(__dirmname), // 打包文件输出目录 
      filename: 'app.zip',  // 打包文件名称,后缀仅支持 zip | tag | tgz
      sourcePath: path.join(__dirname, 'dist'), // 默认是webpack 的输出目录
      compress:{
        type: 'zip', // 仅支持 zip | tag | tgz 三选一。 filename 的后缀会覆盖此选项
        suceseeHandle(){},  // 打包成功回调
        errorHandle(){}, // 打包失败回调
      }
    }),
  ]
}

配置

path

压缩文件存放目录,默认是项目的根目录

filename

压缩文件名称,默认是 path.basename(process.cwd()) 也就是项目名称

sourcePath

需要压缩的文件夹,这里只接受文件夹。默认值是webpack打包的输出目录

compress

这个配置项是配置依赖项 compressing的配置,由于只使用了 compressDir 进行文件夹压缩。提供的配置项如下:

type

表示压缩文件的类型,支持 zip | tar | tgz 三种类型。需要注意的是,如果 filename 包含文件后缀,则会使用文件后缀覆盖此选项

sucessHandle

压缩成功后的回调,一般不需要设置

errorHandle

压缩失败的回调,默认出错会直接抛出错误。可以指定用来处理错误行为。