2016-06-08 23:56:05 +00:00
|
|
|
import "typings-global"
|
2016-02-20 04:05:07 +00:00
|
|
|
import plugins = require("./projectinfo.plugins");
|
2016-06-08 23:38:22 +00:00
|
|
|
export class ProjectinfoNpm {
|
2016-02-20 04:05:07 +00:00
|
|
|
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-23 08:36:40 +00:00
|
|
|
constructor(cwdArg:string,optionsArg:{gitAccessToken?:string} = {}){
|
2016-10-27 17:43:54 +00:00
|
|
|
this.packageJson = plugins.smartfile.fs.toObjectSync(
|
2016-02-20 04:05:07 +00:00
|
|
|
plugins.path.join(
|
|
|
|
plugins.path.resolve(cwdArg),
|
|
|
|
"package.json"
|
2016-06-09 01:13:40 +00:00
|
|
|
),
|
|
|
|
"json"
|
2016-02-20 04:05:07 +00:00
|
|
|
);
|
|
|
|
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-06-09 01:13:40 +00:00
|
|
|
this.git = new plugins.smartstring.GitRepo(this.packageJson.repository.url,optionsArg.gitAccessToken);
|
2016-02-22 23:58:33 +00:00
|
|
|
};
|
|
|
|
|
2016-02-23 08:38:17 +00:00
|
|
|
};
|
2016-06-08 23:38:22 +00:00
|
|
|
}
|