@forklaunch/express 0.9.25 → 0.9.26

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.
package/lib/index.js CHANGED
@@ -43,6 +43,7 @@ var import_zod = require("@forklaunch/validator/zod");
43
43
  var import_express_api_reference = require("@scalar/express-api-reference");
44
44
  var import_crypto = __toESM(require("crypto"));
45
45
  var import_express2 = __toESM(require("express"));
46
+ var import_fs = __toESM(require("fs"));
46
47
  var import_swagger_ui_express = __toESM(require("swagger-ui-express"));
47
48
 
48
49
  // src/cluster/bun.cluster.ts
@@ -2066,6 +2067,20 @@ var Application = class extends import_http3.ForklaunchExpressLikeApplication {
2066
2067
  this.openapiConfiguration = options2?.openapi;
2067
2068
  }
2068
2069
  listen(...args) {
2070
+ if (process.env.FORKLAUNCH_MODE === "openapi") {
2071
+ const openApiSpec = (0, import_http3.generateOpenApiSpecs)(
2072
+ this.schemaValidator,
2073
+ [],
2074
+ [],
2075
+ this,
2076
+ this.openapiConfiguration
2077
+ );
2078
+ import_fs.default.writeFileSync(
2079
+ process.env.FORKLAUNCH_OPENAPI_OUTPUT,
2080
+ JSON.stringify(openApiSpec, null, 2)
2081
+ );
2082
+ process.exit(0);
2083
+ }
2069
2084
  const port = typeof args[0] === "number" ? args[0] : Number(process.env.PORT);
2070
2085
  const host = typeof args[1] === "string" ? args[1] : process.env.HOST ?? "localhost";
2071
2086
  const protocol = process.env.PROTOCOL ?? "http";
package/lib/index.mjs CHANGED
@@ -14,6 +14,7 @@ import { ZodSchemaValidator } from "@forklaunch/validator/zod";
14
14
  import { apiReference } from "@scalar/express-api-reference";
15
15
  import crypto2 from "crypto";
16
16
  import express2 from "express";
17
+ import fs2 from "fs";
17
18
  import swaggerUi from "swagger-ui-express";
18
19
 
19
20
  // src/cluster/bun.cluster.ts
@@ -2039,6 +2040,20 @@ var Application = class extends ForklaunchExpressLikeApplication {
2039
2040
  this.openapiConfiguration = options2?.openapi;
2040
2041
  }
2041
2042
  listen(...args) {
2043
+ if (process.env.FORKLAUNCH_MODE === "openapi") {
2044
+ const openApiSpec = generateOpenApiSpecs(
2045
+ this.schemaValidator,
2046
+ [],
2047
+ [],
2048
+ this,
2049
+ this.openapiConfiguration
2050
+ );
2051
+ fs2.writeFileSync(
2052
+ process.env.FORKLAUNCH_OPENAPI_OUTPUT,
2053
+ JSON.stringify(openApiSpec, null, 2)
2054
+ );
2055
+ process.exit(0);
2056
+ }
2042
2057
  const port = typeof args[0] === "number" ? args[0] : Number(process.env.PORT);
2043
2058
  const host = typeof args[1] === "string" ? args[1] : process.env.HOST ?? "localhost";
2044
2059
  const protocol = process.env.PROTOCOL ?? "http";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/express",
3
- "version": "0.9.25",
3
+ "version": "0.9.26",
4
4
  "description": "Forklaunch framework for express.",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -37,9 +37,9 @@
37
37
  "qs": "^6.14.0",
38
38
  "range-parser": "^1.2.1",
39
39
  "swagger-ui-express": "^5.0.1",
40
+ "@forklaunch/common": "0.6.18",
40
41
  "@forklaunch/core": "0.15.7",
41
- "@forklaunch/validator": "0.10.18",
42
- "@forklaunch/common": "0.6.18"
42
+ "@forklaunch/validator": "0.10.18"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@eslint/js": "^9.37.0",