'use strict';

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

var _fsExtra;

function _load_fsExtra() {
  return _fsExtra = _interopRequireDefault(require('fs-extra'));
}

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

function outputJsonFile(file, data) {
  try {
    (_fsExtra || _load_fsExtra()).default.ensureFileSync(file);
    return (_fsExtra || _load_fsExtra()).default.outputJsonSync(file, data);
  } catch (e) {
    console.error(`failed to write output to file:${e}`); // eslint-disable-line no-console
  }
  return file;
}