"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ensureCoreDeployed = void 0;
var _utils = require("@webiny/cli-plugin-deploy-pulumi/utils");
var _plugins = require("@webiny/cli-plugin-deploy-pulumi/plugins");
const ensureCoreDeployed = exports.ensureCoreDeployed = new _plugins.BeforeDeployPlugin(({
  env
}, ctx) => {
  const output = (0, _utils.getStackOutput)({
    folder: "apps/core",
    env
  });
  const coreDeployed = output && Object.keys(output).length > 0;
  if (coreDeployed) {
    return;
  }
  const coreAppName = ctx.error.hl("Core");
  const apiAppName = ctx.error.hl("API");
  const cmd = ctx.error.hl(`yarn webiny deploy core --env ${env}`);
  ctx.error(`Cannot deploy ${apiAppName} project application before deploying ${coreAppName}.`);
  throw new _utils.GracefulError([`Before deploying ${apiAppName} project application, please`, `deploy ${coreAppName} first by running: ${cmd}.`].join(" "));
});
ensureCoreDeployed.name = "api.before-deploy.ensure-core-deployed";

//# sourceMappingURL=ensureCoreDeployed.js.map