add getName function

This commit is contained in:
2016-02-20 06:06:43 +01:00
parent 841c8aa114
commit 77e473fe81
7 changed files with 39 additions and 6 deletions

View File

@ -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(){

View File

@ -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";
}
}