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

bessa_patterns.ts

v0.13.0

Published

Library of Reusable Design Patterns in TypeScript

Readme

bessa_patterns.ts

Library of Reusable Design Patterns in TypeScript

Installation

npm install bessa_patterns.ts

Patterns

| Class | Pattern | Description | | --------------------- | -------- | --------------------------------------------------------------------- | | ObserverSubject<T> | Observer | Typed callback-based subject — subscribe/notify with typed snapshots | | DualObserverSubject | Observer | GoF + function-based dual subject — two independent observer channels |

Quick Example

import { ObserverSubject } from 'bessa_patterns.ts';

const counter = new ObserverSubject<{ count: number }>();
const unsub = counter.subscribe(({ count }) => console.log(count));

counter.notify({ count: 1 }); // 1
counter.notify({ count: 2 }); // 2
unsub();

Deployment

scripts/deploy.sh builds and publishes the package to npm. It is invoked automatically by ai-workflow deploy or manually:

export NPM_TOKEN=<your-npm-token>
bash scripts/deploy.sh

Alternatively, place the token in a gitignored .env file at the project root and the deploy script loads it automatically:

# .env  (never committed)
NPM_TOKEN=<your-npm-token>

An explicit export NPM_TOKEN=... in the environment takes precedence over the .env value.

Prerequisites:

  • NPM_TOKEN must be set — via the environment or a .env file at the project root (publish auth token)
  • npm must be available on PATH

What it does (in order):

  1. npm ci — clean dependency install
  2. npm test — all tests must pass
  3. npm run build — TypeScript compiled to dist/
  4. npm publish --access public — publishes to the npm registry

Exit codes: 0 on success; non-zero on any failure (guard failures abort immediately via set -euo pipefail).

Troubleshooting

| Symptom | Cause | Fix | | ------------------------------------- | ----------------------------------------- | --------------------------------------------------------------- | | Error: npm ERR! 401 Unauthorized | NPM_TOKEN is missing or expired | Run export NPM_TOKEN=<valid-token> before invoking the script | | Script aborts at npm test step | One or more tests are failing | Run npm test locally, fix failures, then retry the deploy | | npm ERR! network / registry timeout | Transient npm registry connectivity issue | Retry; if persistent, check https://status.npmjs.org |

Documentation

Development

| Tool / Directory | Purpose | | ----------------------- | ----------------------------------------------------------------------------------------- | | npm test | Run all Jest tests | | npm run test:coverage | Run tests with coverage report (output to coverage/; 80% threshold enforced) | | npm run lint | Lint with ESLint (eslint.config.mjs) | | npm run build | Compile TypeScript to dist/ via tsc | | .husky/ | Husky Git hooks — runs lint and tests before commits |