From dcc9cb746352ec1e5bfd3fa4b04e3f9f0b2cb602 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Mon, 11 Oct 2021 11:11:37 +0300 Subject: [PATCH] feat(filter-workspace-packages): new optional option added to readProjects (#3847) close #3726 --- .changeset/modern-gifts-end.md | 5 +++++ packages/filter-workspace-packages/src/getChangedPackages.ts | 2 +- packages/filter-workspace-packages/src/index.ts | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/modern-gifts-end.md diff --git a/.changeset/modern-gifts-end.md b/.changeset/modern-gifts-end.md new file mode 100644 index 0000000000..f2f814872f --- /dev/null +++ b/.changeset/modern-gifts-end.md @@ -0,0 +1,5 @@ +--- +"@pnpm/filter-workspace-packages": minor +--- + +New optional option added to `readProjects()`: engineStrict. diff --git a/packages/filter-workspace-packages/src/getChangedPackages.ts b/packages/filter-workspace-packages/src/getChangedPackages.ts index df0d501a42..ac282234f7 100644 --- a/packages/filter-workspace-packages/src/getChangedPackages.ts +++ b/packages/filter-workspace-packages/src/getChangedPackages.ts @@ -67,7 +67,7 @@ async function getChangedDirsSinceCommit (commit: string, workingDir: string, te const patterns = changedFilesIgnorePattern.filter( (pattern) => pattern.length ) - const changedFiles = patterns.length + const changedFiles = (patterns.length > 0) ? micromatch.not(allChangedFiles, patterns, { dot: true, }) diff --git a/packages/filter-workspace-packages/src/index.ts b/packages/filter-workspace-packages/src/index.ts index f196278d3b..a14d83257e 100644 --- a/packages/filter-workspace-packages/src/index.ts +++ b/packages/filter-workspace-packages/src/index.ts @@ -33,11 +33,12 @@ export async function readProjects ( workspaceDir: string, pkgSelectors: PackageSelector[], opts?: { + engineStrict?: boolean linkWorkspacePackages?: boolean changedFilesIgnorePattern?: string[] } ) { - const allProjects = await findWorkspacePackages(workspaceDir, {}) + const allProjects = await findWorkspacePackages(workspaceDir, { engineStrict: opts?.engineStrict }) const { selectedProjectsGraph } = await filterPkgsBySelectorObjects( allProjects, pkgSelectors,