npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

townkrier-cli

v1.0.0-alpha.6

Published

CLI tooling for TownKrier notification system - Laravel-style commands for generating notifications

Readme

townkrier-cli

CLI tooling for TownKrier notification system - Laravel-style commands for generating notification classes.

Installation

# Install globally
npm install -g townkrier-cli

# Or install as a dev dependency in your project
npm install --save-dev townkrier-cli

Usage

Generate a Notification

The make:notification command creates a new notification class with the specified channels.

# Interactive mode - prompts for channel selection
townkrier make:notification WelcomeUser

# With specific channels
townkrier make:notification OrderConfirmation --channels email,sms

# With all channels
townkrier make:notification ImportantAlert --all-channels

# Custom output path
townkrier make:notification UserInvite --path ./src/app/notifications

# Force overwrite existing file
townkrier make:notification Welcome --force

Command Options

townkrier make:notification <name> [options]

Arguments:
  name                     Name of the notification (e.g., WelcomeUser, OrderConfirmation)

Options:
  -c, --channels <channels>  Comma-separated list of channels (email,sms,push,in-app)
  -a, --all-channels         Include all available channels
  -p, --path <path>          Custom path for the notification file
  -f, --force                Overwrite existing notification file
  -h, --help                 Display help for command

Available Channels

  • email - Email notifications via configured email provider
  • sms - SMS notifications via configured SMS provider
  • push - Push notifications via configured push provider
  • in-app - In-app/Database notifications

Generated Notification Structure

The CLI generates a TypeScript notification class that extends the Notification base class from townkrier-core.

Naming Convention

  • Input: WelcomeUser
  • Generated File: WelcomeUser.notification.ts
  • Generated Class: WelcomeUserNotification (automatically adds "Notification" suffix)

Example Structure

import { Notification, NotificationChannel, NotificationPriority } from 'townkrier-core';

export class WelcomeUserNotification extends Notification {
  constructor() {
    super();
    this.priority = NotificationPriority.NORMAL;
  }

  via(): NotificationChannel[] {
    return [NotificationChannel.EMAIL];
  }

  toEmail() {
    return {
      subject: 'Your notification subject',
      html: '<h1>Your notification content</h1>',
      text: 'Your notification content',
    };
  }
}

Examples

Example 1: Welcome Email

townkrier make:notification WelcomeUser --channels email

This generates a notification class in ./notifications/WelcomeUser.notification.ts with an email channel.

Example 2: Multi-Channel Order Confirmation

townkrier make:notification OrderConfirmation --channels email,sms,push

This generates a notification with toEmail(), toSms(), and toPush() methods.

Example 3: Custom Path

townkrier make:notification PasswordReset --channels email --path ./src/notifications

This generates the notification in the specified custom path.

Integration with TownKrier

After generating a notification, you can use it with the TownKrier notification manager:

import { NotificationManager } from 'townkrier-core';
import { WelcomeUserNotification } from './notifications/WelcomeUser.notification';

const manager = new NotificationManager(config);

// Send the notification
const notification = new WelcomeUserNotification();
const recipient = {
  [NotificationChannel.EMAIL]: { email: '[email protected]' },
};

await manager.send(notification, recipient);

Package Scripts

If installed as a dev dependency, you can add scripts to your package.json:

{
  "scripts": {
    "notify:make": "townkrier make:notification"
  }
}

Then run:

npm run notify:make WelcomeUser -- --channels email,sms

License

MIT

Author

Jeremiah Olisa

Related Packages