@atomist/automation-client
Version:
Atomist API for software low-level client
26 lines • 906 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const appRoot = require("app-root-path");
const path = require("path");
/**
* Load the package.json file of the consumer Node module.
*/
function loadHostPackageJson() {
try {
// This works if the consumer of automation-client is not a global module
return require(`${appRoot.path}/package.json`); // require is fine with / paths on windows
}
catch (err) {
// This works if the consumer is installed globally
const appDir = __dirname.split(path.join("node_modules", "@atomist", "automation-client"))[0];
try {
return require(path.join(appDir, "package.json"));
}
catch (err) {
// Intentionally left empty
}
}
return undefined;
}
exports.loadHostPackageJson = loadHostPackageJson;
//# sourceMappingURL=packageJson.js.map