Open dancrumb opened 1 year ago
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch get-yarn-workspaces@1.0.2 for the project I'm working on.
get-yarn-workspaces@1.0.2
I use this pattern in my root package file:
{ ... "workspaces": [ "apps/*", "packages/*" ] }
I have some files in my packages directory and get-yarn-workspaces is picking those up as workspaces which breaks some downstream code.
packages
get-yarn-workspaces
Since workspaces are inherently directories, it makes sense to filter out non-directories.
Here is the diff that solved my problem:
diff --git a/node_modules/get-yarn-workspaces/index.js b/node_modules/get-yarn-workspaces/index.js index bbacbcb..2803a6e 100644 --- a/node_modules/get-yarn-workspaces/index.js +++ b/node_modules/get-yarn-workspaces/index.js @@ -24,5 +24,5 @@ module.exports = function getWorkspaces(from) { }); const packages = getPackages(require(path.join(root, 'package.json'))); - return flatten(packages.map(name => glob.sync(path.join(root, name)))); + return flatten(packages.map(name => glob.sync(path.join(root, name)))).filter(w => fs.statSync(w).isDirectory()); };
This issue body was partially generated by patch-package.
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch
get-yarn-workspaces@1.0.2
for the project I'm working on.I use this pattern in my root package file:
I have some files in my
packages
directory andget-yarn-workspaces
is picking those up as workspaces which breaks some downstream code.Since workspaces are inherently directories, it makes sense to filter out non-directories.
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.