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 🙏

© 2025 – Pkg Stats / Ryan Hefner

release-police

v1.0.0

Published

Interactive release workflow with configurable steps

Readme

release-police

npm version License Types NPM Downloads Last Commit Coverage CI Status GitHub Stars

Interactive release workflow CLI with configurable steps. Automates version bumping, testing, and publishing with beautiful prompts.

Features

  • Interactive prompts with beautiful CLI UI
  • Configurable via TypeScript, JavaScript, or package.json
  • Dry-run mode to preview changes
  • Skip individual steps via CLI flags
  • Automatic remote sync detection
  • Customizable test, build, and changelog commands
  • GitHub release creation (draft or published)

Installation

npm install -D release-police

Or run directly:

npx release-police

Quick Start

# Run with defaults
npx release-police

# Preview what would happen
npx release-police --dry-run

# Skip tests
npx release-police --skip-tests

# Pre-select version type
npx release-police --version-type minor

Configuration

Generate a config file with all options:

npx release-police init

Or create release.config.ts manually:

import { defineConfig } from 'release-police';

export default defineConfig({
  // Branches that allow releases (default: ['main', 'master'])
  releaseBranches: ['main', 'master', 'release/*'],

  // Commands to run (set to null to skip)
  commands: {
    test: 'npm run test:all',     // default
    install: 'npm install',        // run after pulling
    build: null,                   // optional pre-release build
    changelog: null,               // optional changelog generation
  },

  // Git settings
  git: {
    pullStrategy: 'rebase',        // 'rebase' | 'merge' | 'ff-only'
    requireCleanWorkingDir: true,
  },

  // GitHub integration (optional)
  github: {
    release: false,        // Create GitHub release after push
    draft: true,           // Create as draft
    generateNotes: true,   // Auto-generate release notes
  },

  // Enable/disable steps
  steps: {
    checkBranch: true,
    syncRemote: true,
    runTests: true,
    commitChanges: true,
    versionBump: true,
    push: true,
    githubRelease: false,  // Matches github.release
  },
});

Alternative: Configure in package.json

For simple configurations, add to your package.json:

{
  "releasePolice": {
    "commands": {
      "test": "npm test"
    },
    "releaseBranches": ["main"]
  }
}

CLI Options

| Command/Flag | Description | |------|-------------| | init | Create a release.config.ts file with all options | | --dry-run | Preview what would happen without making changes | | --skip-tests | Skip the test step | | --skip-sync | Skip remote sync step | | --skip-push | Skip push to remote (local version bump only) | | --github-release | Create GitHub release after push | | --version-type <type> | Pre-select version bump: patch, minor, or major | | -c, --config <path> | Path to config file |

Workflow Steps

  1. Branch Check - Verify you're on an allowed release branch
  2. Remote Sync - Fetch and pull latest changes if behind
  3. Run Tests - Execute your test command
  4. Commit Changes - Stage and commit uncommitted changes
  5. Version Bump - Interactive version selection (patch/minor/major)
  6. Push - Push commits and tags to remote
  7. GitHub Release - Create GitHub release (optional)

Programmatic Usage

import { runRelease, defineConfig, loadConfig } from 'release-police';

// Run with CLI options
await runRelease({
  dryRun: true,
  skipTests: false,
});

// Load and inspect config
const config = await loadConfig();
console.log(config.commands.test);

Examples

Custom test command

// release.config.ts
import { defineConfig } from 'release-police';

export default defineConfig({
  commands: {
    test: 'npm run lint && npm run test:unit && npm run test:e2e',
  },
});

Skip changelog (use AI-generated instead)

// release.config.ts
import { defineConfig } from 'release-police';

export default defineConfig({
  commands: {
    changelog: null, // Skip - generate with Claude Code instead
  },
});

CI-friendly release

# In CI, skip interactive prompts
npx release-police --version-type patch --skip-push

GitHub Release Integration

Create a GitHub release automatically after pushing:

// release.config.ts
import { defineConfig } from 'release-police';

export default defineConfig({
  github: {
    release: true,       // Enable GitHub release creation
    draft: true,         // Create as draft (recommended)
    generateNotes: true, // Auto-generate notes from commits
  },
});

Or via CLI flag:

npx release-police --github-release

Requirements: GitHub CLI must be installed and authenticated (gh auth login).

Why draft by default?

  • Review and edit release notes before publishing
  • Won't accidentally trigger CD workflows
  • Matches the safe, interactive philosophy of release-police

Development

npm run build      # Build the package
npm run test       # Run tests
npm run lint       # Lint code
npm run typecheck  # Type check

License

MIT © oharu121