Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"license": "MIT",
"homepage": "https://microsoft.github.io/code-push",
"dependencies": {
"q": "^1.5.1",
"recursive-fs": "^2.1.0",
"slash": "^3.0.0",
"superagent": "^5.2.1",
Expand All @@ -33,7 +32,6 @@
"devDependencies": {
"@types/mocha": "^7.0.2",
"@types/node": "^13.11.0",
"@types/q": "^1.5.2",
"@types/slash": "^3.0.0",
"@types/superagent": "^4.1.4",
"@types/yazl": "^2.4.2",
Expand Down
15 changes: 7 additions & 8 deletions src/script/management-sdk.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import Q = require("q");
import slash = require("slash");
import superagent = require("superagent");
import * as recursiveFs from "recursive-fs";
import * as yazl from "yazl";
import { CodePushUnauthorizedError } from "../utils/code-push-error"

import Promise = Q.Promise;

import { AccessKey, AccessKeyRequest, Account, App, AppCreationRequest, CodePushError, CollaboratorMap, CollaboratorProperties, Deployment, DeploymentMetrics, Headers, Package, PackageInfo, ServerAccessKey, Session, UpdateMetrics } from "./types";

var superproxy = require("superagent-proxy");
Expand Down Expand Up @@ -75,7 +72,7 @@ class AccountManager {
}

public isAuthenticated(throwIfUnauthorized?: boolean): Promise<boolean> {
return Promise<any>((resolve, reject, notify) => {
return new Promise<any>((resolve, reject) => {
var request: superagent.Request = superagent.get(this._serverUrl + urlEncode`/authenticated`);
if (this._proxy) (<any>request).proxy(this._proxy);
this.attachCredentials(request);
Expand Down Expand Up @@ -302,7 +299,7 @@ class AccountManager {

public release(appName: string, deploymentName: string, filePath: string, targetBinaryVersion: string, updateMetadata: PackageInfo, uploadProgressCallback?: (progress: number) => void): Promise<Package> {

return Promise<Package>((resolve, reject, notify) => {
return new Promise<Package>((resolve, reject) => {

updateMetadata.appVersion = targetBinaryVersion;
var request: superagent.Request = superagent.post(this._serverUrl + urlEncode`/apps/${this.appNameParam(appName)}/deployments/${deploymentName}/release`);
Expand Down Expand Up @@ -370,7 +367,7 @@ class AccountManager {
private packageFileFromPath(filePath: string): Promise<PackageFile> {
var getPackageFilePromise: Promise<PackageFile>;
if (fs.lstatSync(filePath).isDirectory()) {
getPackageFilePromise = Promise<PackageFile>((resolve: (file: PackageFile) => void, reject: (reason: Error) => void): void => {
getPackageFilePromise = new Promise<PackageFile>((resolve: (file: PackageFile) => void, reject: (reason: Error) => void): void => {
var directoryPath: string = filePath;

recursiveFs.readdirr(directoryPath, (error?: any, directories?: string[], files?: string[]): void => {
Expand Down Expand Up @@ -408,7 +405,9 @@ class AccountManager {
});
});
} else {
getPackageFilePromise = Q({ isTemporary: false, path: filePath });
getPackageFilePromise = new Promise<PackageFile>((resolve: (file: PackageFile) => void, reject: (reason: Error) => void): void => {
resolve({ isTemporary: false, path: filePath });
});
}
return getPackageFilePromise;
}
Expand Down Expand Up @@ -441,7 +440,7 @@ class AccountManager {
}

private makeApiRequest(method: string, endpoint: string, requestBody: string, expectResponseBody: boolean, contentType: string): Promise<JsonResponse> {
return Promise<JsonResponse>((resolve, reject, notify) => {
return new Promise<JsonResponse>((resolve, reject) => {
var request: superagent.Request = (<any>superagent)[method](this._serverUrl + endpoint);
if (this._proxy) (<any>request).proxy(this._proxy);
this.attachCredentials(request);
Expand Down
Loading