Skip to content

Commit

Permalink
refactor: FileSystemHost.isCaseSensitive() is now required in impleme…
Browse files Browse the repository at this point in the history
…ntations.

BREAKING CHANGE: FileSystemHost.isCaseSensitive() is now required in implementations.
  • Loading branch information
dsherret committed Mar 10, 2019
1 parent f127cf4 commit 015a124
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/ts-morph.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ export declare class DirectoryEmitResult {
export interface DirectoryMoveOptions extends SourceFileMoveOptions {
}
export interface FileSystemHost {
/** Gets if this file system is case sensitive. */
isCaseSensitive(): boolean;
delete(path: string): Promise<void>;
deleteSync(path: string): void;
readDirSync(dirPath: string): string[];
Expand All @@ -319,8 +321,6 @@ export interface FileSystemHost {
directoryExistsSync(dirPath: string): boolean;
getCurrentDirectory(): string;
glob(patterns: ReadonlyArray<string>): string[];
/** Gets if this file system is case sensitive. Defaults to true if not implemented. */
isCaseSensitive?(): boolean;
}

export interface ProjectOptions {
Expand Down
4 changes: 2 additions & 2 deletions src/fileSystem/FileSystemHost.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export interface FileSystemHost {
/** Gets if this file system is case sensitive. */
isCaseSensitive(): boolean;
delete(path: string): Promise<void>;
deleteSync(path: string): void;
readDirSync(dirPath: string): string[];
Expand All @@ -18,6 +20,4 @@
directoryExistsSync(dirPath: string): boolean;
getCurrentDirectory(): string;
glob(patterns: ReadonlyArray<string>): string[];
/** Gets if this file system is case sensitive. Defaults to true if not implemented. */
isCaseSensitive?(): boolean;
}
4 changes: 4 additions & 0 deletions src/fileSystem/VirtualFileSystemHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export class VirtualFileSystemHost implements FileSystemHost {
this.getOrCreateDir("/");
}

isCaseSensitive() {
return true;
}

delete(path: string) {
try {
this.deleteSync(path);
Expand Down
3 changes: 1 addition & 2 deletions src/next-major-deprecations.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Deprecations in the next major

* Remove default export from library.
* Make `isCaseSensitive` required on `FileSystemHost`
* None.

0 comments on commit 015a124

Please sign in to comment.