"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

function _fsExtra() {
  const data = _interopRequireDefault(require("fs-extra"));

  _fsExtra = function () {
    return data;
  };

  return data;
}

function outputJsonFile(file, data) {
  try {
    _fsExtra().default.ensureFileSync(file);

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

  return file;
}