File tree Expand file tree Collapse file tree
packages/tools/cli/src/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,7 +118,30 @@ export async function startStudio(options: { port: number; dir: string, open?: b
118118
119119 // Load Schema
120120 const loader = new ObjectLoader ( app . metadata ) ;
121- loader . load ( rootDir ) ;
121+
122+ // Load Presets
123+ if ( Array . isArray ( config . presets ) ) {
124+ console . log ( chalk . gray ( `Loading ${ config . presets . length } presets...` ) ) ;
125+ for ( const preset of config . presets ) {
126+ try {
127+ loader . loadPackage ( preset ) ;
128+ } catch ( e : any ) {
129+ console . warn ( chalk . yellow ( `Failed to load preset ${ preset } :` ) , e . message ) ;
130+ }
131+ }
132+ }
133+
134+ // Load Schema from Directory
135+ // In a monorepo root with presets, scanning everything is dangerous.
136+ // We check if we are in a monorepo-like environment.
137+ const isMonorepoRoot = fs . existsSync ( path . join ( rootDir , 'pnpm-workspace.yaml' ) ) || fs . existsSync ( path . join ( rootDir , 'pnpm-lock.yaml' ) ) ;
138+
139+ // If we are in a likely monorepo root AND have presets, skip recursive scan
140+ if ( isMonorepoRoot && config . presets && config . presets . length > 0 ) {
141+ console . log ( chalk . yellow ( 'Monorepo root detected with presets. Skipping recursive file scan of root directory to avoid conflicts.' ) ) ;
142+ } else {
143+ loader . load ( rootDir ) ;
144+ }
122145 }
123146
124147 // 2. Load Schema & Init
You can’t perform that action at this time.
0 commit comments