microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
42b1aa5553c67930776e5dccc6981ba25a79e2ec

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/extension/appcenter/codepush/releaseReact.ts

36lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
4import { AppCenterClient, models } from "../api/index";
5import { ILogger, LogLevel } from "../../log/LogHelper";
6import { ICodePushReleaseParams } from "../command/commandParams";
7import { getQPromisifiedClientResult } from "../api/createClient";
8import * as Q from "q";
9import { CommandResult, success, failure, ErrorCodes } from "../command/commandResult";
10import * as fs from "fs";
11
12export default class CodePushReleaseReact {
13 public static exec(client: AppCenterClient, params: ICodePushReleaseParams, logger: ILogger): Q.Promise<CommandResult> {
14 const app = params.app;
15 return getQPromisifiedClientResult(client.codepush.codePushDeploymentReleases.create(
16 app.appName,
17 params.deploymentName,
18 app.ownerName,
19 <string>params.appVersion,
20 {
21 packageProperty: fs.createReadStream(params.updatedContentZipPath),
22 deploymentName: params.deploymentName,
23 description: params.description,
24 disabled: params.isDisabled,
25 mandatory: params.isMandatory,
26 noDuplicateReleaseError: false, // TODO: remove it, not needed to send to server
27 rollout: params.rollout,
28 })
29 ).then((result: models.CodePushRelease) => {
30 return success(result);
31 }).catch((e) => {
32 logger.log("An error occured on doing Code Push release", LogLevel.Error);
33 return failure(ErrorCodes.Exception, "An error occured on doing Code Push release");
34 });
35 }
36}