Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vscode): Keep host.json when converting to NuGet based project #4534

Merged
merged 1 commit into from
Apr 3, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { connectionsFileName, funcIgnoreFileName, funcVersionSetting, hostFileName, localSettingsFileName } from '../../../constants';
import {
connectionsFileName,
funcIgnoreFileName,
funcVersionSetting,
hostFileName,
localSettingsFileName,
workflowFileName,
} from '../../../constants';
import { localize } from '../../../localize';
import { initProjectForVSCode } from '../../commands/initProjectForVSCode/initProjectForVSCode';
import { DotnetTemplateProvider } from '../../templates/dotnet/DotnetTemplateProvider';
Expand Down Expand Up @@ -191,7 +198,7 @@ async function updateBuildFile(context: IActionContext, target: vscode.Uri, dotn
}

async function deleteBundleProjectFiles(target: vscode.Uri): Promise<void> {
const filesTobeDeleted: string[] = [hostFileName, funcIgnoreFileName];
const filesTobeDeleted: string[] = [funcIgnoreFileName];
for (const fileName of filesTobeDeleted) {
if (await fse.pathExists(path.join(target.fsPath, fileName))) {
await deleteFile(path.join(target.fsPath, fileName));
Expand All @@ -204,7 +211,7 @@ async function deleteFile(file: string): Promise<void> {
}

async function renameBundleProjectFiles(target: vscode.Uri): Promise<void> {
const filesToBeRenamed: string[] = [localSettingsFileName];
const filesToBeRenamed: string[] = [hostFileName, localSettingsFileName];
for (const fileName of filesToBeRenamed) {
if (await fse.pathExists(path.join(target.fsPath, fileName))) {
await renameFile(path.join(target.fsPath, fileName), path.join(target.fsPath, fileName + '-copy'));
Expand All @@ -217,7 +224,7 @@ async function renameFile(fileName: string, newFileName: string): Promise<void>
}

async function copyBundleProjectFiles(target: vscode.Uri): Promise<void> {
const filesToBeCopied: string[] = [localSettingsFileName];
const filesToBeCopied: string[] = [hostFileName, localSettingsFileName];
for (const fileName of filesToBeCopied) {
if (
(await fse.pathExists(path.join(target.fsPath, fileName))) &&
Expand All @@ -229,8 +236,8 @@ async function copyBundleProjectFiles(target: vscode.Uri): Promise<void> {
}
}

async function getArtifactNamesFromProject(target: vscode.Uri): Promise<{ [key: string]: string[] }> {
const artifactDict: { [key: string]: string[] } = {
async function getArtifactNamesFromProject(target: vscode.Uri): Promise<Record<string, string[]>> {
const artifactDict: Record<string, string[]> = {
workflows: [],
connections: [],
artifacts: [],
Expand All @@ -256,7 +263,7 @@ async function getArtifactNamesFromProject(target: vscode.Uri): Promise<{ [key:
const filePath: string = path.join(target.fsPath, file);
if (await (await fse.stat(filePath)).isDirectory()) {
const workflowFiles: string[] = await fse.readdir(filePath);
if (workflowFiles.length == 1 && workflowFiles[0] == 'workflow.json') {
if (workflowFiles.length == 1 && workflowFiles[0] == workflowFileName) {
artifactDict['workflows'].push(file);
}
}
Expand Down
Loading