24 lines
2.3 KiB
JavaScript
24 lines
2.3 KiB
JavaScript
"use strict";
|
|
require("typings-global");
|
|
const plugins = require("./projectinfo.plugins");
|
|
class ProjectinfoNpm {
|
|
constructor(cwdArg, optionsArg = {}) {
|
|
this.isNpm = false;
|
|
let resolvedCwd = plugins.path.resolve(cwdArg);
|
|
if (plugins.smartfile.fs.fileExists(plugins.path.join(resolvedCwd, 'package.json'))) {
|
|
this.isNpm = true;
|
|
this.packageJson = plugins.smartfile.fs.toObjectSync(plugins.path.join(resolvedCwd, 'package.json'), 'json');
|
|
this.name = this.packageJson.name;
|
|
this.version = this.packageJson.version;
|
|
this.status = 'ok';
|
|
this.license = this.packageJson.license;
|
|
if (this.packageJson.repository) {
|
|
this.git = new plugins.smartstring.GitRepo(this.packageJson.repository.url, optionsArg.gitAccessToken);
|
|
}
|
|
;
|
|
}
|
|
}
|
|
;
|
|
}
|
|
exports.ProjectinfoNpm = ProjectinfoNpm;
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8uY2xhc3Nlcy5ucG0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wcm9qZWN0aW5mby5jbGFzc2VzLm5wbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLGlEQUFpRDtBQUNqRDtJQVNJLFlBQVksTUFBYyxFQUFFLGFBQTBDLEVBQUU7UUFSeEUsVUFBSyxHQUFZLEtBQUssQ0FBQTtRQVNsQixJQUFJLFdBQVcsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQTtRQUM5QyxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsV0FBVyxFQUFFLGNBQ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