installed and exists is the same for FSExtensions
This commit is contained in:
@@ -93,7 +93,6 @@ abstract class Extension<Status extends SharedStatus>{
|
|||||||
|
|
||||||
export type FSStatus = SharedStatus & {
|
export type FSStatus = SharedStatus & {
|
||||||
prefix: string
|
prefix: string
|
||||||
exists: boolean
|
|
||||||
empty: boolean
|
empty: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,14 +122,14 @@ export abstract class FSExtension<Status extends FSStatus> extends Extension<FSS
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async isEmpty(): Promise<boolean>{
|
public async isEmpty(): Promise<boolean>{
|
||||||
if (!this.exists) return false
|
if (!this.isInstalled) return false
|
||||||
else {
|
else {
|
||||||
const files = await fs.readdir(this.prefix)
|
const files = await fs.readdir(this.prefix)
|
||||||
return files.length === 0
|
return files.length === 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async exists(): Promise<boolean>{
|
public async isInstalled(): Promise<boolean>{
|
||||||
try {
|
try {
|
||||||
await fs.access(path.resolve(this.prefix, this.name))
|
await fs.access(path.resolve(this.prefix, this.name))
|
||||||
return true
|
return true
|
||||||
@@ -157,7 +156,6 @@ export class NPMExtension extends FSExtension<NPMStatus>{
|
|||||||
public async status(): Promise<NPMStatus> {
|
public async status(): Promise<NPMStatus> {
|
||||||
|
|
||||||
const empty = this.isEmpty()
|
const empty = this.isEmpty()
|
||||||
const exists = this.exists()
|
|
||||||
const i = this.isInstalled()
|
const i = this.isInstalled()
|
||||||
const o = this.isOutdated()
|
const o = this.isOutdated()
|
||||||
const n = this.name
|
const n = this.name
|
||||||
|
|||||||
Reference in New Issue
Block a user