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 usingselector
.