From a727b4f7af6f5d5de328921f3139583034e588ea Mon Sep 17 00:00:00 2001 From: Ryan Koval Date: Thu, 25 Apr 2019 14:38:58 -0500 Subject: [PATCH 1/4] add support for title function for dynamic titles --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 792b31f0..72a529a6 100644 --- a/index.js +++ b/index.js @@ -75,12 +75,17 @@ WebpackNotifierPlugin.prototype.compilationDone = function(stats) { var contentImage = ('contentImage' in this.options) ? this.options.contentImage : DEFAULT_LOGO; + var title = this.options.title + if (typeof title === 'function') { + title = title({msg: msg}) + } + notifier.notify(objectAssign({ title: 'Webpack', message: msg, contentImage: contentImage, icon: (os.platform() === 'win32' || os.platform() === 'linux') ? contentImage : undefined - }, this.options)); + }, this.options, { title: title })); } }; From ba0ba3163dae648a3852165604dba16ce8389e51 Mon Sep 17 00:00:00 2001 From: Gvozd Date: Sun, 29 Nov 2020 18:53:31 +0300 Subject: [PATCH 2/4] docs(title): #53 - usage for title function --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 8ebc5cac..12eddd88 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,16 @@ var config = module.exports = { Title shown in the notification. ```js +// static title new WebpackNotifierPlugin({title: 'Webpack'}); +// or dynamicly generated +new WebpackNotifierPlugin({ + title({msg}) { + if (msg.startsWith('Error')) return 'build error ❌'; + if (msg.startsWith('Warning')) return 'build warning ⚠️'; + return 'build complete ✅'; + }, +}) ``` ### Emoji From 0974fcc827b56ae7f6a6ec863ce18f184856ba74 Mon Sep 17 00:00:00 2001 From: Gvozd Date: Sun, 29 Nov 2020 18:57:43 +0300 Subject: [PATCH 3/4] docs(changelog): fix mismatch --- CHANGELOG.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 338bce16..d48c21ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ v1.10.1 v1.10.0 ------------------------------------------------------------------------------- -- Add `onlyOnError` option ([#51](https://github.com/Turbo87/webpack-notifier/pull/51) +- Add `onlyOnError` option ([#51](https://github.com/Turbo87/webpack-notifier/pull/51)) v1.9.1 @@ -24,25 +24,25 @@ v1.9.1 v1.9.0 ------------------------------------------------------------------------------- -- Update node-notifier to v6 ([#56](https://github.com/Turbo87/webpack-notifier/pull/56) +- Update node-notifier to v6 ([#56](https://github.com/Turbo87/webpack-notifier/pull/56)) v1.8.0 ------------------------------------------------------------------------------- -- Add `--emoji` option ([#55](https://github.com/Turbo87/webpack-notifier/pull/55) +- Add `--emoji` option ([#55](https://github.com/Turbo87/webpack-notifier/pull/55)) v1.7.0 ------------------------------------------------------------------------------- -- Handle errors/warnings in child compilations ([#49](https://github.com/Turbo87/webpack-notifier/pull/49) +- Handle errors/warnings in child compilations ([#49](https://github.com/Turbo87/webpack-notifier/pull/49)) v1.6.0 ------------------------------------------------------------------------------- -- Add support for webpack 4 plugin system ([#39](https://github.com/Turbo87/webpack-notifier/pull/39) +- Add support for webpack 4 plugin system ([#39](https://github.com/Turbo87/webpack-notifier/pull/39)) v1.5.1 From 52e8f78deefc7ca7d4afb3cf58df70b9c3a6c6d2 Mon Sep 17 00:00:00 2001 From: Gvozd Date: Sun, 29 Nov 2020 18:59:38 +0300 Subject: [PATCH 4/4] 1.11.0 --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d48c21ee..869d8bc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Changelog =============================================================================== +v1.11.0 +------------------------------------------------------------------------------- + +- Support for `title` function for dynamic titles ([#53](https://github.com/Turbo87/webpack-notifier/pull/53)) + + v1.10.1 ------------------------------------------------------------------------------- diff --git a/package.json b/package.json index 1a474128..6508e768 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack-notifier", - "version": "1.10.1", + "version": "1.11.0", "description": "webpack + node-notifier = build status system notifications", "main": "index.js", "files": [