diff --git a/src/Core/Files.ts b/src/Core/Files.ts index cb5a55b..93b7498 100644 --- a/src/Core/Files.ts +++ b/src/Core/Files.ts @@ -1,14 +1,9 @@ import * as fs from 'fs' import * as path from 'path' +import { IFiles, Stat } from './Interfaces' import { Log, Logger } from './Logger' -export interface Stat { - dir: boolean - file: boolean - filename: string -} - class InternalFiles { private readonly log: Log = Logger('chest:files') @@ -145,23 +140,4 @@ class InternalFiles { } } -export interface Files { - basename(filepath: string): string - deepdirs(rootpath: string): Promise - deepfiles(rootpath: string): Promise - exists(filepath: string): Promise - ext(filepath: string): string - extensionless(filename: string): string - join(...args: string[]): string - json(filepath: string): Promise - readfile(filepath: string): Promise - listdirs(filepath: string): Promise - listfiles(filepath: string): Promise - mkdir(filepath: string): Promise - save(filepath: string, data: T): Promise - statfile(filepath: string): Promise - statfiles(filepath: string): Promise - writefile(filepath: string, data: any): Promise -} - -export const Files: Files = new InternalFiles() +export const Files: IFiles = new InternalFiles() diff --git a/src/Core/Interfaces/IFiles.ts b/src/Core/Interfaces/IFiles.ts new file mode 100644 index 0000000..c6f754c --- /dev/null +++ b/src/Core/Interfaces/IFiles.ts @@ -0,0 +1,22 @@ +import * as fs from 'fs' + +import { Stat } from './Stat' + +export interface IFiles { + basename(filepath: string): string + deepdirs(rootpath: string): Promise + deepfiles(rootpath: string): Promise + exists(filepath: string): Promise + ext(filepath: string): string + extensionless(filename: string): string + join(...args: string[]): string + json(filepath: string): Promise + readfile(filepath: string): Promise + listdirs(filepath: string): Promise + listfiles(filepath: string): Promise + mkdir(filepath: string): Promise + save(filepath: string, data: T): Promise + statfile(filepath: string): Promise + statfiles(filepath: string): Promise + writefile(filepath: string, data: any): Promise +} diff --git a/src/Core/Interfaces/Stat.ts b/src/Core/Interfaces/Stat.ts new file mode 100644 index 0000000..fe92b09 --- /dev/null +++ b/src/Core/Interfaces/Stat.ts @@ -0,0 +1,5 @@ +export interface Stat { + dir: boolean + file: boolean + filename: string +} diff --git a/src/Core/Interfaces/index.ts b/src/Core/Interfaces/index.ts index 4357c8c..02eaf13 100644 --- a/src/Core/Interfaces/index.ts +++ b/src/Core/Interfaces/index.ts @@ -1,5 +1,7 @@ export * from './Dictionary' +export * from './IFiles' export * from './LernaConfig' export * from './NPM' +export * from './Stat' export * from './TypeScriptConfig' export * from './Updater'