"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const core_1 = require("@electron-forge/core");
const get_1 = require("@electron/get");
const commander_1 = __importDefault(require("commander"));
const fs_extra_1 = __importDefault(require("fs-extra"));
require("./util/terminate");
const electron_forge_make_1 = require("./electron-forge-make");
const working_dir_1 = __importDefault(require("./util/working-dir"));
(async () => {
    let dir = process.cwd();
    commander_1.default
        .version((await fs_extra_1.default.readJson(path_1.default.resolve(__dirname, '../package.json'))).version)
        .arguments('[cwd]')
        .option('--target [target[,target...]]', 'The comma-separated deployment targets, defaults to "github"')
        .option('--dry-run', "Triggers a publish dry run which saves state and doesn't upload anything")
        .option('--from-dry-run', 'Attempts to publish artifacts from the last saved dry run')
        .allowUnknownOption(true)
        .action((cwd) => {
        dir = (0, working_dir_1.default)(dir, cwd);
    })
        .parse(process.argv);
    (0, get_1.initializeProxy)();
    const publishOpts = {
        dir,
        interactive: true,
        dryRun: commander_1.default.dryRun,
        dryRunResume: commander_1.default.fromDryRun,
    };
    if (commander_1.default.target)
        publishOpts.publishTargets = commander_1.default.target.split(',');
    publishOpts.makeOptions = await (0, electron_forge_make_1.getMakeOptions)();
    await core_1.api.publish(publishOpts);
})();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWxlY3Ryb24tZm9yZ2UtcHVibGlzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9lbGVjdHJvbi1mb3JnZS1wdWJsaXNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsZ0RBQXdCO0FBRXhCLCtDQUEyRDtBQUMzRCx1Q0FBZ0Q7QUFDaEQsMERBQWdDO0FBQ2hDLHdEQUEwQjtBQUUxQiw0QkFBMEI7QUFDMUIsK0RBQXVEO0FBQ3ZELHFF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