mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
OpenAPI: Fix empty directory detection
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-openapi': patch
|
||||
---
|
||||
|
||||
Fix empty directory detection
|
||||
@@ -2,5 +2,5 @@
|
||||
"title": "OpenAPI Example",
|
||||
"description": "A demo for Fumadocs OpenAPI",
|
||||
"root": true,
|
||||
"icon": "Rocket"
|
||||
"pages": ["index", "...(generated)"]
|
||||
}
|
||||
|
||||
@@ -2,18 +2,13 @@ import * as OpenAPI from 'fumadocs-openapi';
|
||||
import { rimraf } from 'rimraf';
|
||||
|
||||
export async function generateDocs() {
|
||||
await rimraf('./content/docs/openapi', {
|
||||
filter(v) {
|
||||
return !v.endsWith('index.mdx') && !v.endsWith('meta.json');
|
||||
},
|
||||
});
|
||||
await rimraf('./content/docs/openapi/(generated)');
|
||||
|
||||
await Promise.all([
|
||||
OpenAPI.generateFiles({
|
||||
input: ['./museum.yaml'],
|
||||
output: './content/docs/openapi',
|
||||
input: ['./content/docs/openapi/museum.yaml'],
|
||||
output: './content/docs/openapi/(generated)',
|
||||
per: 'operation',
|
||||
groupBy: 'tag',
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ export async function generateFiles(options: Config): Promise<void> {
|
||||
path.dirname(item) === path.dirname(outputPath),
|
||||
);
|
||||
|
||||
if (!isSharedDir && path.dirname(outputPath).length > 0) {
|
||||
if (!isSharedDir && path.dirname(outputPath) !== '.') {
|
||||
outputPath = path.join(path.dirname(outputPath) + '.mdx');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { DereferenceMap, Document } from '@/types';
|
||||
import type { NoReference } from '@/utils/schema';
|
||||
import type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
||||
import { load, dereference, upgrade } from '@scalar/openapi-parser';
|
||||
import { dereference, load, upgrade } from '@scalar/openapi-parser';
|
||||
import { fetchUrls } from '@scalar/openapi-parser/plugins/fetch-urls';
|
||||
import { readFiles } from '@scalar/openapi-parser/plugins/read-files';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user