next-openapi-gen 0.0.10 → 0.0.12

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.
@@ -8,12 +8,24 @@ import openapiTemplate from "../openapi-template.js";
8
8
  const execPromise = util.promisify(exec);
9
9
  const spinner = ora("Initializing project with OpenAPI template...\n");
10
10
  const getPackageManager = async () => {
11
- if (fs.existsSync(path.join(process.cwd(), "yarn.lock"))) {
12
- return "yarn";
13
- }
14
- if (fs.existsSync(path.join(process.cwd(), "pnpm-lock.yaml"))) {
15
- return "pnpm";
11
+ let currentDir = process.cwd();
12
+ while (true) {
13
+ // Check for Yarn lock file
14
+ if (fs.existsSync(path.join(currentDir, "yarn.lock"))) {
15
+ return "yarn";
16
+ }
17
+ // Check for PNPM lock file
18
+ if (fs.existsSync(path.join(currentDir, "pnpm-lock.yaml"))) {
19
+ return "pnpm";
20
+ }
21
+ // If we're at the root directory, break the loop
22
+ const parentDir = path.dirname(currentDir);
23
+ if (parentDir === currentDir) {
24
+ break; // We've reached the root
25
+ }
26
+ currentDir = parentDir; // Move up one directory
16
27
  }
28
+ // Default to npm if no lock files are found
17
29
  return "npm";
18
30
  };
19
31
  async function createDocsPage() {
@@ -22,7 +22,7 @@ export class RouteProcessor {
22
22
  const content = fs.readFileSync(filePath, "utf-8");
23
23
  const ast = parse(content, {
24
24
  sourceType: "module",
25
- plugins: ["typescript"],
25
+ plugins: ["typescript", "decorators-legacy"],
26
26
  });
27
27
  traverse.default(ast, {
28
28
  ExportNamedDeclaration: (path) => {
@@ -32,7 +32,7 @@ export class SchemaProcessor {
32
32
  const content = fs.readFileSync(filePath, "utf-8");
33
33
  const ast = parse(content, {
34
34
  sourceType: "module",
35
- plugins: ["typescript"],
35
+ plugins: ["typescript", "decorators-legacy"],
36
36
  });
37
37
  traverse.default(ast, {
38
38
  VariableDeclarator: (path) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "next-openapi-gen",
3
- "version": "0.0.10",
4
- "description": "Super fast and easy way to generate OpenAPI 3.0 documentation automatically from API routes in a NextJS 14.",
3
+ "version": "0.0.12",
4
+ "description": "Super fast and easy way to generate OpenAPI documentation automatically from API routes in a NextJS 14.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",