@nocobase/cli 2.1.11-test.10 → 2.1.11-test.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -148,6 +148,33 @@ function normalizePnpmGlobalNodeModulesRoot(pnpmGlobalRoot) {
148
148
  ? normalizedGlobalRoot
149
149
  : path.join(normalizedGlobalRoot, 'node_modules');
150
150
  }
151
+ function readSiblingPnpmGlobalNodeModulesRoots(pnpmGlobalRoot) {
152
+ const globalNodeModulesDir = normalizePnpmGlobalNodeModulesRoot(pnpmGlobalRoot);
153
+ const globalProjectDir = path.dirname(globalNodeModulesDir);
154
+ let entries;
155
+ try {
156
+ entries = fs.readdirSync(globalProjectDir);
157
+ }
158
+ catch {
159
+ return [];
160
+ }
161
+ return entries
162
+ .filter((entry) => {
163
+ if (entry === path.basename(globalNodeModulesDir)) {
164
+ return false;
165
+ }
166
+ try {
167
+ return fs.statSync(path.join(globalProjectDir, entry)).isDirectory();
168
+ }
169
+ catch {
170
+ return false;
171
+ }
172
+ })
173
+ .map((entry) => path.join(globalProjectDir, entry, 'node_modules'));
174
+ }
175
+ function readPnpmGlobalNodeModulesRoots(pnpmGlobalRoot) {
176
+ return [normalizePnpmGlobalNodeModulesRoot(pnpmGlobalRoot), ...readSiblingPnpmGlobalNodeModulesRoots(pnpmGlobalRoot)];
177
+ }
151
178
  function packageNameToPath(packageName) {
152
179
  return packageName.split('/').filter(Boolean);
153
180
  }
@@ -176,7 +203,7 @@ function isPnpmGlobalRootPath(pnpmGlobalRoot, packageRoot) {
176
203
  return segments.slice(pnpmStoreIndex + 1).includes('node_modules');
177
204
  }
178
205
  function isPnpmGlobalPackagePath(pnpmGlobalRoot, packageRoot, packageName) {
179
- return isSameRealPath(path.join(normalizePnpmGlobalNodeModulesRoot(pnpmGlobalRoot), ...packageNameToPath(packageName)), packageRoot);
206
+ return readPnpmGlobalNodeModulesRoots(pnpmGlobalRoot).some((pnpmGlobalNodeModulesRoot) => isSameRealPath(path.join(pnpmGlobalNodeModulesRoot, ...packageNameToPath(packageName)), packageRoot));
180
207
  }
181
208
  function isPnpmGlobalBinProjectPath(pnpmGlobalBin, packageRoot, packageName) {
182
209
  const pnpmHome = path.dirname(normalizePath(pnpmGlobalBin));
@@ -192,7 +219,7 @@ function isPnpmGlobalBinProjectPath(pnpmGlobalBin, packageRoot, packageName) {
192
219
  return false;
193
220
  }
194
221
  return entries.some((entry) => {
195
- const pnpmGlobalRoot = path.join(globalDir, entry, 'node_modules');
222
+ const pnpmGlobalRoot = path.join(globalDir, entry);
196
223
  return (isPnpmGlobalRootPath(pnpmGlobalRoot, packageRoot)
197
224
  || isPnpmGlobalPackagePath(pnpmGlobalRoot, packageRoot, packageName));
198
225
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/cli",
3
- "version": "2.1.11-test.10",
3
+ "version": "2.1.11-test.11",
4
4
  "description": "NocoBase Command Line Tool",
5
5
  "type": "module",
6
6
  "main": "dist/generated/command-registry.js",