"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const content_checker_1 = require("@ewizardjs/content-checker");
const commander = require("commander");
const action_1 = require("../Api/versionControl/action");
const ensureAuth_1 = require("./utils/ensureAuth");
const logger_1 = require("./utils/logger");
const validateFrameworkVersion_1 = require("./utils/validateFrameworkVersion");
const CWD = process.cwd();
commander
    .name('wiz push')
    .description('wiz push - Push your local changes to the upstream eWizard project')
    .option('-f, --force', 'Overwrites the upstream version with your local changes')
    .parse(process.argv);
push(CWD, commander.opts())
    .then(validateFrameworkVersion_1.validateFrameworkVersion.bind(null, CWD))
    .catch(logger_1.handleError)
    .finally(logger_1.closeLogger);
function push(baseDir, options) {
    return __awaiter(this, void 0, void 0, function* () {
        yield (0, ensureAuth_1.default)();
        yield (0, content_checker_1.validateEwizardContent)(baseDir);
        yield (0, content_checker_1.validateInstalledDependencies)(baseDir);
        return (0, action_1.createVCSAction)(baseDir, { actionType: 'push' }, options);
    });
}
//# sourceMappingURL=wiz-push.js.map