Skip to content

Commit c0e72d1

Browse files
authored
fix: splitting files interface (#23)
1 parent deaa094 commit c0e72d1

4 files changed

Lines changed: 31 additions & 26 deletions

File tree

‎src/Core/Files.ts‎

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import * as fs from 'fs'
22
import * as path from 'path'
33

4+
import { IFiles, Stat } from './Interfaces'
45
import { Log, Logger } from './Logger'
56

6-
export interface Stat {
7-
dir: boolean
8-
file: boolean
9-
filename: string
10-
}
11-
127
class InternalFiles {
138
private readonly log: Log = Logger('chest:files')
149

@@ -145,23 +140,4 @@ class InternalFiles {
145140
}
146141
}
147142

148-
export interface Files {
149-
basename(filepath: string): string
150-
deepdirs(rootpath: string): Promise<string[]>
151-
deepfiles(rootpath: string): Promise<string[]>
152-
exists(filepath: string): Promise<boolean>
153-
ext(filepath: string): string
154-
extensionless(filename: string): string
155-
join(...args: string[]): string
156-
json<T>(filepath: string): Promise<T>
157-
readfile(filepath: string): Promise<Buffer>
158-
listdirs(filepath: string): Promise<string[]>
159-
listfiles(filepath: string): Promise<string[]>
160-
mkdir(filepath: string): Promise<void>
161-
save<T>(filepath: string, data: T): Promise<void>
162-
statfile(filepath: string): Promise<fs.Stats>
163-
statfiles(filepath: string): Promise<Stat[]>
164-
writefile(filepath: string, data: any): Promise<void>
165-
}
166-
167-
export const Files: Files = new InternalFiles()
143+
export const Files: IFiles = new InternalFiles()

‎src/Core/Interfaces/IFiles.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import * as fs from 'fs'
2+
3+
import { Stat } from './Stat'
4+
5+
export interface IFiles {
6+
basename(filepath: string): string
7+
deepdirs(rootpath: string): Promise<string[]>
8+
deepfiles(rootpath: string): Promise<string[]>
9+
exists(filepath: string): Promise<boolean>
10+
ext(filepath: string): string
11+
extensionless(filename: string): string
12+
join(...args: string[]): string
13+
json<T>(filepath: string): Promise<T>
14+
readfile(filepath: string): Promise<Buffer>
15+
listdirs(filepath: string): Promise<string[]>
16+
listfiles(filepath: string): Promise<string[]>
17+
mkdir(filepath: string): Promise<void>
18+
save<T>(filepath: string, data: T): Promise<void>
19+
statfile(filepath: string): Promise<fs.Stats>
20+
statfiles(filepath: string): Promise<Stat[]>
21+
writefile(filepath: string, data: any): Promise<void>
22+
}

‎src/Core/Interfaces/Stat.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface Stat {
2+
dir: boolean
3+
file: boolean
4+
filename: string
5+
}

‎src/Core/Interfaces/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
export * from './Dictionary'
2+
export * from './IFiles'
23
export * from './LernaConfig'
34
export * from './NPM'
5+
export * from './Stat'
46
export * from './TypeScriptConfig'
57
export * from './Updater'

0 commit comments

Comments
 (0)