Skip to content

Commit

Permalink
feat: ✨ package filtering for --recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Mar 2, 2020
1 parent 1510390 commit 4422d7c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/filter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
import globrex from "globrex"
import { Workspace } from "./workspace"
import path from "path"

export function filter(workspace: Workspace, filter: string) {
const regex: RegExp = globrex(filter, { filepath: true }).regex
workspace.packages = workspace.packages.filter(
p =>
regex.test(p.name || "") ||
regex.test(path.relative(workspace.root, p.root))
)
return workspace
}

0 comments on commit 4422d7c

Please sign in to comment.