• This repository has been archived on 17/Jul/2022
  • Stars
    star
    921
  • Rank 49,603 (Top 1.0 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 12 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Automatic Notifications when Grunt tasks fail.

grunt-notify Build Status grunt-notify

Automatic desktop notifications for Grunt errors and warnings. Supports OS X, Windows, Linux.

Screenshots

OS Tool Screenshots
OS X OS X Notification Center OS X Notification Center
OS X Growl for Mac Growl for Mac
Windows 8 Windows 8 notifications Windows 8 Notifications
Windows Growl for Windows Growl for Windows
Windows Snarl Snarl
Linux Notify-Send Notify-Send

Getting Started

This plugin recommends Grunt 0.4.1 or newer.

Installing

npm install grunt-notify --save-dev

Once that's done, add this line to your project's Gruntfile.js:

grunt.loadNpmTasks('grunt-notify');

That's all you need for automatic notifications.

Notify_Hooks Options

If you want change the automatic messaging configure a task called notify_hooks.

grunt.initConfig({
  // This is optional!
  notify_hooks: {
    options: {
      enabled: true,
      max_jshint_notifications: 5, // maximum number of notifications from jshint output
      title: "Project Name", // defaults to the name in package.json, or will use project directory's name
      success: false, // whether successful grunt executions should be notified automatically
      duration: 3 // the duration of notification in seconds, for `notify-send only
    }
  }
});

// Load the task
grunt.loadNpmTasks('grunt-notify');

// This is required if you use any options.
grunt.task.run('notify_hooks');

Showing Specific Notifications

Sometimes you want to show messages like "Uglify complete" or "Project Deployed" - that's easy to do too.

Custom Message - Grunt
Custom Message - Grunt
Custom Message - Notification Center
Custom Message - Notification Center
Custom Message - Notify-Send
Custom Message - Notify-Send
grunt.initConfig({
  notify: {
    task_name: {
      options: {
        // Task-specific options go here.
      }
    },
    watch: {
      options: {
        title: 'Task Complete',  // optional
        message: 'SASS and Uglify finished running', //required
      }
    },
    server: {
      options: {
        message: 'Server is ready!'
      }
    }
  }
});

grunt.loadNpmTasks('grunt-notify');

// simplified example
grunt.registerTask('server', [
  'uglify',
  'sass',
  'server',
  'notify:server'
  ]);

Options

  • title optional Notification title
  • message required Notification message

Tests

Run grunt to lint and run the tests.

Notification Systems

Mac

OS X Notification System

Support Included.

If you are using OS X 10.8 Mountain Lion or newer a notification system is built in, but Apple does not provide a notification API that Node can access. Only code written in Objective C and signed in XCode can access it. This is not very friendly for Node users so we are using the tiny signed MIT-licensed native application Terminal Notifier from Eloy Durán. I've changed the default icon which is owned by Apple to the Grunt logo.

Growl for OS X

Requires growlnotify for OS X.

Install growlnotify from the Growl Downloads Page. This will install in /usr/local/bin/growlnotify.

Windows

Snarl

Included with Snarl.

If you have downloaded and installed Snarl from Snarl's web site you'll have the commandline tool heysnarl as well.

Growl for Windows

Requires growlnotify for Windows.

Install growlnotify from the growlnotify Page.

Windows 8.1 Notifications

Nothing to install.

Create a pull request!

Linux

Notify-Send

Nothing to install.

I created an Ubuntu virtual machine and it had notify-send in the path.

I don't use Linux frequently so I don't know if this utility is available for other distros.

notify-send man page.

notify-send has an addition duration option which takes a number seconds. The default is 3 seconds.

Duration doesn't work natively on some versions of Ubuntu.

Here is a fix: http://askubuntu.com/questions/128474/how-to-customize-on-screen-notifications

Chrome

Not supported yet.

Chrome has a notification system but I'm not sure if it's possible to use from a command-line Node app. Somebody could probably create a Chrome Plugin helper for this.

Notifications aren't showing

Run grunt -v (for verbose mode) to show grunt-notify debug messages. It will tell you what notification system it thinks it can use. Create an issue and I'll look into it asap.

About the Author

Hi! Thanks for checking out this project! My name is Dylan Greene. When not overwhelmed with my two young kids I enjoy contributing to the open source community. I'm also a tech lead at Opower. @dylang @dylang

Here's some of my other Node projects:

Name Description npm Downloads
space‑hogs Discover surprisingly large directories from the command line space-hogs
npm‑check Check for outdated, incorrect, and unused dependencies. npm-check
shortid Amazingly short non-sequential url-friendly unique id generator. shortid
rss RSS feed generator. Add RSS feeds to any project. Supports enclosures and GeoRSS. rss
grunt‑prompt Interactive prompt for your Grunt config using console checkboxes, text input with filtering, password fields. grunt-prompt
xml Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples. xml
changelog Command line tool (and Node module) that generates a changelog in color output, markdown, or json for modules in npmjs.org's registry as well as any public github.com repo. changelog
grunt‑attention Display attention-grabbing messages in the terminal grunt-attention
observatory Beautiful UI for showing tasks running on the command line. observatory
anthology Module information and stats for any @npmjs user anthology
grunt‑cat Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi. grunt-cat

This list was generated using anthology.

License

Copyright (c) 2016 Dylan Greene, contributors.

Released under the MIT license.

Screenshots are CC BY-SA (Attribution-ShareAlike).


Generated using grunt-readme with grunt-templates-dylang on Sunday, February 28, 2016. _To make changes to this document look in /templates/readme/

More Repositories

1

npm-check

Check for outdated, incorrect, and unused dependencies.
JavaScript
6,553
star
2

shortid

Short id generator. Url-friendly. Non-predictable. Cluster-compatible.
JavaScript
5,736
star
3

node-rss

RSS feed generator for Node.
JavaScript
995
star
4

grunt-prompt

Add interactive UI to your Gruntfile such as lists, checkboxes, text input with filtering, and password fields, all on the command line.
JavaScript
368
star
5

observatory

Beautiful UI for showing tasks running on the command line.
JavaScript
276
star
6

node-xml

Fast and simple Javascript-based XML generator/builder for Node projects.
JavaScript
274
star
7

changelog

Finally see what's changed when you do npm update. Changelog generates a changelog for npm modules and github repos.
JavaScript
239
star
8

space-hogs

Discover surprisingly large directories from the command line.
JavaScript
161
star
9

opowerjobs

Node.js site using Express and Connect.
JavaScript
61
star
10

logging

Lightweight informative modern console logging.
JavaScript
54
star
11

anthology

List of modules for any npm user, plus number of downloads and github stars.
JavaScript
46
star
12

captionbot

Get captions for image using Microsoft's CaptionBot
JavaScript
41
star
13

grunt-attention

Display attention-grabbing messages in the terminal.
JavaScript
26
star
14

jira-improved

Improves the Jira Agile board by showing the Epic name in the cards and hiding the Done column if you use a quick filter to hide tickets in that column.
JavaScript
24
star
15

node-atom

DEPRECATED - NOT MAINTAINED
JavaScript
20
star
16

what-dog

Get the breed of a dog from an image using Microsoft's what-dog
JavaScript
15
star
17

grunt-cat

Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi.
JavaScript
14
star
18

random-puppy

Get a random puppy image url.
JavaScript
13
star
19

jobvite

DEPRECATED ----- Jobvite API for Node
JavaScript
12
star
20

source-map-diff

Compare source maps with cli and web output
TypeScript
7
star
21

flowdock-refined

DEPRECATED - Flowdock desktop app custom UI
CSS
5
star
22

...

really, this is a valid project name?
2
star
23

dotfiles

Vim Script
2
star
24

lean

Simple in-memory data store to lean on. Helpful when you don't need a couch.
JavaScript
2
star
25

jquery-tooltips

Easy to use image-free HTML5 tooltips for jQuery 1.5.2+.
JavaScript
2
star
26

grunt-templates-dylang

Templates for grunt-readme that dylang will be using across multiple projects.
JavaScript
1
star
27

dotconfig

My custom terminal colors, bash-it prompt, intellij and webstorm settings, etc
Shell
1
star
28

dylang.github.com

Everything you need to know about me.
1
star