add getName function
This commit is contained in:
@ -6,10 +6,19 @@ import ProjectinfoNPM = require("./projectinfo.npm");
|
||||
|
||||
var projectinfo:any = {};
|
||||
|
||||
//specific classes
|
||||
projectinfo.npm = function(cwdArg){
|
||||
return new ProjectinfoNPM(cwdArg);
|
||||
};
|
||||
|
||||
//quick functions
|
||||
projectinfo.getName = function(cwdArg){
|
||||
var localNpm = projectinfo.npm(cwdArg);
|
||||
if (localNpm.status === "ok"){
|
||||
return localNpm.name;
|
||||
}
|
||||
};
|
||||
|
||||
/* TODO
|
||||
projectinfo.git = function(){
|
||||
|
||||
|
@ -4,8 +4,9 @@ class ProjectinfoNPM {
|
||||
packageJson;
|
||||
name:string;
|
||||
version:string;
|
||||
status:string;
|
||||
|
||||
constructor(cwdArg){
|
||||
constructor(cwdArg:string){
|
||||
this.packageJson = plugins.smartfile.readFileToObject(
|
||||
plugins.path.join(
|
||||
plugins.path.resolve(cwdArg),
|
||||
@ -14,6 +15,7 @@ class ProjectinfoNPM {
|
||||
);
|
||||
this.name = this.packageJson.name;
|
||||
this.version = this.packageJson.version;
|
||||
this.status = "ok";
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user