projectinfo/ts/projectinfo.npm.ts

32 lines
834 B
TypeScript
Raw Normal View History

2016-02-20 04:05:07 +00:00
/// <reference path="./typings/main.d.ts" />
import plugins = require("./projectinfo.plugins");
class ProjectinfoNPM {
packageJson;
name:string;
version:string;
2016-02-20 05:06:43 +00:00
status:string;
2016-02-21 16:17:31 +00:00
license:string;
2016-02-22 23:58:33 +00:00
repoUrl:string;
2016-02-20 04:05:07 +00:00
2016-02-20 05:06:43 +00:00
constructor(cwdArg:string){
2016-02-20 04:05:07 +00:00
this.packageJson = plugins.smartfile.readFileToObject(
plugins.path.join(
plugins.path.resolve(cwdArg),
"package.json"
)
);
this.name = this.packageJson.name;
this.version = this.packageJson.version;
2016-02-20 05:06:43 +00:00
this.status = "ok";
2016-02-22 23:58:33 +00:00
this.license = this.packageJson.license;
if (this.packageJson.repository){
this.repoUrl = this.packageJson.repository.url;
} else {
this.repoUrl = undefined;
};
2016-02-20 04:05:07 +00:00
}
}
export = ProjectinfoNPM;