1.0.2 • Published 4 years ago

@wok-cli/plugin-notifier v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Wok Notifier Plugin

Implements build status notification via node-notifier.

Hook typesProduction onlyPurpose
anynoDeveloper experience

Installation

npm i @wok-cli/plugin-notifier --save-dev

Environmental variables

This plugin can be switched on/off by setting the boolean flag enableNotify:

// wok.config.js
module.exports = {
  // ...
  enableNotify: false, // disable notifications
};

Parameters

Configuration path: notifier.

parametertypedefaultnote
titlestringpackage.json title field or 'application'Notification title
messagestringNotification message

Usage

Notify the user when files are copied:

const $ = require('@wok-cli/core');
const { copy } = require('@wok-cli/tasks');
const notifier = require('@wok-cli/plugin-imagemin');

const copyTask = $.task(copy, {
  src: 'static/**/*.*',
  dest: 'public/',
  'hooks:complete': {
    notifier: { message: 'Copy completed!' }
  },
});

copyTask.tap('complete', 'notifier', notifier);

export.copy = copyTask

Use the complete hook of a noop task to notify the user when a series of tasks have completed:

const $ = require('@wok-cli/core');
const { clean, copy, noop } = require('@wok-cli/tasks');
const notifier = require('@wok-cli/plugin-notifier');

const cleanTask = $.task(clean, {
  pattern: 'public/',
});

const copyTask = $.task(copy, {
  src: 'static/**/*.*',
  dest: 'public/'
});

const notifyTask = $.task(noop, {
  notifier: { message: 'Build completed!' }
});

notifyTask.tap('complete', 'notifier', notifier);

export.copy = $.series(cleanTask, copyTask, notifyTask);