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

npx-scope-finder

v1.3.0

Published

A tool to find executable (npx-compatible) packages within a specific npm scope

Downloads

7,228

Readme

npx-scope-finder

A specialized tool for finding executable (npx-compatible) packages within a specific npm scope. This tool helps you discover all packages in a scope that can be run using npx.

Cross-Platform Support: Works in both Node.js and browser environments!

Features

  • 🌐 Universal Compatibility: Works in both Node.js and browser environments
  • 🔄 Robust Error Handling: Built-in retry mechanism for network issues
  • 🎯 Scope-Focused: Easily find all executable packages within your organization's scope
  • 📦 Zero Dependencies: Uses native fetch API, no external dependencies
  • High Performance: Uses concurrent requests for faster results
  • 🛡️ Fault Tolerant: Uses Promise.allSettled to handle partial failures gracefully
  • 🔍 Complete Data: Includes full package metadata in the original property
  • 💪 Type Safety: Full TypeScript support with detailed type definitions
  • 🔻 Optimized Size: Code is minified for smaller package size

Changelog

A detailed changelog is available in the CHANGELOG.md file.

1.3.0 (2024-03-18)

  • 🔧 Improved project structure with separate type definitions
  • 🗑️ Removed code comments for smaller bundle size
  • 🔻 Added code minification for optimized package size
  • ⬆️ Updated TypeScript target to ES2020
  • 🧩 Exported all TypeScript interfaces and types for better developer experience
  • 📝 Enhanced type definitions based on official npm Registry API documentation
  • 🔄 Added links to official npm documentation for better TypeScript integration
  • 🧹 Removed unused type definitions to reduce bundle size and improve code clarity

1.2.0 (2024-03-15)

  • ⚡ Added concurrent requests for improved performance
  • 🛡️ Implemented Promise.allSettled for fault-tolerant package fetching
  • 🔍 Added original package data in the original property
  • 🗑️ Removed format utilities for a more streamlined API

1.1.0 (2024-03-15)

  • ✨ Added browser support
  • 🔄 Replaced npm-registry-fetch with native fetch API
  • ⚡️ Improved retry mechanism with better error handling
  • 🧪 Added comprehensive retry tests
  • 📦 Reduced package size by removing external dependencies

Installation

npm install npx-scope-finder
# or
pnpm add npx-scope-finder
# or
yarn add npx-scope-finder

Usage

import { npxFinder } from 'npx-scope-finder';

// Basic usage - get raw package data
const packages = await npxFinder('@your-scope', {
  timeout: 10000,    // Request timeout in milliseconds (default: 10000)
  retries: 3,        // Number of retries for failed requests (default: 3)
  retryDelay: 1000   // Delay between retries in milliseconds (default: 1000)
});
console.log(`Found ${packages.length} executable packages`);

// Access package data
packages.forEach(pkg => {
  console.log(`Package: ${pkg.name}@${pkg.version}`);
  console.log(`Description: ${pkg.description || 'No description'}`);
  console.log('Executable commands:', Object.keys(pkg.bin || {}));
  
  // Access full original npm registry data
  console.log('Full package data:', pkg.original);
  
  // Access other metadata
  if (pkg.links?.repository) {
    console.log(`Repository: ${pkg.links.repository}`);
  }
  
  if (pkg.dependencies) {
    console.log('Dependencies:', Object.keys(pkg.dependencies).length);
  }
});

// Custom formatting example
packages.forEach(pkg => {
  const customFormat = `
    📦 ${pkg.name}@${pkg.version}
    ${pkg.description || 'No description'}
    Commands: ${Object.keys(pkg.bin || {}).join(', ')}
    Run with: npx ${pkg.name}
  `;
  console.log(customFormat);
});

API

npxFinder(scope: string, options?: NpxFinderOptions): Promise<NPMPackage[]>

The main function for finding executable packages in a scope.

Parameters

  • scope: The npm scope to search in (e.g., '@your-scope')
  • options: Optional configuration
    • timeout: Request timeout in milliseconds (default: 10000)
    • retries: Number of retries for failed requests (default: 3)
    • retryDelay: Delay between retries in milliseconds (default: 1000)

Returns

Array of NPMPackage objects with the following structure:

interface NPMPackage {
  name: string;               // Package name
  description?: string;       // Package description
  version: string;           // Latest version
  bin?: Record<string, string>; // Executable commands
  dependencies?: Record<string, string>; // Dependencies
  scripts?: Record<string, string>; // npm scripts
  keywords?: string[];       // Package keywords
  links?: {                  // Related links
    npm?: string;           // npm package page
    repository?: string;    // Code repository
    homepage?: string;      // Homepage
  };
  original?: PackageInfo;    // Complete original package data from npm registry
}

Type Definitions: The NPMPackage interface and all other type definitions are derived from the official npm Registry API documentation.

Exported Types

The library exports all types for maximum flexibility:

import { 
  NPMPackage,           // Main package result type
  NpxFinderOptions,     // Options for the npxFinder function
  SearchResponse,       // Raw response from npm registry search
  PackageInfo          // Detailed package information from npm registry
} from 'npx-scope-finder';

This allows developers to easily extend the library or implement custom type-safe handling of the returned data.

Note: The type definitions in this library are based on the official npm Registry API documentation:

Example Output

Example package object:

{
  name: '@your-scope/cli-tool',
  version: '1.0.0',
  description: 'A command line tool',
  bin: {
    'your-tool': './bin/cli.js'
  },
  dependencies: {
    'commander': '^9.0.0',
    'chalk': '^5.0.0'
  },
  keywords: ['cli', 'tool', 'automation'],
  links: {
    npm: 'https://www.npmjs.com/package/@your-scope/cli-tool',
    repository: 'https://github.com/your-org/cli-tool',
    homepage: 'https://your-org.github.io/cli-tool'
  },
  original: {
    // Complete package data from npm registry
    // ...
  }
}

Development

Setup

# Clone the repository
git clone https://github.com/MyPrototypeWhat/npx-scope-finder.git
cd npx-scope-finder

# Install dependencies
pnpm install

# Build the project
pnpm build

Testing

# Run all tests
pnpm test

# Run specific test suites
pnpm test:functional  # Run functional tests
pnpm test:retry      # Run retry mechanisms tests

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT