diff --git a/packages/tao/src/commands/ngcli-adapter.ts b/packages/tao/src/commands/ngcli-adapter.ts index c2278a9e5e..304d03605a 100644 --- a/packages/tao/src/commands/ngcli-adapter.ts +++ b/packages/tao/src/commands/ngcli-adapter.ts @@ -25,7 +25,7 @@ import { dirname, extname, resolve, join } from 'path'; import * as stripJsonComments from 'strip-json-comments'; import { FileBuffer } from '@angular-devkit/core/src/virtual-fs/host/interface'; import { Observable, of } from 'rxjs'; -import { map, switchMap } from 'rxjs/operators'; +import { catchError, map, switchMap } from 'rxjs/operators'; import { NX_ERROR, NX_PREFIX } from '../shared/logger'; export async function scheduleTarget( @@ -393,6 +393,17 @@ export class NxScopeHostUsedForWrappedSchematics extends NxScopedHost { } } + isDirectory(path: Path): Observable { + return super.isDirectory(path).pipe( + catchError(() => of(false)), + switchMap((isDirectory) => + isDirectory + ? of(true) + : of(this.host.exists(path) && !this.host.isFile(path)) + ) + ); + } + isFile(path: Path): Observable { if (isWorkspaceConfigPath(path)) { return findWorkspaceConfigFileChange(this.host)