next-openapi-gen 0.1.1 → 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
|
-
//
|
|
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));
|
package/package.json
CHANGED