필터링
필터링을 사용하면 패키지의 특정 하위 집합으로 명령을 제한할 수 있습니다.
pnpm은 이름 또는 관계로 패키지를 선택하기 위한 다양한 selector 구문을 지원합니다.
Selectors may be specified via the --filter
(or -F
) flag:
pnpm --filter <package_selector> <command>
매칭
--filter <package_name>
To select an exact package, just specify its name (@scope/pkg
) or use a
pattern to select a set of packages (@scope/*
).
예시:
pnpm --filter "@babel/core" test
pnpm --filter "@babel/*" test
pnpm --filter "*core" test
Specifying the scope of the package is optional, so --filter=core
will pick @babel/core
if core
is not found.
However, if the workspace has multiple packages with the same name (for instance, @babel/core
and @types/core
),
then filtering without scope will pick nothing.
--filter <package_name>...
To select a package and its dependencies (direct and non-direct), suffix the
package name with an ellipsis: <package_name>...
. For instance, the next
command will run tests of foo
and all of its dependencies:
pnpm --filter foo... test
패턴을 사용하여 루트 패키지 세트를 선택할 수 있습니다.
pnpm --filter "@babel/preset-*..." test