Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

workspace-sieve

nonzzz491MIT0.3.2TypeScript support: included

A flexible workspace package filter for monorepos

readme

Workspace Sieve

Filter packages in your monorepo

Install

yarn add workspace-sieve

Usage

import { filterWorkspacePackagesFromDirectory } from 'workspace-sieve'

interface FilterOptions {
  patterns: string[] // patterns mean the workspaces you need to match
  filter?: string[] // filter means the packages that need be filtered out in the workplace (based on the patterns matched result)
  experimental?: { debug: boolean }
}

filterWorkspacePackagesFromDirectory(process.cwd(), {
  patterns: ['*', '**']
})

API's

export declare function filterWorkspacePackagesFromDirectory(
  workspaceRoot: string,
  options?: FilterOptions
): Promise<FilterWorkspacePackagesFromDirectoryResult>

export declare function filterWorkspacePackagesByGraphics(
  packageGraph: Record<string, Package>,
  patterns: string[],
  options?: { experimental?: { debug: boolean } }
): FilterWorkspaceResult

export declare function searchForPackageRoot(current: string, root?: string): string

export declare function searchForWorkspaceRoot(current: string, root?: string): string

Sponsors

Tips

  • The implementation result is not consistent with pnpm filter (Not support filter selector for now!!!) Maybe needed if yijie want~
  • filterWorkspacePackagesFromDirectory filter follow the pattern syntax not using selector.

LICENSE

MIT