@unisphere/cli 1.58.8 → 1.58.9

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.
@@ -13,6 +13,47 @@ const { getEnvVariables } = require('../../src/lib/utils/unisphere/get-env-varia
13
13
  const { getUnisphereWorkspaceFile } = require('../../src/lib/utils/unisphere/unisphere-workspace-file');
14
14
  const os = require('os');
15
15
 
16
+
17
+ function findWorkspaceRoot(projectRoot) {
18
+ let currentPath = projectRoot;
19
+ let tsconfigPath = path.join(currentPath, 'tsconfig.json');
20
+
21
+ console.log(`[unisphere] Starting search from: ${projectRoot}`);
22
+
23
+ while (fs.existsSync(tsconfigPath)) {
24
+ const tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, 'utf8'));
25
+ const extendsPath = tsconfig.extends;
26
+
27
+ if (!extendsPath) {
28
+ // No extends, this might be the base
29
+ return { workspaceRoot: currentPath, baseTsconfigPath: tsconfigPath };
30
+ }
31
+
32
+ console.log(`[unisphere] Found extends: ${extendsPath} in ${tsconfigPath}`);
33
+
34
+ // Resolve the extends path
35
+ const resolvedExtendsPath = path.resolve(path.dirname(tsconfigPath), extendsPath);
36
+
37
+ if (!fs.existsSync(resolvedExtendsPath)) {
38
+ // Can't follow the chain further
39
+ return { workspaceRoot: currentPath, baseTsconfigPath: tsconfigPath };
40
+ }
41
+
42
+ // Check if this is tsconfig.base.json (likely the root)
43
+ if (path.basename(resolvedExtendsPath) === 'tsconfig.base.json') {
44
+ const workspaceRoot = path.dirname(resolvedExtendsPath);
45
+ return { workspaceRoot, baseTsconfigPath: resolvedExtendsPath };
46
+ }
47
+
48
+ // Continue following the chain
49
+ currentPath = path.dirname(resolvedExtendsPath);
50
+ tsconfigPath = resolvedExtendsPath;
51
+ }
52
+
53
+ // Fallback - couldn't find the chain
54
+ throw new Error('Could not find workspace root through tsconfig extends chain');
55
+ }
56
+
16
57
  function createTempBuildTsconfig({
17
58
  projectRoot,
18
59
  baseTsconfigPath, // can be absolute OR relative to projectRoot
@@ -96,6 +137,7 @@ function generateDynamicPaths(projectRoot) {
96
137
  });
97
138
  }
98
139
  } catch (error) {
140
+ throw new Error(`Failed to generate dynamic paths: ${error.message}`);
99
141
  console.warn(`[unisphere] Failed to generate dynamic paths: ${error.message}`);
100
142
  console.log(`[unisphere] Falling back to basic path generation`);
101
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/cli",
3
- "version": "1.58.8",
3
+ "version": "1.58.9",
4
4
  "bin": {
5
5
  "unisphere": "./src/cli.js"
6
6
  },