Skip to content

Commit d66f4cb

Browse files
committed
try to fix import paths
1 parent 03c8902 commit d66f4cb

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/utils/writeClientIndex.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ export async function writeClientIndex(
3333
exportModels: boolean,
3434
exportSchemas: boolean
3535
): Promise<void> {
36+
const modelsRelativePath = relative(outputPath, modelsPath);
37+
const schemasRelativePath = relative(outputPath, schemasPath);
38+
const servicesRelativePath = relative(outputPath, servicesPath);
39+
const coreRelativePath = relative(outputPath, corePath);
40+
3641
await writeFile(
3742
resolve(outputPath, 'index.ts'),
3843
templates.index({
@@ -45,10 +50,10 @@ export async function writeClientIndex(
4550
version: client.version,
4651
models: sortModelsByName(client.models),
4752
services: sortServicesByName(client.services),
48-
modelsPath: relative(outputPath, modelsPath),
49-
schemasPath: relative(outputPath, schemasPath),
50-
servicesPath: relative(outputPath, servicesPath),
51-
corePath: relative(outputPath, corePath),
53+
modelsPath: modelsRelativePath.startsWith('../') ? modelsRelativePath : `./${modelsRelativePath}`,
54+
schemasPath: schemasRelativePath.startsWith('../') ? schemasRelativePath : `./${schemasRelativePath}`,
55+
servicesPath: servicesRelativePath.startsWith('../') ? servicesRelativePath : `./${servicesRelativePath}`,
56+
corePath: coreRelativePath.startsWith('../') ? coreRelativePath : `./${coreRelativePath}`,
5257
})
5358
);
5459
}

0 commit comments

Comments
 (0)