sprint-es 0.0.131 → 0.0.133
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/cli.cjs +1 -12
- package/dist/cjs/index.cjs +9 -4
- package/dist/esm/cli.js +1 -12
- package/dist/esm/index.js +9 -4
- package/dist/types/sprint.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/cli.cjs
CHANGED
|
@@ -406,19 +406,8 @@ async function main() {
|
|
|
406
406
|
fs.rmSync(distPath, { recursive: true, force: true });
|
|
407
407
|
console.log("[Sprint] dist cleaned ✓");
|
|
408
408
|
console.log("[Sprint] Compiling with tsup...");
|
|
409
|
-
const tsupCmd = `
|
|
410
|
-
tsup src/**/*.ts
|
|
411
|
-
--outDir dist
|
|
412
|
-
--format esm,cjs
|
|
413
|
-
--target es2020
|
|
414
|
-
--sourcemap
|
|
415
|
-
--clean
|
|
416
|
-
--dts
|
|
417
|
-
--splitting false
|
|
418
|
-
--skip-node-modules-bundle
|
|
419
|
-
`;
|
|
420
409
|
await runCommand(
|
|
421
|
-
`tsc &&
|
|
410
|
+
`tsc && tsup`,
|
|
422
411
|
{ NODE_ENV: "production" }
|
|
423
412
|
);
|
|
424
413
|
console.log("[Sprint] Compilation completed ✓");
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -271,6 +271,7 @@ class Sprint {
|
|
|
271
271
|
}
|
|
272
272
|
async init() {
|
|
273
273
|
const callerDir = process.cwd();
|
|
274
|
+
console.log("CWD:", process.cwd());
|
|
274
275
|
const normalizePath = (p) => {
|
|
275
276
|
if (path.isAbsolute(p)) return p;
|
|
276
277
|
return isProd ? p.replace(/\bsrc\b/, "dist") : p.replace(/\bdist\b/, "src");
|
|
@@ -408,14 +409,14 @@ class Sprint {
|
|
|
408
409
|
});
|
|
409
410
|
}
|
|
410
411
|
async loadRoutes(routesPath) {
|
|
411
|
-
const
|
|
412
|
+
const fileExtensions = isProd ? [".js", ".mjs"] : [".ts"];
|
|
412
413
|
const walkDir = async (dir) => {
|
|
413
414
|
const files = await fs.promises.readdir(dir);
|
|
414
415
|
for (const file of files) {
|
|
415
416
|
const filePath = path.join(dir, file);
|
|
416
417
|
const stat = await fs.promises.stat(filePath);
|
|
417
418
|
if (stat.isDirectory()) await walkDir(filePath);
|
|
418
|
-
else if (stat.isFile() && file.endsWith(
|
|
419
|
+
else if (stat.isFile() && fileExtensions.some((ext) => file.endsWith(ext))) {
|
|
419
420
|
try {
|
|
420
421
|
const moduleUrl = url.pathToFileURL(filePath).href;
|
|
421
422
|
const module2 = await import(moduleUrl);
|
|
@@ -467,12 +468,12 @@ class Sprint {
|
|
|
467
468
|
await walkDir(routesPath);
|
|
468
469
|
}
|
|
469
470
|
async loadCronJobs(cronjobsPath) {
|
|
470
|
-
const
|
|
471
|
+
const fileExtensions = isProd ? [".js", ".mjs"] : [".ts"];
|
|
471
472
|
const files = await fs.promises.readdir(cronjobsPath);
|
|
472
473
|
for (const file of files) {
|
|
473
474
|
const filePath = path.join(cronjobsPath, file);
|
|
474
475
|
const stat = await fs.promises.stat(filePath);
|
|
475
|
-
if (stat.isFile() && file.endsWith(
|
|
476
|
+
if (stat.isFile() && fileExtensions.some((ext) => file.endsWith(ext))) {
|
|
476
477
|
try {
|
|
477
478
|
const moduleUrl = url.pathToFileURL(filePath).href;
|
|
478
479
|
await import(moduleUrl);
|
|
@@ -783,6 +784,10 @@ class Sprint {
|
|
|
783
784
|
console.log(` ${dim}Local:${reset} http://localhost:${bold}${port}${reset}`);
|
|
784
785
|
console.log(` ${dim}Prefix:${reset} ${bold}${prefixInfo}${reset}`);
|
|
785
786
|
console.log(` ${dim}Healthcheck:${reset} http://localhost:${port}/healthcheck ${dim}(also available at /health)${reset}`);
|
|
787
|
+
console.log("");
|
|
788
|
+
console.log(` ${dim}Loaded routes:${reset} ${bold}${this.registeredRoutes.length}${reset}`);
|
|
789
|
+
console.log(` ${dim}Loaded middlewares:${reset} ${bold}${this.loadedMiddlewares.length}${reset}`);
|
|
790
|
+
console.log(` ${dim}Healthcheck:${reset} http://localhost:${port}/healthcheck ${dim}(also available at /health)${reset}`);
|
|
786
791
|
if (this.openapi.generateOnBuild || this.openapi.swaggerUi.enabled) console.log("");
|
|
787
792
|
if (this.openapi.generateOnBuild) console.log(` ${dim}OpenAPI Spec:${reset} http://localhost:${port}${this.openapi.path}`);
|
|
788
793
|
if (this.openapi.swaggerUi.enabled) console.log(` ${dim}Swagger UI:${reset} http://localhost:${port}${this.openapi.swaggerUi.path}`);
|
package/dist/esm/cli.js
CHANGED
|
@@ -387,19 +387,8 @@ async function main() {
|
|
|
387
387
|
rmSync(distPath, { recursive: true, force: true });
|
|
388
388
|
console.log("[Sprint] dist cleaned ✓");
|
|
389
389
|
console.log("[Sprint] Compiling with tsup...");
|
|
390
|
-
const tsupCmd = `
|
|
391
|
-
tsup src/**/*.ts
|
|
392
|
-
--outDir dist
|
|
393
|
-
--format esm,cjs
|
|
394
|
-
--target es2020
|
|
395
|
-
--sourcemap
|
|
396
|
-
--clean
|
|
397
|
-
--dts
|
|
398
|
-
--splitting false
|
|
399
|
-
--skip-node-modules-bundle
|
|
400
|
-
`;
|
|
401
390
|
await runCommand(
|
|
402
|
-
`tsc &&
|
|
391
|
+
`tsc && tsup`,
|
|
403
392
|
{ NODE_ENV: "production" }
|
|
404
393
|
);
|
|
405
394
|
console.log("[Sprint] Compilation completed ✓");
|
package/dist/esm/index.js
CHANGED
|
@@ -246,6 +246,7 @@ class Sprint {
|
|
|
246
246
|
}
|
|
247
247
|
async init() {
|
|
248
248
|
const callerDir = process.cwd();
|
|
249
|
+
console.log("CWD:", process.cwd());
|
|
249
250
|
const normalizePath = (p) => {
|
|
250
251
|
if (path.isAbsolute(p)) return p;
|
|
251
252
|
return isProd ? p.replace(/\bsrc\b/, "dist") : p.replace(/\bdist\b/, "src");
|
|
@@ -383,14 +384,14 @@ class Sprint {
|
|
|
383
384
|
});
|
|
384
385
|
}
|
|
385
386
|
async loadRoutes(routesPath) {
|
|
386
|
-
const
|
|
387
|
+
const fileExtensions = isProd ? [".js", ".mjs"] : [".ts"];
|
|
387
388
|
const walkDir = async (dir) => {
|
|
388
389
|
const files = await fs.promises.readdir(dir);
|
|
389
390
|
for (const file of files) {
|
|
390
391
|
const filePath = path.join(dir, file);
|
|
391
392
|
const stat = await fs.promises.stat(filePath);
|
|
392
393
|
if (stat.isDirectory()) await walkDir(filePath);
|
|
393
|
-
else if (stat.isFile() && file.endsWith(
|
|
394
|
+
else if (stat.isFile() && fileExtensions.some((ext) => file.endsWith(ext))) {
|
|
394
395
|
try {
|
|
395
396
|
const moduleUrl = pathToFileURL(filePath).href;
|
|
396
397
|
const module = await import(moduleUrl);
|
|
@@ -442,12 +443,12 @@ class Sprint {
|
|
|
442
443
|
await walkDir(routesPath);
|
|
443
444
|
}
|
|
444
445
|
async loadCronJobs(cronjobsPath) {
|
|
445
|
-
const
|
|
446
|
+
const fileExtensions = isProd ? [".js", ".mjs"] : [".ts"];
|
|
446
447
|
const files = await fs.promises.readdir(cronjobsPath);
|
|
447
448
|
for (const file of files) {
|
|
448
449
|
const filePath = path.join(cronjobsPath, file);
|
|
449
450
|
const stat = await fs.promises.stat(filePath);
|
|
450
|
-
if (stat.isFile() && file.endsWith(
|
|
451
|
+
if (stat.isFile() && fileExtensions.some((ext) => file.endsWith(ext))) {
|
|
451
452
|
try {
|
|
452
453
|
const moduleUrl = pathToFileURL(filePath).href;
|
|
453
454
|
await import(moduleUrl);
|
|
@@ -758,6 +759,10 @@ class Sprint {
|
|
|
758
759
|
console.log(` ${dim}Local:${reset} http://localhost:${bold}${port}${reset}`);
|
|
759
760
|
console.log(` ${dim}Prefix:${reset} ${bold}${prefixInfo}${reset}`);
|
|
760
761
|
console.log(` ${dim}Healthcheck:${reset} http://localhost:${port}/healthcheck ${dim}(also available at /health)${reset}`);
|
|
762
|
+
console.log("");
|
|
763
|
+
console.log(` ${dim}Loaded routes:${reset} ${bold}${this.registeredRoutes.length}${reset}`);
|
|
764
|
+
console.log(` ${dim}Loaded middlewares:${reset} ${bold}${this.loadedMiddlewares.length}${reset}`);
|
|
765
|
+
console.log(` ${dim}Healthcheck:${reset} http://localhost:${port}/healthcheck ${dim}(also available at /health)${reset}`);
|
|
761
766
|
if (this.openapi.generateOnBuild || this.openapi.swaggerUi.enabled) console.log("");
|
|
762
767
|
if (this.openapi.generateOnBuild) console.log(` ${dim}OpenAPI Spec:${reset} http://localhost:${port}${this.openapi.path}`);
|
|
763
768
|
if (this.openapi.swaggerUi.enabled) console.log(` ${dim}Swagger UI:${reset} http://localhost:${port}${this.openapi.swaggerUi.path}`);
|
|
@@ -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;AA8CnC,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;IAC5C,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,iBAAiB,CAA0B;IACnD,OAAO,CAAC,OAAO,CAcb;IACF,OAAO,CAAC,OAAO,CAcb;IACF,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,gBAAgB,CAIhB;;YAsJM,IAAI;
|
|
1
|
+
{"version":3,"file":"sprint.d.ts","sourceR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