good night
This commit is contained in:
+29
-12
@@ -143,7 +143,9 @@ export abstract class FSExtension<Status extends FSStatus> extends Extension<FSS
|
||||
}
|
||||
|
||||
type NPMStatus = FSStatus & {
|
||||
version?: string
|
||||
latest?: string,
|
||||
current?: string, // TODO
|
||||
author?: string
|
||||
}
|
||||
|
||||
export class NPMExtension extends FSExtension<NPMStatus>{
|
||||
@@ -157,17 +159,32 @@ export class NPMExtension extends FSExtension<NPMStatus>{
|
||||
public async status(): Promise<NPMStatus> {
|
||||
|
||||
const fsStatus = await super.status()
|
||||
const { error,
|
||||
stdout,
|
||||
stderr } = await exec('npm info --prefix ' + this.prefix + ' ' + this.name + " version")
|
||||
const {
|
||||
latestError,
|
||||
latest,
|
||||
latestStdErr } = await exec('npm view --prefix ' + this.prefix + ' ' + this.name + " version")
|
||||
|
||||
if(error){
|
||||
logger.warn(stderr)
|
||||
if(latestError){
|
||||
logger.warn(latestStdErr)
|
||||
return fsStatus
|
||||
}
|
||||
|
||||
const {
|
||||
authorError,
|
||||
author,
|
||||
authorStdErr } = await exec('npm author ls --prefix ' + this.prefix + ' ' + this.name)
|
||||
|
||||
if(authorError){
|
||||
logger.warn(authorStdErr)
|
||||
return {
|
||||
...fsStatus,
|
||||
latest: latest}
|
||||
}
|
||||
|
||||
return {
|
||||
...fsStatus,
|
||||
version: stdout
|
||||
latest: latest,
|
||||
author: author
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,22 +249,22 @@ export class NPMExtension extends FSExtension<NPMStatus>{
|
||||
}
|
||||
|
||||
export type GitStatus = FSStatus & {
|
||||
current?: string
|
||||
wanted?: string
|
||||
branch?: string
|
||||
remote?: string
|
||||
latest?: string
|
||||
}
|
||||
|
||||
export class GitExtension extends FSExtension<GitStatus>{
|
||||
constructor(
|
||||
name:string,
|
||||
version = "latest",
|
||||
public localPrefix:string,
|
||||
prefix:string,
|
||||
protected gitCloneURL: URL
|
||||
){
|
||||
super(name, version)
|
||||
}
|
||||
|
||||
public async status(): Promise<GitStatus>{
|
||||
|
||||
//TODO tomorrow
|
||||
}
|
||||
|
||||
public async install(): Promise<boolean> {
|
||||
|
||||
Reference in New Issue
Block a user