@@ -56,7 +56,7 @@ const cli = meow(`
5656 ignore : { shortFlag : 'i' , type : 'string' , isMultiple : true } ,
5757 ignoreDev : { shortFlag : 'd' , type : 'boolean' } ,
5858 includeWorkspaceRoot : { type : 'boolean' , 'default' : true } ,
59- noParentWorkspace : { type : 'boolean' , 'default' : false } ,
59+ parentWorkspace : { type : 'boolean' , 'default' : true } ,
6060 peerCheck : { shortFlag : 'p' , type : 'boolean' } ,
6161 strict : { shortFlag : 's' , type : 'boolean' } ,
6262 verbose : { shortFlag : 'v' , type : 'boolean' } ,
@@ -80,7 +80,7 @@ const {
8080 engineNoDev, // deprecated
8181 fix = false ,
8282 includeWorkspaceRoot,
83- noParentWorkspace ,
83+ parentWorkspace ,
8484 peerCheck,
8585 strict,
8686 verbose,
@@ -123,9 +123,21 @@ let workspaceFilter = workspace;
123123// - User hasn't explicitly opted out with --no-parent-workspace
124124// - User hasn't provided explicit workspace filters (which would be incompatible)
125125// - User hasn't provided a custom cwd path (cli.input[0])
126- if ( ! noParentWorkspace && ! workspace ?. length && ! cli . input [ 0 ] ) {
126+ if ( parentWorkspace && ! workspace ?. length && ! cli . input [ 0 ] ) {
127+ if ( debug ) {
128+ console . log ( chalk . blue ( 'Parent workspace detection:' ) + ' Attempting to resolve parent workspace root' ) ;
129+ }
130+
127131 const parentWorkspaceRoot = await resolveWorkspaceRootAsync ( requestedCwd ) ;
128132
133+ if ( debug ) {
134+ if ( parentWorkspaceRoot ) {
135+ console . log ( chalk . blue ( 'Parent workspace detection:' ) + ' Found parent workspace root: ' + parentWorkspaceRoot ) ;
136+ } else {
137+ console . log ( chalk . blue ( 'Parent workspace detection:' ) + ' No parent workspace root found' ) ;
138+ }
139+ }
140+
129141 // If we found a parent workspace root different from our requested cwd,
130142 // we're in a workspace situation
131143 if ( parentWorkspaceRoot && parentWorkspaceRoot !== requestedCwd ) {
@@ -134,7 +146,19 @@ if (!noParentWorkspace && !workspace?.length && !cli.input[0]) {
134146
135147 // Filter to just the current workspace to avoid checking all workspaces in the parent monorepo
136148 workspaceFilter = [ requestedCwd ] ;
149+
150+ if ( debug ) {
151+ console . log ( chalk . blue ( 'Parent workspace detection:' ) + ' Using parent workspace root, filtering to current workspace' ) ;
152+ }
153+ } else if ( debug && parentWorkspaceRoot === requestedCwd ) {
154+ console . log ( chalk . blue ( 'Parent workspace detection:' ) + ' Parent workspace root is same as requested cwd, not applying' ) ;
137155 }
156+ } else if ( debug ) {
157+ const reasons = [ ] ;
158+ if ( ! parentWorkspace ) reasons . push ( '--no-parent-workspace flag is set' ) ;
159+ if ( workspace ?. length ) reasons . push ( 'explicit workspace filters provided' ) ;
160+ if ( cli . input [ 0 ] ) reasons . push ( 'custom cwd path provided' ) ;
161+ console . log ( chalk . blue ( 'Parent workspace detection:' ) + ' Skipped (' + reasons . join ( ', ' ) + ')' ) ;
138162}
139163
140164/** @type {import('installed-check-core').LookupOptions } */
0 commit comments