Skip to content

Commit

Permalink
fix(core): override isDirectory in wrapped angular schematics host (n…
Browse files Browse the repository at this point in the history
  • Loading branch information
leosvelperez authored Jun 3, 2021
1 parent c8a20c6 commit d3992e9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/tao/src/commands/ngcli-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -393,6 +393,17 @@ export class NxScopeHostUsedForWrappedSchematics extends NxScopedHost {
}
}

isDirectory(path: Path): Observable<boolean> {
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<boolean> {
if (isWorkspaceConfigPath(path)) {
return findWorkspaceConfigFileChange(this.host)
Expand Down

0 comments on commit d3992e9

Please sign in to comment.