mazey-npm-template

A TypeScript npm library template with Rollup builds for ESM, CommonJS, browser IIFE, source maps, declarations, tests, and release workflows.

npm install mazey-npm-template

A complete small-library workflow

The repository keeps package source, browser development, API documentation, tests, and publishing responsibilities separate.

Typed public API

Root imports expose createGreeting and its TypeScript options type.

Multiple package formats

Rollup produces ESM, CommonJS, browser IIFE, declaration, and source-map files without runtime dependencies.

Release-ready checks

Jest, TypeScript, ESLint, Prettier, TypeDoc, package previews, and GitHub Actions are configured for maintainers.

Install

Use the package through a module-aware project or load the browser bundle directly from a CDN.

npm

TypeScript discovers the published declarations automatically; no separate @types package is required.

npm install mazey-npm-template

Browser CDN

Load the IIFE bundle when a package manager or bundler is not available. Pin an exact version for production use.

<script src="https://cdn.jsdelivr.net/npm/mazey-npm-template/lib/mazey-npm-template.min.js"></script>
<script>
  const message = MAZEY_NPM_TEMPLATE.createGreeting("browser");
</script>

Usage

Import from the package root. The sample API trims the provided name, falls back to friend for blank input, and accepts optional punctuation.

Read the complete typed API documentation
import { createGreeting } from "mazey-npm-template";

createGreeting("Cheng");
// "Hello, Cheng!"

createGreeting("community", { punctuation: "." });
// "Hello, community."

Try the public API

The live playground runs createGreeting in your browser, lets you adjust its supported options, and displays the generated result immediately.

Published outputs

Package metadata directs consumers to the appropriate generated file while preserving a browser bundle for direct script usage.

ES modules
lib/index.esm.js
CommonJS
lib/index.cjs
Browser IIFE
lib/mazey-npm-template.min.js
Type declarations
lib/index.d.ts

Website app help

Supported Chrome and Edge browsers may expose an install icon or the Install app action below. Other browsers may require their own menus; availability depends on the browser and platform.

On iPhone and iPad, Safari users can use Share, then Add to Home Screen. This does not provide exactly the same capabilities as a Chrome installation. Installing the website also does not grant native Fullscreen API support.