next-openapi-gen 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,11 +6,14 @@ import { OpenApiGenerator } from "../lib/openapi-generator.js";
6
6
  export async function generate() {
7
7
  const spinner = ora("Generating OpenAPI specification...\n").start();
8
8
  const generator = new OpenApiGenerator();
9
- const apiDocs = generator.generate();
10
9
  const config = generator.getConfig();
11
- // Check if public dir exists
10
+ // Create api dir if not exists
11
+ const apiDir = path.resolve(config.apiDir);
12
+ await fse.ensureDir(apiDir);
13
+ // Create public dir if not exists
12
14
  const outputDir = path.resolve("./public");
13
15
  await fse.ensureDir(outputDir);
16
+ const apiDocs = generator.generate();
14
17
  // Write api docs
15
18
  const outputFile = path.join(outputDir, config.outputFile);
16
19
  fs.writeFileSync(outputFile, JSON.stringify(apiDocs, null, 2));
@@ -1,4 +1,8 @@
1
- export const swaggerDeps = ["swagger-ui", "swagger-ui-react"];
1
+ export const swaggerDeps = [
2
+ "swagger-ui",
3
+ "swagger-ui-react",
4
+ "--legacy-peer-deps", // @temp: swagger-ui-react does not support React 19 now.
5
+ ];
2
6
  export function SwaggerUI(outputFile) {
3
7
  return `
4
8
  import "swagger-ui-react/swagger-ui.css";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-openapi-gen",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Super fast and easy way to generate OpenAPI documentation automatically from API routes in NextJS.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",