@wok-cli/plugin-notifier

1.0.2 • Public • Published

Wok Notifier Plugin

Implements build status notification via node-notifier.

Hook types Production only Purpose
any no Developer 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.

parameter type default note
title string package.json title field or 'application' Notification title
message string Notification 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);

Readme

Keywords

none

Package Sidebar

Install

npm i @wok-cli/plugin-notifier

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

4.91 kB

Total Files

4

Last publish

Collaborators

  • dwightjack