projectinfo/ts/projectinfo.npm.ts

29 lines
788 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-23 07:48:41 +00:00
git;
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){
2016-02-23 07:48:41 +00:00
this.git = plugins.smartstring.git(this.packageJson.repository.url);
2016-02-22 23:58:33 +00:00
};
2016-02-20 04:05:07 +00:00
}
}
export = ProjectinfoNPM;