sprint-es 0.0.68 → 0.0.69
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/dist/cjs/index.cjs +8 -12
- package/dist/esm/index.js +8 -12
- package/dist/types/sprint.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -163,22 +163,21 @@ class Sprint {
|
|
|
163
163
|
this.routesLoaded = this.init();
|
|
164
164
|
this.routesLoaded.then(() => {
|
|
165
165
|
if (this.openapi.generateOnBuild) {
|
|
166
|
+
this.app.get("/openapi.json", (_, res) => {
|
|
167
|
+
res.json(this.generateOpenAPISpec());
|
|
168
|
+
});
|
|
166
169
|
if (this.openapi.swaggerUi.enabled) {
|
|
167
|
-
console.log(`[Sprint] Loading Swagger UI...`);
|
|
168
170
|
import("swagger-ui-express").then((swaggerUi) => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
const swaggerRouter = require("express").Router();
|
|
172
|
+
swaggerRouter.use(swaggerUi.serve);
|
|
173
|
+
swaggerRouter.get("/", swaggerUi.setup(void 0, {
|
|
172
174
|
swaggerUrl: "/openapi.json"
|
|
173
175
|
}));
|
|
174
|
-
|
|
176
|
+
this.app.use("/swagger", swaggerRouter);
|
|
175
177
|
}).catch((err) => {
|
|
176
178
|
console.error(`[Sprint] ⚠️ swagger-ui-express error:`, err);
|
|
177
179
|
});
|
|
178
180
|
}
|
|
179
|
-
this.app.get("/openapi.json", (_, res) => {
|
|
180
|
-
res.json(this.generateOpenAPISpec());
|
|
181
|
-
});
|
|
182
181
|
}
|
|
183
182
|
if (finalConfig.autoListen) this.listen();
|
|
184
183
|
});
|
|
@@ -195,11 +194,9 @@ class Sprint {
|
|
|
195
194
|
}
|
|
196
195
|
try {
|
|
197
196
|
const routesCandidate = path.isAbsolute(this.routesPath) ? this.routesPath : path.join(callerDir, this.routesPath);
|
|
198
|
-
console.log(`[Sprint] Looking for routes at: ${routesCandidate}`);
|
|
199
197
|
if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory()) {
|
|
200
|
-
console.log(`[Sprint] Routes directory found, loading...`);
|
|
201
198
|
await this.loadRoutes(routesCandidate);
|
|
202
|
-
}
|
|
199
|
+
}
|
|
203
200
|
} catch (err) {
|
|
204
201
|
console.error("[Sprint] Failed to load routes:", err);
|
|
205
202
|
}
|
|
@@ -357,7 +354,6 @@ class Sprint {
|
|
|
357
354
|
}
|
|
358
355
|
}
|
|
359
356
|
}
|
|
360
|
-
console.log(`[Sprint] Registered routes for OpenAPI:`, this.registeredRoutes);
|
|
361
357
|
}
|
|
362
358
|
const routeMiddlewares = this.getMiddlewaresForRoute(routePath);
|
|
363
359
|
if (routeMiddlewares.length > 0) {
|
package/dist/esm/index.js
CHANGED
|
@@ -138,22 +138,21 @@ class Sprint {
|
|
|
138
138
|
this.routesLoaded = this.init();
|
|
139
139
|
this.routesLoaded.then(() => {
|
|
140
140
|
if (this.openapi.generateOnBuild) {
|
|
141
|
+
this.app.get("/openapi.json", (_, res) => {
|
|
142
|
+
res.json(this.generateOpenAPISpec());
|
|
143
|
+
});
|
|
141
144
|
if (this.openapi.swaggerUi.enabled) {
|
|
142
|
-
console.log(`[Sprint] Loading Swagger UI...`);
|
|
143
145
|
import("swagger-ui-express").then((swaggerUi) => {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
const swaggerRouter = require("express").Router();
|
|
147
|
+
swaggerRouter.use(swaggerUi.serve);
|
|
148
|
+
swaggerRouter.get("/", swaggerUi.setup(void 0, {
|
|
147
149
|
swaggerUrl: "/openapi.json"
|
|
148
150
|
}));
|
|
149
|
-
|
|
151
|
+
this.app.use("/swagger", swaggerRouter);
|
|
150
152
|
}).catch((err) => {
|
|
151
153
|
console.error(`[Sprint] ⚠️ swagger-ui-express error:`, err);
|
|
152
154
|
});
|
|
153
155
|
}
|
|
154
|
-
this.app.get("/openapi.json", (_, res) => {
|
|
155
|
-
res.json(this.generateOpenAPISpec());
|
|
156
|
-
});
|
|
157
156
|
}
|
|
158
157
|
if (finalConfig.autoListen) this.listen();
|
|
159
158
|
});
|
|
@@ -170,11 +169,9 @@ class Sprint {
|
|
|
170
169
|
}
|
|
171
170
|
try {
|
|
172
171
|
const routesCandidate = path.isAbsolute(this.routesPath) ? this.routesPath : path.join(callerDir, this.routesPath);
|
|
173
|
-
console.log(`[Sprint] Looking for routes at: ${routesCandidate}`);
|
|
174
172
|
if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory()) {
|
|
175
|
-
console.log(`[Sprint] Routes directory found, loading...`);
|
|
176
173
|
await this.loadRoutes(routesCandidate);
|
|
177
|
-
}
|
|
174
|
+
}
|
|
178
175
|
} catch (err) {
|
|
179
176
|
console.error("[Sprint] Failed to load routes:", err);
|
|
180
177
|
}
|
|
@@ -332,7 +329,6 @@ class Sprint {
|
|
|
332
329
|
}
|
|
333
330
|
}
|
|
334
331
|
}
|
|
335
|
-
console.log(`[Sprint] Registered routes for OpenAPI:`, this.registeredRoutes);
|
|
336
332
|
}
|
|
337
333
|
const routeMiddlewares = this.getMiddlewaresForRoute(routePath);
|
|
338
334
|
if (routeMiddlewares.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprint.d.ts","sourceRoot":"","sources":["../../src/sprint.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAA+B,gBAAgB,EAAoB,MAAM,SAAS,CAAC;AACnG,OAAO,OAAO,EAAE,EAAE,WAAW,EAAoD,MAAM,SAAS,CAAC;AAejG,eAAO,MAAM,aAAa,SAAQ,CAAC;AACnC,eAAO,MAAM,YAAY,SAAS,CAAC;AAwCnC,qBAAa,MAAM;IACR,GAAG,EAAE,WAAW,CAAC;IACxB,OAAO,CAAC,IAAI,CAAwD;IACpE,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,eAAe,CAA2B;IAClD,OAAO,CAAC,YAAY,CAAwB;IAC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