Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support yarn workspaces with nohoist #104

Open
JohnSunHope opened this issue Mar 28, 2024 · 0 comments
Open

support yarn workspaces with nohoist #104

JohnSunHope opened this issue Mar 28, 2024 · 0 comments

Comments

@JohnSunHope
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @node-kit/[email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/@node-kit/yarn-workspace-info/dist/index.cjs.js b/node_modules/@node-kit/yarn-workspace-info/dist/index.cjs.js
index f9125b5..7f2c6f1 100644
--- a/node_modules/@node-kit/yarn-workspace-info/dist/index.cjs.js
+++ b/node_modules/@node-kit/yarn-workspace-info/dist/index.cjs.js
@@ -114,8 +114,9 @@ function _yarnWorkspaceInfo() {
       console.error("not a yarn workspace project");
       return null;
     }
+    console.info("root: ", root);
     var manifest = yield extra_fs.readJSON(path.join(root, WORKSPACE_MANIFEST_FILENAME));
-    var projects = yield fg([].concat(manifest.workspaces), {
+    var projects = yield fg([].concat(Array.isArray(manifest.workspaces) || typeof manifest.workspaces === "string" ? manifest.workspaces : manifest.workspaces.packages), {
       cwd: root,
       ignore: DEFAULT_IGNORE_PATHS,
       onlyDirectories: true
@@ -146,7 +147,7 @@ function yarnWorkspaceInfoSync() {
     return null;
   }
   var manifest = extra_fs.readJSONSync(path.join(root, WORKSPACE_MANIFEST_FILENAME));
-  var projects = fg.sync([].concat(manifest.workspaces), {
+  var projects = fg.sync([].concat(Array.isArray(manifest.workspaces) || typeof manifest.workspaces === "string" ? manifest.workspaces : manifest.workspaces.packages), {
     cwd: root,
     ignore: DEFAULT_IGNORE_PATHS,
     onlyDirectories: true
diff --git a/node_modules/@node-kit/yarn-workspace-info/dist/index.esm-bundler.js b/node_modules/@node-kit/yarn-workspace-info/dist/index.esm-bundler.js
index de4552e..e9c9152 100644
--- a/node_modules/@node-kit/yarn-workspace-info/dist/index.esm-bundler.js
+++ b/node_modules/@node-kit/yarn-workspace-info/dist/index.esm-bundler.js
@@ -112,8 +112,9 @@ function _yarnWorkspaceInfo() {
       console.error("not a yarn workspace project");
       return null;
     }
+    console.info("root: ", root);
     var manifest = yield readJSON(join(root, WORKSPACE_MANIFEST_FILENAME));
-    var projects = yield fg([].concat(manifest.workspaces), {
+    var projects = yield fg([].concat(Array.isArray(manifest.workspaces) || typeof manifest.workspaces === "string" ? manifest.workspaces : manifest.workspaces.packages), {
       cwd: root,
       ignore: DEFAULT_IGNORE_PATHS,
       onlyDirectories: true
@@ -144,7 +145,7 @@ function yarnWorkspaceInfoSync() {
     return null;
   }
   var manifest = readJSONSync(join(root, WORKSPACE_MANIFEST_FILENAME));
-  var projects = fg.sync([].concat(manifest.workspaces), {
+  var projects = fg.sync([].concat(Array.isArray(manifest.workspaces) || typeof manifest.workspaces === "string" ? manifest.workspaces : manifest.workspaces.packages), {
     cwd: root,
     ignore: DEFAULT_IGNORE_PATHS,
     onlyDirectories: true

This issue body was partially generated by patch-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant