"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.readOptionsForPackageJson = readOptionsForPackageJson;

var _fs = require("fs");

var _path = _interopRequireDefault(require("path"));

var _constants = require("../constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// import { CONFIG_ROOT } from "../constants";
function readOptionsForPackageJson(appPath) {
  const packagePath = _path.default.join(appPath, "package.json");

  if ((0, _fs.existsSync)(packagePath)) {
    // eslint-disable-next-line import/no-dynamic-require, global-require
    return require(packagePath)[_constants.BASE_CONFIG_KEY] || {};
  }

  return {};
}