@nocobase/cli 2.1.11-test.6 → 2.1.11-test.7
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.
- package/dist/lib/self-manager.js +20 -1
- package/package.json +1 -1
package/dist/lib/self-manager.js
CHANGED
|
@@ -116,7 +116,7 @@ function detectInstallMethod(packageRoot, options = {}) {
|
|
|
116
116
|
if (options.yarnGlobalDir && isSubPath(options.yarnGlobalDir, packageRoot)) {
|
|
117
117
|
return 'yarn-global';
|
|
118
118
|
}
|
|
119
|
-
if (options.pnpmGlobalRoot &&
|
|
119
|
+
if (options.pnpmGlobalRoot && isPnpmGlobalRootPath(options.pnpmGlobalRoot, packageRoot)) {
|
|
120
120
|
return 'pnpm-global';
|
|
121
121
|
}
|
|
122
122
|
if (isPnpmGlobalPath(packageRoot)) {
|
|
@@ -136,6 +136,25 @@ function isPnpmGlobalPath(packageRoot) {
|
|
|
136
136
|
}
|
|
137
137
|
return segments.slice(globalIndex + 2).includes('node_modules');
|
|
138
138
|
}
|
|
139
|
+
function isPnpmGlobalRootPath(pnpmGlobalRoot, packageRoot) {
|
|
140
|
+
if (isSubPath(pnpmGlobalRoot, packageRoot)) {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
const normalizedGlobalRoot = normalizePath(pnpmGlobalRoot);
|
|
144
|
+
const globalNodeModulesDir = path.basename(normalizedGlobalRoot) === 'node_modules'
|
|
145
|
+
? normalizedGlobalRoot
|
|
146
|
+
: path.join(normalizedGlobalRoot, 'node_modules');
|
|
147
|
+
const globalProjectDir = path.dirname(globalNodeModulesDir);
|
|
148
|
+
if (!isSubPath(globalProjectDir, packageRoot)) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
const segments = normalizePath(packageRoot).split(path.sep).filter(Boolean);
|
|
152
|
+
const pnpmStoreIndex = segments.indexOf('.pnpm');
|
|
153
|
+
if (pnpmStoreIndex === -1) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
return segments.slice(pnpmStoreIndex + 1).includes('node_modules');
|
|
157
|
+
}
|
|
139
158
|
function readCurrentBinPath(currentBinPath) {
|
|
140
159
|
const candidate = String(currentBinPath ?? process.argv[1] ?? '').trim();
|
|
141
160
|
if (!candidate) {
|