Socket
Socket
Sign inDemoInstall

@microsoft/vscode-azext-azureappservice

Package Overview
Dependencies
Maintainers
11
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/vscode-azext-azureappservice - npm Package Compare versions

Comparing version 2.3.0-agent.1 to 2.3.0-agent.2

out/src/deploy/wizard/createDeployWizard.d.ts

4

out/src/createAppService/SiteNameStep.d.ts

@@ -1,6 +0,6 @@

import { AgentInputBoxOptions, AzureNameStep } from '@microsoft/vscode-azext-utils';
import { AzureNameStep, ParameterAgentMetadata } from '@microsoft/vscode-azext-utils';
import { IAppServiceWizardContext } from './IAppServiceWizardContext';
export declare class SiteNameStep extends AzureNameStep<IAppServiceWizardContext> {
private _inputBoxAgentMetadata;
constructor(inputBoxAgentMetadata?: AgentInputBoxOptions["agentMetadata"]);
constructor(inputBoxAgentMetadata?: ParameterAgentMetadata);
prompt(context: IAppServiceWizardContext): Promise<void>;

@@ -7,0 +7,0 @@ getRelatedName(context: IAppServiceWizardContext, name: string): Promise<string | undefined>;

@@ -71,5 +71,5 @@ "use strict";

agentMetadata: (_c = this._inputBoxAgentMetadata) !== null && _c !== void 0 ? _c : {
paramterNameTitle: "Site Name",
parameterName: "siteName",
parameterDescription: "The name of the app service site.",
parameterDisplayTitle: "Site Name",
parameterDisplayDescription: "The name of the app service site.",
}

@@ -76,0 +76,0 @@ };

@@ -0,1 +1,2 @@

import { ExecuteActivityContext } from '@microsoft/vscode-azext-utils';
import { ParsedSite } from '../SiteClient';

@@ -6,2 +7,2 @@ import { IDeployContext } from './IDeployContext';

*/
export declare function deploy(site: ParsedSite, fsPath: string, context: IDeployContext): Promise<void>;
export declare function deploy(site: ParsedSite, fsPath: string, context: IDeployContext & ExecuteActivityContext): Promise<void>;

@@ -17,14 +17,5 @@ "use strict";

