@elysiajs/openapi 1.3.8 → 1.3.9

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.
@@ -78,8 +78,23 @@ var fromTypes = (targetFilePath, {
78
78
  stdio: debug ? "inherit" : void 0
79
79
  });
80
80
  const fileName = targetFilePath.replace(/.tsx$/, ".ts").replace(/.ts$/, ".d.ts");
81
- const targetFile = (overrideOutputPath ? typeof overrideOutputPath === "string" ? overrideOutputPath.startsWith("/") ? overrideOutputPath : (0, import_path.join)(tmpRoot, "dist", overrideOutputPath) : overrideOutputPath(tmpRoot) : void 0) ?? (0, import_path.join)(tmpRoot, "dist", fileName);
82
- if (!(0, import_fs.existsSync)(targetFile)) {
81
+ let targetFile = (overrideOutputPath ? typeof overrideOutputPath === "string" ? overrideOutputPath.startsWith("/") ? overrideOutputPath : (0, import_path.join)(tmpRoot, "dist", overrideOutputPath) : overrideOutputPath(tmpRoot) : void 0) ?? (0, import_path.join)(
82
+ tmpRoot,
83
+ "dist",
84
+ // remove leading like src or something similar
85
+ fileName.slice(fileName.indexOf("/") + 1)
86
+ );
87
+ let existed = (0, import_fs.existsSync)(targetFile);
88
+ if (!existed && overrideOutputPath) {
89
+ targetFile = (0, import_path.join)(
90
+ tmpRoot,
91
+ "dist",
92
+ // use original file name as-is eg. in monorepo
93
+ fileName
94
+ );
95
+ existed = (0, import_fs.existsSync)(targetFile);
96
+ }
97
+ if (!existed) {
83
98
  (0, import_fs.rmSync)((0, import_path.join)(tmpRoot, "tsconfig.json"));
84
99
  console.warn(
85
100
  "[@elysiajs/openapi/gen] Failed to generate OpenAPI schema"
@@ -61,8 +61,23 @@ var fromTypes = (targetFilePath, {
61
61
  stdio: debug ? "inherit" : void 0
62
62
  });
63
63
  const fileName = targetFilePath.replace(/.tsx$/, ".ts").replace(/.ts$/, ".d.ts");
64
- const targetFile = (overrideOutputPath ? typeof overrideOutputPath === "string" ? overrideOutputPath.startsWith("/") ? overrideOutputPath : join(tmpRoot, "dist", overrideOutputPath) : overrideOutputPath(tmpRoot) : void 0) ?? join(tmpRoot, "dist", fileName);
65
- if (!existsSync(targetFile)) {
64
+ let targetFile = (overrideOutputPath ? typeof overrideOutputPath === "string" ? overrideOutputPath.startsWith("/") ? overrideOutputPath : join(tmpRoot, "dist", overrideOutputPath) : overrideOutputPath(tmpRoot) : void 0) ?? join(
65
+ tmpRoot,
66
+ "dist",
67
+ // remove leading like src or something similar
68
+ fileName.slice(fileName.indexOf("/") + 1)
69
+ );
70
+ let existed = existsSync(targetFile);
71
+ if (!existed && overrideOutputPath) {
72
+ targetFile = join(
73
+ tmpRoot,
74
+ "dist",
75
+ // use original file name as-is eg. in monorepo
76
+ fileName
77
+ );
78
+ existed = existsSync(targetFile);
79
+ }
80
+ if (!existed) {
66
81
  rmSync(join(tmpRoot, "tsconfig.json"));
67
82
  console.warn(
68
83
  "[@elysiajs/openapi/gen] Failed to generate OpenAPI schema"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elysiajs/openapi",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "description": "Plugin for Elysia to auto-generate API documentation",
5
5
  "author": {
6
6
  "name": "saltyAom",