Skip to content

Commit 37510a9

Browse files
committed
fix: sometimes not working in docker. chore: removed useless code
1 parent bfe985e commit 37510a9

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

src/generate.ts

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const generate = async ({ moduleConfig, nuxt }: GenerateArgs) => {
3737
const collectionKebab = kebabCase(collectionName);
3838
const openApiTsFilePath = `${moduleFolderName}/${collectionKebab}/${openApiTsFileName}.ts`;
3939

40-
const { dst: openAPITSTypesDST } = addTemplate({
40+
addTemplate({
4141
filename: openApiTsFilePath,
4242
getContents: async () => {
4343
const openApiTs = await getOpenApiTs({
@@ -150,8 +150,6 @@ export const ${useLazyClientName}: UseLazyFetch<${pathsTypeName}> = (path, opts?
150150
if (clientConfig.nitro !== false) {
151151
const nitroClientPath = `${moduleFolderName}/${collectionKebab}/nitro`;
152152

153-
addNitroTsFile(nuxt, openAPITSTypesDST, false);
154-
155153
const { dst } = addTemplate({
156154
filename: `${nitroClientPath}.ts`,
157155
getContents:
@@ -179,8 +177,6 @@ export const ${clientName}: NitroFetch<${pathsTypeName}> = (path, opts) => {
179177
write: true,
180178
});
181179

182-
addNitroTsFile(nuxt, dst, true);
183-
184180
addedNitroClientsDirNames.add(collectionKebab);
185181

186182
if (clientConfig.nitro.autoImport) {
@@ -225,7 +221,7 @@ export const ${clientName}: NitroFetch<${pathsTypeName}> = (path, opts) => {
225221
}
226222

227223
if (addedNitroClientsDirNames.size > 0) {
228-
const { dst } = addTemplate({
224+
addTemplate({
229225
filename: `${moduleFolderName}/nitro.ts`,
230226
getContents: () => {
231227
const result = addedNitroClientsDirNames
@@ -242,8 +238,6 @@ export const ${clientName}: NitroFetch<${pathsTypeName}> = (path, opts) => {
242238
write: true,
243239
});
244240

245-
addNitroTsFile(nuxt, dst, true);
246-
247241
nuxt.hook('nitro:config', (nitro) => {
248242
nitro.alias ??= {};
249243
nitro.alias[`#${moduleFolderName}`] = path.join(
@@ -305,8 +299,7 @@ const getOpenApiTs = async ({
305299
nuxt,
306300
collectionName,
307301
});
308-
309-
return await openapiTS(new URL(openAPIFilePath), openApiTsConfig);
302+
return await openapiTS(new URL(`file://${openAPIFilePath}`), openApiTsConfig);
310303
};
311304

312305
type DiscoverOpenApiObjectFilePathArgs = {
@@ -347,22 +340,6 @@ const discoverOpenApiObjectFilePath = ({
347340
);
348341
};
349342

350-
const addNitroTsFile = (
351-
nuxt: Nuxt,
352-
file: string,
353-
nuxtIgnore: boolean = false,
354-
) => {
355-
nuxt.options.nitro.typescript ??= {};
356-
nuxt.options.nitro.typescript.tsConfig ??= {};
357-
nuxt.options.nitro.typescript.tsConfig.include ??= [];
358-
nuxt.options.nitro.typescript.tsConfig.include.push(file);
359-
360-
if (nuxtIgnore) {
361-
nuxt.options.typescript.tsConfig.exclude ??= [];
362-
nuxt.options.typescript.tsConfig.exclude.push(file);
363-
}
364-
};
365-
366343
const resolveClientConfig = (
367344
moduleConfig: ResolvedConfig['clients'],
368345
apiConfig: ApiConfig['clients'],

0 commit comments

Comments
 (0)