exports.deploy = void 0;
const fse = require("fs-extra");
const path = require("path");
const vscode_azext_utils_1 = require("@microsoft/vscode-azext-utils");
const vscode_1 = require("vscode");
const extensionVariables_1 = require("../extensionVariables");
const ScmType_1 = require("../ScmType");
const randomUtils_1 = require("../utils/randomUtils");
const deployToStorageAccount_1 = require("./deployToStorageAccount");
const deployWar_1 = require("./deployWar");
const deployZip_1 = require("./deployZip");
const localGitDeploy_1 = require("./localGitDeploy");
const runDeployTask_1 = require("./runDeployTask");
const syncTriggersPostDeploy_1 = require("./syncTriggersPostDeploy");
const createDeployWizard_1 = require("./wizard/createDeployWizard");
/**

@@ -36,98 +27,12 @@ * NOTE: This leverages a command with id `ext.prefix + '.showOutputChannel'` that should be registered by each extension

const client = yield site.createClient(context);
const config = yield client.getSiteConfig();
// We use the AppServicePlan in a few places, but we don't want to delay deployment, so start the promise now and save as a const
const aspPromise = client.getAppServicePlan();
try {
context.telemetry.properties.sourceHash = randomUtils_1.randomUtils.getPseudononymousStringHash(fsPath);
context.telemetry.properties.destHash = randomUtils_1.randomUtils.getPseudononymousStringHash(site.fullName);
context.telemetry.properties.scmType = String(config.scmType);
context.telemetry.properties.isSlot = site.isSlot ? 'true' : 'false';
context.telemetry.properties.alwaysOn = config.alwaysOn ? 'true' : 'false';
context.telemetry.properties.linuxFxVersion = getLinuxFxVersionForTelemetry(config);
context.telemetry.properties.nodeVersion = String(config.nodeVersion);
context.telemetry.properties.pythonVersion = String(config.pythonVersion);
context.telemetry.properties.hasCors = config.cors ? 'true' : 'false';
context.telemetry.properties.hasIpSecurityRestrictions = config.ipSecurityRestrictions && config.ipSecurityRestrictions.length > 0 ? 'true' : 'false';
context.telemetry.properties.javaVersion = String(config.javaVersion);
context.telemetry.properties.siteKind = site.kind;
client.getState().then((state) => {
context.telemetry.properties.state = state;
}, () => {
// ignore
});
aspPromise.then((plan) => {
if (plan) {
context.telemetry.properties.planStatus = String(plan.status);
context.telemetry.properties.planKind = String(plan.kind);
if (plan.sku) {
context.telemetry.properties.planSize = String(plan.sku.size);
context.telemetry.properties.planTier = String(plan.sku.tier);
}
}
}, () => {
// ignore
});
}
catch (error) {
// Ignore
}
const title = vscode_1.l10n.t('Deploying to "{0}"... Check [output window](command:{1}) for status.', site.fullName, extensionVariables_1.ext.prefix + '.showOutputChannel');
yield vscode_1.window.withProgress({ location: vscode_1.ProgressLocation.Notification, title }, () => __awaiter(this, void 0, void 0, function* () {
if (context.stopAppBeforeDeploy) {
extensionVariables_1.ext.outputChannel.appendLog(vscode_1.l10n.t('Stopping app...'), { resourceName: site.fullName });
yield client.stop();
}
extensionVariables_1.ext.outputChannel.appendLog(vscode_1.l10n.t('Starting deployment...'), { resourceName: site.fullName });
try {
if (!context.deployMethod && config.scmType === ScmType_1.ScmType.GitHub) {
throw new Error(vscode_1.l10n.t('"{0}" is connected to a GitHub repository. Push to GitHub repository to deploy.', site.fullName));
}
else if (!context.deployMethod && config.scmType === ScmType_1.ScmType.LocalGit) {
yield (0, localGitDeploy_1.localGitDeploy)(site, { fsPath: fsPath }, context);
}
else {
if (!(yield fse.pathExists(fsPath))) {
throw new Error(vscode_1.l10n.t('Failed to deploy path that does not exist: {0}', fsPath));
}
const javaRuntime = site.isLinux ? config.linuxFxVersion : config.javaContainer;
if (javaRuntime && /^(tomcat|wildfly|jboss)/i.test(javaRuntime)) {
yield (0, deployWar_1.deployWar)(context, site, fsPath);
}
else if (javaRuntime && /^java/i.test(javaRuntime) && !site.isFunctionApp) {
const pathFileMap = new Map([
[path.basename(fsPath), 'app.jar']
]);
yield (0, deployZip_1.deployZip)(context, site, fsPath, aspPromise, pathFileMap);
}
else if (context.deployMethod === 'storage') {
yield (0, deployToStorageAccount_1.deployToStorageAccount)(context, fsPath, site);
}
else {
yield (0, deployZip_1.deployZip)(context, site, fsPath, aspPromise);
}
}
}
finally {
if (context.stopAppBeforeDeploy) {
extensionVariables_1.ext.outputChannel.appendLog(vscode_1.l10n.t('Starting app...'), { resourceName: site.fullName });
yield client.start();
}
}
yield (0, runDeployTask_1.startPostDeployTask)(context, fsPath, config.scmType, site.fullName);
if (context.syncTriggersPostDeploy) {
// Don't sync triggers if app is stopped https://github.com/microsoft/vscode-azurefunctions/issues/1608
const state = yield client.getState();
if ((state === null || state === void 0 ? void 0 : state.toLowerCase()) === 'running') {
yield (0, syncTriggersPostDeploy_1.syncTriggersPostDeploy)(context, site);
}
}
}));
const innerContext = Object.assign(context, { site, fsPath, client, aspPromise });
const title = vscode_1.l10n.t('Deploying to app "{0}"', site.fullName);
const executeSteps = yield (0, createDeployWizard_1.createDeployExecuteSteps)(innerContext);
const wizard = new vscode_azext_utils_1.AzureWizard(innerContext, { executeSteps, title });
innerContext.activityTitle = title;
yield wizard.execute();
});
}
exports.deploy = deploy;
function getLinuxFxVersionForTelemetry(config) {
const linuxFxVersion = config.linuxFxVersion || '';
// Docker values point to the user's specific image, which we don't want to track
return /^docker/i.test(linuxFxVersion) ? 'docker' : linuxFxVersion;
}
//# sourceMappingURL=deploy.js.map

@@ -1,3 +0,5 @@

import { IActionContext } from '@microsoft/vscode-azext-utils';
import { AppServicePlan } from '@azure/arm-appservice';
import { ExecuteActivityContext, IActionContext } from '@microsoft/vscode-azext-utils';
import { WorkspaceFolder } from 'vscode';
import { ParsedSite, SiteClient } from '../SiteClient';
export declare enum AppSource {

@@ -23,2 +25,12 @@ setting = "setting",

syncTriggersPostDeploy?: boolean;
/**
* id retrieved from scm-deployment-id header to track deployment
*/
locationUrl?: string;
}
export interface InnerDeployContext extends IDeployContext, ExecuteActivityContext {
site: ParsedSite;
client: SiteClient;
fsPath: string;
aspPromise: Promise<AppServicePlan | undefined>;
}

