Skip to content
archoleatPublic

About

Configurable console and desktop notifications for Node.js tools.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

58 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notifier

NPM Version NPM Downloads Specs Commitlint Editorconfig Prettier ESLint Remark

Table of Contents

Console and desktop notifications for Node.js scripts.

Installation

bun i @archoleat/notifier

Use bun i -D @archoleat/notifier if only development scripts import it.

Runtime

This ES module targets Node.js scripts, not browser notifications. It uses Node.js APIs and node-notifier; Bun is used for repository tooling and is not required to import the package in Node.js. Desktop delivery depends on the operating system and notification permissions. Automated fallback tests do not guarantee that a notification will be visible on every host.

Usage

import { error, info, success, warning } from '@archoleat/notifier';

await info({ message: 'Build started.', hasTime: false });
await success({ message: 'Build finished.' });
await warning({ message: ['This message will be truncated.', { maxLength: 20 }] });
await error({ message: 'Build failed.', notificationMode: 'console' });

All four functions accept the same options and return a Promise. Await the call so desktop notification failures can be handled by the caller.

Accepted options, shown separately from the executable example:

type Options = {
  message: string | [string, { maxLength: number }];
  hasTime?: boolean;
  notificationMode?: 'console' | 'desktop' | 'multiple';
};
  • message is required. The tuple form truncates text to maxLength.

  • hasTime defaults to true; it affects console output only.

  • notificationMode defaults to 'console'. Use 'desktop' for operating system notifications or 'multiple' for both outputs.

Desktop mode uses the operating system's notification service and requires its notification permissions. Use console mode in CI and other environments without a desktop session.

On macOS without Rosetta, desktop notifications fall back to the system notification service. This fallback uses the host application's notification permissions and does not display custom icons.

Contributing

Please read CONTRIBUTING to start contributing.

License

This project is licensed under the MIT license.

About

Configurable console and desktop notifications for Node.js tools.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages