UNPKG

906 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const appRoot = require("app-root-path");
4const path = require("path");
5/**
6 * Load the package.json file of the consumer Node module.
7 */
8function loadHostPackageJson() {
9 try {
10 // This works if the consumer of automation-client is not a global module
11 return require(`${appRoot.path}/package.json`); // require is fine with / paths on windows
12 }
13 catch (err) {
14 // This works if the consumer is installed globally
15 const appDir = __dirname.split(path.join("node_modules", "@atomist", "automation-client"))[0];
16 try {
17 return require(path.join(appDir, "package.json"));
18 }
19 catch (err) {
20 // Intentionally left empty
21 }
22 }
23 return undefined;
24}
25exports.loadHostPackageJson = loadHostPackageJson;
26//# sourceMappingURL=packageJson.js.map
\No newline at end of file