Skip to content

Feature: pass pnpm filter through#5

Open
zachatrocity wants to merge 1 commit intoCorentinTh:mainfrom
zachatrocity:filter
Open

Feature: pass pnpm filter through#5
zachatrocity wants to merge 1 commit intoCorentinTh:mainfrom
zachatrocity:filter

Conversation

@zachatrocity
Copy link

@zachatrocity zachatrocity commented Jul 8, 2025

Thanks for the great utility!

I'm using this package to split up a massive monorepo and need to segment my work a little bit by using named catalogs.

I needed the ability to filter by particular project names in the individual package.json files.

Usage:

pnpm dev ~/Development/my-monorepo -F "@package/something-*"

Output:

Filtering by packages: @package/something-*

Found 43 dependencies in more than one package:

react in 2 packages (1 deps, 1 devDeps) version 18.2.0
react-dom in 2 packages (1 deps, 1 devDeps) version 18.2.0
react-query in 2 packages (2 deps, 0 devDeps) version 3.35.0, 3.39.0

Help output

Find pnpm catalog candidates in your monorepos (catalogger)                                                                                                             9:47:12 AM

USAGE catalogger [OPTIONS] [CWD]

ARGUMENTS

  CWD    Current working directory    <string>

OPTIONS

             -j, --json    Output as JSON                       
  -F, --filter=<string>    Filter by project names (pnpm filter)

@zachatrocity
Copy link
Author

@CorentinTh no pressure on this, I'm using it locally and it's serving my needs.

Let me know if you want me to open an issue for feature discussion if you don't want to support this feature

const { stdout } = await execAsync('pnpm -r ls --json', { cwd });
export async function getPackagesByDependencies({ cwd = getCwd(), filter = null }: { cwd?: string; filter?: string } = { }) {
if (filter) {
// eslint-disable-next-line no-console
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't see a custom logger so following the pattern by reporters.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant