installed and exists is the same for FSExtensions

This commit is contained in:
Daniel Hübleitner
2019-08-26 23:11:58 +02:00
parent 7a8c301392
commit 43c27a3817
+2 -4
View File
@@ -93,7 +93,6 @@ abstract class Extension<Status extends SharedStatus>{
export type FSStatus = SharedStatus & {
prefix: string
exists: boolean
empty: boolean
}
@@ -123,14 +122,14 @@ export abstract class FSExtension<Status extends FSStatus> extends Extension<FSS
}
public async isEmpty(): Promise<boolean>{
if (!this.exists) return false
if (!this.isInstalled) return false
else {
const files = await fs.readdir(this.prefix)
return files.length === 0
}
}
public async exists(): Promise<boolean>{
public async isInstalled(): Promise<boolean>{
try {
await fs.access(path.resolve(this.prefix, this.name))
return true
@@ -157,7 +156,6 @@ export class NPMExtension extends FSExtension<NPMStatus>{
public async status(): Promise<NPMStatus> {
const empty = this.isEmpty()
const exists = this.exists()
const i = this.isInstalled()
const o = this.isOutdated()
const n = this.name