mirror of https://github.com/buster-so/buster.git
added double check for root turbo.json
This commit is contained in:
parent
de54e28f2e
commit
d539d7e190
|
@ -357,7 +357,7 @@ export const analystAgentTask: ReturnType<
|
|||
dataSourceId: dataSource.dataSourceId,
|
||||
dataSourceSyntax: dataSource.dataSourceSyntax,
|
||||
datasetsCount: datasets.length,
|
||||
datasets: datasets.map((d) => ({
|
||||
datasets: datasets.map((d: PermissionedDataset) => ({
|
||||
id: d.id,
|
||||
name: d.name,
|
||||
})),
|
||||
|
|
|
@ -7,16 +7,19 @@ import { config } from 'dotenv';
|
|||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
// Find the root of the monorepo (where turbo.json is)
|
||||
// Find the root of the monorepo (where turbo.json and pnpm-workspace.yaml are)
|
||||
function findMonorepoRoot(): string {
|
||||
let currentDir = __dirname;
|
||||
while (currentDir !== '/') {
|
||||
if (existsSync(path.join(currentDir, 'turbo.json'))) {
|
||||
const turboPath = path.join(currentDir, 'turbo.json');
|
||||
const pnpmWorkspacePath = path.join(currentDir, 'pnpm-workspace.yaml');
|
||||
// Look for both turbo.json AND pnpm-workspace.yaml to ensure we find the actual root
|
||||
if (existsSync(turboPath) && existsSync(pnpmWorkspacePath)) {
|
||||
return currentDir;
|
||||
}
|
||||
currentDir = path.dirname(currentDir);
|
||||
}
|
||||
throw new Error('Could not find monorepo root (turbo.json)');
|
||||
throw new Error('Could not find monorepo root (turbo.json + pnpm-workspace.yaml)');
|
||||
}
|
||||
|
||||
// Load environment variables from root .env file
|
||||
|
|
Loading…
Reference in New Issue