@@ -5,6 +5,2 @@ import { IActionContext } from '@microsoft/vscode-azext-utils';

export declare function tryRunPreDeployTask(context: IDeployContext, deployFsPath: string, scmType: string | undefined): Promise<IPreDeployTaskResult>;
/**
* Starts the post deploy task, but doesn't wait for the result (not worth it)
*/
export declare function startPostDeployTask(context: IDeployContext, deployFsPath: string, scmType: string | undefined, resourceName: string): Promise<void>;
export interface IPreDeployTaskResult {

@@ -15,2 +11,3 @@ taskName: string | undefined;

}
export declare function shouldExecuteTask(context: IDeployContext, scmType: string | undefined, settingKey: string, taskName: string): boolean;
export declare function handleFailedPreDeployTask(context: IActionContext, preDeployResult: IPreDeployTaskResult): Promise<void>;

@@ -16,7 +16,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.handleFailedPreDeployTask = exports.startPostDeployTask = exports.tryRunPreDeployTask = exports.runPreDeployTask = void 0;
exports.handleFailedPreDeployTask = exports.shouldExecuteTask = exports.tryRunPreDeployTask = exports.runPreDeployTask = void 0;
const vscode_azext_utils_1 = require("@microsoft/vscode-azext-utils");
const vscode = require("vscode");
const ScmType_1 = require("../ScmType");
const extensionVariables_1 = require("../extensionVariables");
const ScmType_1 = require("../ScmType");
const taskUtils_1 = require("../utils/taskUtils");

