appcenter-cli
Version:
Command line tool for Visual Studio App Center
102 lines (101 loc) • 5.04 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
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 lodash_1 = require("lodash");
const commandline_1 = require("../../../util/commandline");
const release_1 = require("../release");
const debug = require("debug")("appcenter-cli:commands:distribute:groups:publish");
let PublishToGroupCommand = class PublishToGroupCommand extends commandline_1.AppCommand {
run(client) {
return __awaiter(this, void 0, void 0, function* () {
const releaseArgs = ["--app", this.app.identifier, "--file", this.filePath, "--group", this.distributionGroup];
if (!lodash_1.isNil(this.buildVersion)) {
releaseArgs.push("--build-version", this.buildVersion);
}
if (!lodash_1.isNil(this.buildNumber)) {
releaseArgs.push("--build-number", this.buildNumber);
}
if (!lodash_1.isNil(this.releaseNotes)) {
releaseArgs.push("--release-notes", this.releaseNotes);
}
if (!lodash_1.isNil(this.releaseNotesFile)) {
releaseArgs.push("--release-notes-file", this.releaseNotesFile);
}
if (!lodash_1.isNil(this.environmentName)) {
releaseArgs.push("--env", this.environmentName);
}
if (!lodash_1.isNil(this.token)) {
releaseArgs.push("--token", this.token);
}
if (this.disableTelemetry) {
releaseArgs.push("--disable-telemetry");
}
// --help and --version end the command execution before it even gets here
// --debug, --format and --quiet set global variables which remain for the command newly created below
const releaseCommandArgs = {
args: releaseArgs,
command: ["distribute", "release"],
commandPath: undefined,
};
debug("Forwarding to distribute release command");
const releaseCommand = new release_1.default(releaseCommandArgs);
return releaseCommand.run(client);
});
}
};
__decorate([
commandline_1.help("Path to binary file"),
commandline_1.shortName("f"),
commandline_1.longName("file"),
commandline_1.required,
commandline_1.hasArg
], PublishToGroupCommand.prototype, "filePath", void 0);
__decorate([
commandline_1.help("Build version parameter required for .zip, .msi, .pkg and .dmg files"),
commandline_1.shortName("b"),
commandline_1.longName("build-version"),
commandline_1.hasArg
], PublishToGroupCommand.prototype, "buildVersion", void 0);
__decorate([
commandline_1.help("Build number parameter required for macOS .pkg and .dmg files"),
commandline_1.shortName("n"),
commandline_1.longName("build-number"),
commandline_1.hasArg
], PublishToGroupCommand.prototype, "buildNumber", void 0);
__decorate([
commandline_1.help("Distribution group name"),
commandline_1.shortName("g"),
commandline_1.longName("group"),
commandline_1.hasArg,
commandline_1.required
], PublishToGroupCommand.prototype, "distributionGroup", void 0);
__decorate([
commandline_1.help("Release notes text"),
commandline_1.shortName("r"),
commandline_1.longName("release-notes"),
commandline_1.hasArg
], PublishToGroupCommand.prototype, "releaseNotes", void 0);
__decorate([
commandline_1.help("Path to release notes file"),
commandline_1.shortName("R"),
commandline_1.longName("release-notes-file"),
commandline_1.hasArg
], PublishToGroupCommand.prototype, "releaseNotesFile", void 0);
PublishToGroupCommand = __decorate([
commandline_1.help("Publish an app file to a group")
], PublishToGroupCommand);
exports.default = PublishToGroupCommand;