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

migrate-barrel-imports

v1.7.3

Published

A CLI tool to migrate barrel imports in JavaScript/TypeScript monorepos

Readme

migrate-barrel-imports

A CLI tool to migrate barrel imports to direct module imports in JavaScript/TypeScript monorepos.

npm version License: MIT

About

Barrel files (index.ts re-exports) hurt build performance, cause circular dependencies, and slow down editor tooling. This CLI rewrites barrel imports across your codebase to point directly at the source modules.

Inspired by Please Stop Using Barrel Files.

// Before
import { foo, bar } from '@repo/package'

// After
import { foo } from '@repo/package/src/foo'
import { bar } from '@repo/package/src/bar'

Features

  • Glob patterns for targeting multiple packages at once
  • Automatic resolution of re-exported symbols to their source files
  • Configurable file ignore patterns for both source and target directories
  • Optional file extension stripping for bundler-friendly imports

Installation

npm install -g migrate-barrel-imports

Requirements

  • Node.js >= 20

Usage

migrate-barrel-imports <source-path> [target-path] [options]

Or run without installing:

npx migrate-barrel-imports <source-path> [target-path] [options]

Arguments

| Argument | Description | Default | | ------------- | --------------------------------------------------------------------------- | ----------------------- | | source-path | Directory pattern for source packages (e.g. libs/*, packages/{ui,core}) | (required) | | target-path | Directory where imports should be migrated | . (current directory) |

Options

| Option | Description | | ---------------------------------- | ------------------------------------------------------------- | | --ignore-source-files <patterns> | Comma-separated file patterns to ignore in source directories | | --ignore-target-files <patterns> | Comma-separated file patterns to ignore in target directories | | --no-extension | Omit file extensions from rewritten import paths | | --dry-run | Preview changes without modifying files |

Examples

# Migrate a single package
migrate-barrel-imports ./packages/my-lib \
  --ignore-source-files "**/__tests__/**,**/__mocks__/**" \
  --ignore-target-files "**/*.test.ts"

# Migrate multiple packages using glob pattern
migrate-barrel-imports "libs/*" --no-extension

# Migrate specific packages
migrate-barrel-imports "packages/{ui,core,utils}" --ignore-target-files "**/*.test.ts"

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

Development Setup

git clone https://github.com/brandhaug/migrate-barrel-imports.git
cd migrate-barrel-imports
npm install

Running Tests

npm test

License

This project is licensed under the MIT License.