Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5b4eadf

Browse files
authored
[Customization] Fix creation of subdirectories (Azure#27805)
1 parent fab8dd1 commit 5b4eadf

File tree

7 files changed

+12
-8
lines changed

7 files changed

+12
-8
lines changed

common/tools/dev-tool/src/commands/customization/apply.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ export default leafCommand(commandInfo, async (options) => {
4444
from '${customDirectory}'
4545
to '${sourceDirectory}'
4646
writing to ${targetDirectory}.`);
47-
customize(sourceDirectory, customDirectory, targetDirectory);
47+
await customize(sourceDirectory, customDirectory, targetDirectory);
4848
return true;
4949
});

common/tools/dev-tool/src/util/customization/classes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export function getConstructorAugmentationParameters(
127127
);
128128
}
129129

130-
for (const [_, augmentedParameter] of expectedAugmentationParams) {
130+
for (const augmentedParameter of expectedAugmentationParams.values()) {
131131
if (!customConstructor.getBodyText()?.includes(augmentedParameter)) {
132132
throw new Error(`Custom constructor is missing parameter ${augmentedParameter}`);
133133
}

common/tools/dev-tool/src/util/customization/customize.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export async function customize(originalDir: string, customDir: string, outDir:
3737
// Bring everything from original into the output
3838
await copy(originalDir, outDir);
3939

40-
if (!directoryExists(customDir)) {
40+
if (!(await directoryExists(customDir))) {
4141
return;
4242
}
4343

@@ -46,7 +46,7 @@ export async function customize(originalDir: string, customDir: string, outDir:
4646
_originalFolderName;
4747

4848
// Bring files only present in custom into the output
49-
copyFilesInCustom(originalDir, customDir, outDir);
49+
await copyFilesInCustom(originalDir, customDir, outDir);
5050

5151
const projectInfo = await resolveProject(process.cwd());
5252

@@ -83,6 +83,7 @@ async function copyFilesInCustom(originalDir: string, customDir: string, outDir:
8383
for (const file of filesToCopy) {
8484
const sourcePath = file;
8585
const destPath = file.replace(customDir, outDir);
86+
await ensureDir(path.dirname(destPath));
8687
await copyFile(sourcePath, destPath);
8788
}
8889
}

common/tools/dev-tool/src/util/customization/helpers/files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ export async function getFiles(dir: string): Promise<string[]> {
2222
return dirent.isDirectory() ? getFiles(res) : res;
2323
})
2424
);
25-
return files.flat() as string[];
25+
return files.flat();
2626
}

common/tools/dev-tool/src/util/customization/imports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ImportDeclaration } from "ts-morph";
55
import { getCustomizationState } from "./state";
66
import * as path from "path";
77

8-
export async function augmentImports(
8+
export function augmentImports(
99
originalImports: Map<string, ImportDeclaration>,
1010
customImports: ImportDeclaration[]
1111
) {

common/tools/dev-tool/src/util/customization/interfaces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ function findCallSignature(
101101
): CallSignatureDeclaration | undefined {
102102
function typeEquals(a: Type, b: Type) {
103103
// Need to handle cases where the type is imported
104-
const aStr = a?.getText()?.replace(/import\(\".+\"\)\./, "");
105-
const bStr = b?.getText()?.replace(/import\(\".+\"\)\./, "");
104+
const aStr = a?.getText()?.replace(/import\(".+"\)\./, "");
105+
const bStr = b?.getText()?.replace(/import\(".+"\)\./, "");
106106
return aStr && bStr && aStr === bStr;
107107
}
108108
return interfaceDeclaration.getCallSignature((signature) => {

dataplane.code-workspace

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@
284284
},
285285
{
286286
"path": "sdk/core/core-http-compat"
287+
},
288+
{
289+
"path": "sdk/openai/openai"
287290
}
288291
],
289292
"settings": {

0 commit comments

Comments
 (0)