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

cleandir-webpack-plugin

v0.1.4

Published

<h1 align="center">cleandir-webpack-plugin</h1> <p align="center"> <a href="https://www.npmjs.com/package/cleandir-webpack-plugin"><img src="https://img.shields.io/badge/npm-cleandir--webpack--plugin-brightgreen.svg" /></a> <a href="https://www

Downloads

16

Readme

This plugin allows you to delete files/directories before or after bundle compilation.
Comparing to most popular cleanup plugin, cleandir-webpack-plugin provides you ability to run plugin after files was written to output directory and ability to exclude files with glob patterns.

Installation

npm i --save cleandir-webpack-plugin

Example

// webpack.conf.js
const CleanDirWebpackPlugin = require("cleandir-webpack-plugin");

module.exports = {
    plugins: [
        new CleanDirWebpackPlugin("dist/"), // removing whole dist dir
        new CleanDirWebpackPlugin([
                                      "dist/css/*.js",          // removing js generated by sass plugin
                                      "dist/some/directory/**", // and something else generated by build
                                  ],
                                  {
                                      stage:   "after",
                                      exclude: "dist/some/directory/**.log",    // excepting the *.log files
                                      silent:  true,
                                  },
        ),
    ],
};

Usage

// webpack.conf.js
const CleanDirWebpackPlugin = require("cleandir-webpack-plugin");

module.exports = {
    plugins:[
            new CleanDirWebpackPlugin(paths [, options])
    ]
}

paths (required)

Paths can be a valuable string or an array of strings.
Each string should be a valid glob pattern (node-glob is used under the hood).

options (optional)

const options = {
    // The momen when cleanup will be triggered, before or after emitting assets to output dir.
    // This way you will be able to remove redundant files generated by webpack
    // 
    // Variants: "before", "after"
    // Default: "before"
    stage: "before",
    
    // Same as paths parameter, but files and direcroties matching given globs wont be deleted
    //
    // Default: []
    exclude: [],
    
    // If true writes result of each glob processing
    //
    // Default: true
    verbose: true,
    
    // If true, will not generate any console output (excepting error)
    //
    // Default: false
    silent: false,
    
    // If true, will only emulate deletion (will not remove files)
    //
    // Default: false
    dryRun: false,
    
    // Allow plugin to clean paths outside of given root path
    //
    // Default: false
    allowExternal: false,
    
    // Path that will be treated as relative root for globs
    //
    // Default: path.dirname(module.parent.filename)
    root: path.dirname(module.parent.filename),
}

Tests

npm i
npm run test

Coverage

npm i
npm run test:coverage