RoccoC / webpack-build-notifier

A Webpack plugin that generates OS notifications for build steps using node-notifier.
MIT License
162 stars 24 forks source link

Add compilation status and error/warning count to the error message formatter #68

Closed astorije closed 3 years ago

astorije commented 3 years ago

In many cases, displaying the error message is not helpful. In our case, we barely display enough of the filepath to help use figure out what is failing, so an error count would actually be a lot more concise and helpful, indicating the developer to take a look to their console.

This change allows for the following notifications:

Screen Shot 2021-04-25 at 9 06 54 PM Screen Shot 2021-04-25 at 9 12 39 PM

Using the following configuration:

// webpack.config.ts
import WebpackBuildNotifierPlugin from 'webpack-build-notifier';

let address: string;

export default {
  // ... snip ...
  plugins: [
    // ... snip ...
    new WebpackBuildNotifierPlugin({
      formatMessage(_error, _filepath, status, errorCount) {
        return `${errorCount} ${status}${errorCount === 1 ? '' : 's'}`;
      },
    }),
  ],
  // ... snip ...
};

This will conflict with #67 but I'm happy to rebase either PR on merge of the other one should you be happy with them :)

coveralls commented 3 years ago

Pull Request Test Coverage Report for Build 144


Totals Coverage Status
Change from base Build 118: 0.5%
Covered Lines: 130
Relevant Lines: 134

💛 - Coveralls
RoccoC commented 3 years ago

Thanks for the PR! Approved and merged. I'll release a new version with your change shortly.

astorije commented 3 years ago

Excellent, thanks! I'm going to fix conflicts on my other PRs then 🙏

RoccoC commented 3 years ago

Released in 2.2.0