@@ -60,24 +60,2 @@ function runPreDeployTask(context, deployFsPath, scmType) {

exports.tryRunPreDeployTask = tryRunPreDeployTask;
/**
* Starts the post deploy task, but doesn't wait for the result (not worth it)
*/
function startPostDeployTask(context, deployFsPath, scmType, resourceName) {
return __awaiter(this, void 0, void 0, function* () {
const settingKey = 'postDeployTask';
const taskName = vscode.workspace.getConfiguration(extensionVariables_1.ext.prefix, vscode.Uri.file(deployFsPath)).get(settingKey);
context.telemetry.properties.hasPostDeployTask = String(!!taskName);
if (taskName && shouldExecuteTask(context, scmType, settingKey, taskName)) {
const task = yield taskUtils_1.taskUtils.findTask(deployFsPath, taskName);
context.telemetry.properties.foundPostDeployTask = String(!!task);
if (task) {
yield taskUtils_1.taskUtils.executeIfNotActive(task);
extensionVariables_1.ext.outputChannel.appendLog(vscode.l10n.t('Started {0} "{1}".', settingKey, taskName), { resourceName });
}
else {
extensionVariables_1.ext.outputChannel.appendLog(vscode.l10n.t('WARNING: Failed to find {0} "{1}".', settingKey, taskName), { resourceName });
}
}
});
}
exports.startPostDeployTask = startPostDeployTask;
function shouldExecuteTask(context, scmType, settingKey, taskName) {

@@ -91,2 +69,3 @@ // We don't run deploy tasks for non-zipdeploy since that stuff should be handled by kudu

}
exports.shouldExecuteTask = shouldExecuteTask;
function waitForPreDeployTask(preDeployTask, deployFsPath) {

@@ -93,0 +72,0 @@ return __awaiter(this, void 0, void 0, function* () {

@@ -5,2 +5,3 @@ /// <reference types="node" />

import { Readable } from 'stream';
import * as vscode from 'vscode';
import { ParsedSite } from '../SiteClient';

@@ -11,2 +12,6 @@ export declare function runWithZipStream(context: IActionContext, options: {

pathFileMap?: Map<string, string>;
progress?: vscode.Progress<{
message?: string;
increment?: number;
}>;
callback: (zipStream: Readable) => Promise<AzExtPipelineResponse | void>;

@@ -17,3 +22,6 @@ }): Promise<AzExtPipelineResponse | void>;

*/
export declare function getFilesFromGlob(folderPath: string, resourceName: string): Promise<string[]>;
export declare function getFilesFromGlob(folderPath: string, resourceName: string, progress?: vscode.Progress<{
message?: string;
increment?: number;
}>): Promise<string[]>;
/**

@@ -20,0 +28,0 @@ * Adds files using gitignore filtering

@@ -27,6 +27,10 @@ "use strict";

function runWithZipStream(context, options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
function onFileSize(size) {
var _a;
context.telemetry.measurements.zipFileSize = size;
extensionVariables_1.ext.outputChannel.appendLog(vscode.l10n.t('Zip package size: {0}', prettybytes(size)), { resourceName: site.fullName });
const zipFileSize = vscode.l10n.t('Zip package size: {0}', prettybytes(size));
extensionVariables_1.ext.outputChannel.appendLog(zipFileSize, { resourceName: site.fullName });
(_a = options.progress) === null || _a === void 0 ? void 0 : _a.report({ message: zipFileSize });
}

@@ -45,3 +49,5 @@ let zipStream;

else {
extensionVariables_1.ext.outputChannel.appendLog(vscode.l10n.t('Creating zip package...'), { resourceName: site.fullName });
const creatingZip = vscode.l10n.t('Creating zip package...');
extensionVariables_1.ext.outputChannel.appendLog(creatingZip, { resourceName: site.fullName });
(_a = options.progress) === null || _a === void 0 ? void 0 : _a.report({ message: creatingZip });
const zipFile = new yazl.ZipFile();

@@ -70,5 +76,7 @@ let filesToZip = [];

else {
filesToZip = yield getFilesFromGlob(fsPath, site.fullName);
filesToZip = yield getFilesFromGlob(fsPath, site.fullName, options.progress);
}
extensionVariables_1.ext.outputChannel.appendLog(vscode.l10n.t('Adding {0} files to zip package...', filesToZip.length), { resourceName: site.fullName });
for (const file of filesToZip) {
extensionVariables_1.ext.outputChannel.appendLog(path.join(fsPath, file), { resourceName: site.fullName });
zipFile.addFile(path.join(fsPath, file), getPathFromMap(file, pathFileMap));

@@ -93,3 +101,3 @@ }

*/
function getFilesFromGlob(folderPath, resourceName) {
function getFilesFromGlob(folderPath, resourceName, progress) {
var _a;

@@ -105,10 +113,12 @@ return __awaiter(this, void 0, void 0, function* () {

let files = yield vscode.workspace.findFiles(new vscode.RelativePattern(folderPath, globPattern));
const ignoringFiles = vscode.l10n.t(`Ignoring files from \"{0}.{1}\"`, extensionVariables_1.ext.prefix, zipIgnorePatternStr);
if (ignorePatternList) {
try {
// not all ouptut channels _have_ to support appendLog, so catch the error
extensionVariables_1.ext.outputChannel.appendLog(vscode.l10n.t(`Ignoring files from \"{0}.{1}\"`, extensionVariables_1.ext.prefix, zipIgnorePatternStr), { resourceName });
extensionVariables_1.ext.outputChannel.appendLog(ignoringFiles, { resourceName });
}
catch (error) {
extensionVariables_1.ext.outputChannel.appendLine(vscode.l10n.t(`Ignoring files from \"{0}.{1}\"`, extensionVariables_1.ext.prefix, zipIgnorePatternStr));
extensionVariables_1.ext.outputChannel.appendLine(ignoringFiles);
}
progress === null || progress === void 0 ? void 0 : progress.report({ message: ignoringFiles });
// if there is anything to ignore, accumulate a list of ignored files and take the union of the lists

@@ -115,0 +125,0 @@ for (const pattern of ignorePatternList) {

import { IActionContext } from '@microsoft/vscode-azext-utils';
import { CancellationToken } from 'vscode';
import { CancellationToken, Progress } from 'vscode';
import { ParsedSite } from '../SiteClient';
import { IDeployContext } from './IDeployContext';
import { InnerDeployContext } from './IDeployContext';
type DeploymentOptions = {

@@ -10,4 +10,8 @@ expectedId?: string;

locationUrl?: string;
progress?: Progress<{
message?: string;
increment?: number;
}>;
};
export declare function waitForDeploymentToComplete(context: IActionContext & Partial<IDeployContext>, site: ParsedSite, options?: DeploymentOptions): Promise<void>;
export declare function waitForDeploymentToComplete(context: IActionContext & Partial<InnerDeployContext>, site: ParsedSite, options?: DeploymentOptions): Promise<void>;
export {};

@@ -24,3 +24,3 @@ "use strict";

function waitForDeploymentToComplete(context, site, options = {}) {
var _a;
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {

@@ -77,2 +77,3 @@ let fullLog = '';

fullLog = fullLog.concat(newEntry.message);
(_b = options.progress) === null || _b === void 0 ? void 0 : _b.report({ message: newEntry.message });
extensionVariables_1.ext.outputChannel.appendLog(newEntry.message, { date: newEntry.logTime, resourceName: site.fullName });

@@ -79,0 +80,0 @@ lastLogTimeForThisPoll = newEntry.logTime;

{
"name": "@microsoft/vscode-azext-azureappservice",
"author": "Microsoft Corporation",
"version": "2.3.0-agent.1",
"version": "2.3.0-agent.2",
"description": "Common tools for developing Azure App Service extensions for VS Code",

@@ -43,5 +43,5 @@ "tags": [

"@azure/storage-blob": "^12.3.0",
"@microsoft/vscode-azext-azureutils": "2.1.0-agent.1",
"@microsoft/vscode-azext-azureutils": "2.1.0-agent.2",
"@microsoft/vscode-azext-github": "^1.0.0",
"@microsoft/vscode-azext-utils": "2.2.0-agent.1",
"@microsoft/vscode-azext-utils": "2.2.0-agent.3",
"dayjs": "^1.11.2",

@@ -48,0 +48,0 @@ "fs-extra": "^10.0.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc