"use strict";

var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");

var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");

var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");

var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");

var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");

var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");

var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");

var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");

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

_Object$defineProperty(exports, "__esModule", {
  value: true
});

exports.default = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));

var _pluginSequence = _interopRequireDefault(require("@start/plugin-sequence"));

var _publishToNpm = _interopRequireDefault(require("./plugins/publishToNpm"));

var _publishToNuget = _interopRequireDefault(require("./plugins/publishToNuget"));

var _optionalStep = _interopRequireDefault(require("./plugins/optionalStep"));

var _createArtifact = _interopRequireDefault(require("./plugins/createArtifact"));

var _pluginEnv = _interopRequireDefault(require("@start/plugin-env"));

const _excluded = ["npm", "nuget", "nugetPackageName", "tag", "apiKey", "removeDataTestIdProps"];

function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys(Object(source), true)).call(_context, function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }

var _default = _ref => {
  let {
    npm,
    nuget,
    nugetPackageName,
    tag,
    apiKey,
    removeDataTestIdProps
  } = _ref,
      rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  return (0, _pluginSequence.default)( // this is to remove cypress test ids from the react components markup
  (0, _pluginEnv.default)({
    REMOVE_DATA_TEST_ID: removeDataTestIdProps
  }), (0, _createArtifact.default)(_objectSpread({
    nugetPackageName,
    apiKey
  }, rest)), // do npm publish
  (0, _optionalStep.default)(npm, _publishToNpm.default, tag, 'PUBLISH TO NPM'), // do nuget publish
  (0, _optionalStep.default)(nuget, _publishToNuget.default, {
    nugetName: nugetPackageName,
    apiKey
  }, 'PUBLISH TO NUGET'));
};

exports.default = _default;
module.exports = exports.default;