From 409c80067cd371036efabb9e7d32bc536c9308d7 Mon Sep 17 00:00:00 2001 From: a690700752 Date: Fri, 24 Jun 2022 18:51:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=90=9B=20support=20nohoist=20in?= =?UTF-8?q?=20package=20config=20(#13)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 🐛 support nohoist in package config Co-authored-by: tanzheng Co-authored-by: Matteo Mazzarolo --- src/get-nohoist.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/get-nohoist.js b/src/get-nohoist.js index d2ca8a2..2774902 100644 --- a/src/get-nohoist.js +++ b/src/get-nohoist.js @@ -26,6 +26,17 @@ module.exports = function getNohoist(params = {}) { const packageJson = require(path.join(monorepoRoot, "package.json")); const nohoistGlobs = packageJson.workspaces.nohoist || []; + // Also add nohoist values of "workspaces.nohoist" of the current workspace' + // package.json (if any). + const currentWorkspacePackageJson = require(path.join(cwd, "package.json")); + if ( + currentWorkspacePackageJson && + currentWorkspacePackageJson.workspaces && + currentWorkspacePackageJson.workspaces.nohoist + ) { + nohoistGlobs.push(...currentWorkspacePackageJson.workspaces.nohoist); + } + return nohoistGlobs .map((nohoistGlob) => nohoistGlob.endsWith("/**")