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

tidy-stats-webpack-plugin

v1.0.0

Published

tidy stats webpack plugin

Downloads

99

Readme

Tidy-stats-webpack-plugin Build Status npm version

NPM

Tidy-stats-webpack-plugin output more tidy and clearness stats, provide a better Developer Experience.

Getting started

Installation

npm install tidy-stats-webpack-plugin --save-dev

Basic usage

Simply add TidyStatsWebpackPlugin to the plugin section in your Webpack config.

var TidyStatsWebpackPlugin = require('tidy-stats-webpack-plugin');

var webpackConfig = {
  // ...
  plugins: [
    new TidyStatsWebpackPlugin({
      errorsOnly: true
    }),
  ],
  // ...
}

Turn off errors

You need to turn off all error logging by setting your webpack config quiet option to true.

app.use(require('webpack-dev-middleware')(compiler, {
  quiet: true,
  publicPath: config.output.publicPath,
}));

If you use the webpack-dev-server, there is a setting in webpack's devServer options:

// webpack config root
{
  // ...
  devServer: {
    // ...
    quiet: true,
    // ...
  },
  // ...
}

If you use webpack-hot-middleware, that is done by setting the log option to a no-op. You can do something sort of like this, depending upon your setup:

app.use(require('webpack-hot-middleware')(compiler, {
  log: () => {}
}));

Options

You can pass options to the plugin:

new TidyStatsPlugin({
  onErrors: function (errors) {
    // called when errors occured
  },
  onWarnings: function(warnings) {
    // called when warnings occured
  },
  // write all stats into file
  writeToFile: 'path/to/stats.json',
  // should show errors only or not
  errorsOnly: true,
  // dont show assets
  ignoreAsset: false,
  // should show finish time and duaration
  time: true
  // should the console be cleared between each compilation?
  // default is true
  clearConsole: true
})

Adding desktop notifications

The plugin has no native support for desktop notifications but it is easy to add them thanks to node-notifier for instance.

var TidyStatsPlugin = require('tidy-stats-webpack-plugin');
var notifier = require('node-notifier');
var ICON = path.join(__dirname, 'icon.png');

new TidyStatsPlugin({
    onErrors: (,errors) => {
      const error = errors[0];
      notifier.notify({
        title: "Webpack error",
        message: error.name,
        subtitle: error.file || '',
        icon: ICON
      });
    }
  })
]

License

MIT License