This commit is contained in:
Brandon Waterloo [MSFT] 2024-04-01 09:26:16 -04:00 коммит произвёл GitHub
Родитель 1906364ce5
Коммит 1a088b5352
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 27 добавлений и 10 удалений

6
ext/vscode/package-lock.json сгенерированный
Просмотреть файл

@ -2352,9 +2352,9 @@
"dev": true
},
"node_modules/follow-redirects": {
"version": "1.15.4",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz",
"integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==",
"version": "1.15.6",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
"funding": [
{
"type": "individual",

Просмотреть файл

@ -81,9 +81,10 @@ export function getAzDevTerminalTitle(): string {
return vscode.l10n.t('az dev');
}
const UseExistingSource: string = 'azure-dev:/source/existing';
const UseCustomTemplate: string = 'azure-dev:/template/custom';
export async function selectApplicationTemplate(context: IActionContext): Promise<string> {
export async function selectApplicationTemplate(context: IActionContext): Promise<{ templateUrl: string, useExistingSource: false } | { templateUrl: undefined, useExistingSource: true }> {
let templateUrl: string = '';
const azureCli = await createAzureDevCli(context);
@ -95,13 +96,17 @@ export async function selectApplicationTemplate(context: IActionContext): Promis
const templates = JSON.parse(result.stdout) as { name: string, description: string, repositoryPath: string }[];
const choices = templates.map(t => { return { label: t.name, detail: t.description, data: t.repositoryPath } as IAzureQuickPickItem<string>; });
choices.unshift({ label: vscode.l10n.t('Use another template...'), data: '', id: UseCustomTemplate });
choices.unshift({ label: vscode.l10n.t('Use existing source code...'), data: '', id: UseExistingSource });
const template = await context.ui.showQuickPick(choices, {
canPickMany: false,
title: vscode.l10n.t('Select application template')
});
if (template.id === UseCustomTemplate) {
if (template.id === UseExistingSource) {
context.telemetry.properties.useExistingSource = 'true';
return { templateUrl: undefined, useExistingSource: true };
} else if (template.id === UseCustomTemplate) {
templateUrl = await context.ui.showInputBox({
prompt: vscode.l10n.t("Enter application template repository name ('{org or user}/{repo}')")
});
@ -110,7 +115,7 @@ export async function selectApplicationTemplate(context: IActionContext): Promis
}
context.telemetry.properties.templateUrlHash = sha256(templateUrl.toLowerCase());
return templateUrl;
return { templateUrl: templateUrl, useExistingSource: false };
}
export type EnvironmentInfo = {

Просмотреть файл

@ -20,12 +20,24 @@ export async function init(context: IActionContext, selectedFile?: vscode.Uri, a
folder = await quickPickWorkspaceFolder(context, vscode.l10n.t("To run '{0}' command you must first open a folder or workspace in VS Code", 'init'));
}
const templateUrl = options?.templateUrl ?? await selectApplicationTemplate(context);
let templateUrl: string | undefined = options?.templateUrl;
let useExistingSource: boolean = false;
if (!templateUrl) {
const selection = await selectApplicationTemplate(context);
templateUrl = selection.templateUrl;
useExistingSource = selection.useExistingSource;
}
const azureCli = await createAzureDevCli(context);
const command = azureCli.commandBuilder
.withArg('init')
.withNamedArg('-t', {value: templateUrl, quoting: vscode.ShellQuoting.Strong});
.withArg('init');
if (useExistingSource) {
command.withArg('--from-code');
} else {
command.withNamedArg('-t', {value: templateUrl!, quoting: vscode.ShellQuoting.Strong});
}
const workspacePath = folder?.uri;
if (options?.environmentName) {

Просмотреть файл

@ -53,7 +53,7 @@ export async function createAzureDevCli(context: IActionContext): Promise<AzureD
export function scheduleAzdVersionCheck(): void {
const oneSecond = 1 * 1000;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const minimumSupportedVersion = semver.coerce('0.8.0')!;
const minimumSupportedVersion = semver.coerce('1.8.0')!;
setTimeout(async () => {
const versionResult = await getAzdVersion();