1 import DmlGenerator from "../classes/generators/dml.js"
2 import DocblockGenerator from "../classes/generators/docblock.js"
3 import EventsGenerator from "../classes/generators/events.js"
4 import { Options } from "../classes/generators/index.js"
5 import OasGenerator from "../classes/generators/oas.js"
6 import RouteExamplesGenerator from "../classes/generators/route-examples.js"
7 import { CommonCliOptions } from "../types/index.js"
8
9 export default async function run(
10 paths: string[],
11 { type, ...options }: Omit<Options, "paths"> & CommonCliOptions
12 ) {
13 console.log("Running...")
14
15 if (type === "all" || type === "docs") {
16 const docblockGenerator = new DocblockGenerator({
17 paths,
18 ...options,
19 })
20
21 await docblockGenerator.run()
22 }
23
24 if (type === "all" || type === "oas") {
25 const oasGenerator = new OasGenerator({
26 paths,
27 ...options,
28 })
29
30 await oasGenerator.run()
31 }
32
33 if (type === "all" || type === "dml") {
34 const dmlGenerator = new DmlGenerator({
35 paths,
36 ...options,
37 })
38
39 await dmlGenerator.run()
40 }
41
42 if (type === "all" || type === "route-examples") {
43 const routeExamplesGenerator = new RouteExamplesGenerator({
44 paths,
45 ...options,
46 })
47
48 await routeExamplesGenerator.run()
49 }
50
51 if (type === "all" || type === "events") {
52 const eventsGenerator = new EventsGenerator({
53 paths,
54 ...options,
55 })
56
57 await eventsGenerator.run()
58 }
59
60 console.log(`Finished running.`)
61 }