2016-06-09 01:56:05 +02:00
|
|
|
import "typings-global"
|
2016-02-20 05:05:07 +01:00
|
|
|
import plugins = require("./projectinfo.plugins");
|
2016-06-09 01:38:22 +02:00
|
|
|
export class ProjectinfoNpm {
|
2016-02-20 05:05:07 +01:00
|
|
|
packageJson;
|
|
|
|
name:string;
|
|
|
|
version:string;
|
2016-02-20 06:06:43 +01:00
|
|
|
status:string;
|
2016-02-21 17:17:31 +01:00
|
|
|
license:string;
|
2016-02-23 08:48:41 +01:00
|
|
|
git;
|
2016-02-20 05:05:07 +01:00
|
|
|
|
2016-02-23 09:36:40 +01:00
|
|
|
constructor(cwdArg:string,optionsArg:{gitAccessToken?:string} = {}){
|
2016-06-09 03:13:40 +02:00
|
|
|
this.packageJson = plugins.smartfile.local.toObjectSync(
|
2016-02-20 05:05:07 +01:00
|
|
|
plugins.path.join(
|
|
|
|
plugins.path.resolve(cwdArg),
|
|
|
|
"package.json"
|
2016-06-09 03:13:40 +02:00
|
|
|
),
|
|
|
|
"json"
|
2016-02-20 05:05:07 +01:00
|
|
|
);
|
|
|
|
this.name = this.packageJson.name;
|
|
|
|
this.version = this.packageJson.version;
|
2016-02-20 06:06:43 +01:00
|
|
|
this.status = "ok";
|
2016-02-23 00:58:33 +01:00
|
|
|
this.license = this.packageJson.license;
|
|
|
|
if (this.packageJson.repository){
|
2016-06-09 03:13:40 +02:00
|
|
|
this.git = new plugins.smartstring.GitRepo(this.packageJson.repository.url,optionsArg.gitAccessToken);
|
2016-02-23 00:58:33 +01:00
|
|
|
};
|
|
|
|
|
2016-02-23 09:38:17 +01:00
|
|
|
};
|
2016-06-09 01:38:22 +02:00
|
|
|
}
|