sprint-es 0.0.135 → 0.0.136
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 +28 -34
- package/dist/cjs/index.cjs +3 -3
- package/dist/esm/cli.js +28 -34
- package/dist/esm/index.js +3 -3
- package/dist/types/sprint.d.ts.map +1 -1
- package/package.json +1 -3
package/dist/cjs/cli.cjs
CHANGED
|
@@ -388,35 +388,37 @@ async function runDoctor() {
|
|
|
388
388
|
logger.break();
|
|
389
389
|
}
|
|
390
390
|
async function main() {
|
|
391
|
+
const hasDist = fs.existsSync(path.join(projectRoot, "dist"));
|
|
392
|
+
const hasTsConfig = fs.existsSync(path.join(projectRoot, "tsconfig.json"));
|
|
391
393
|
switch (command) {
|
|
392
394
|
case "dev": {
|
|
393
395
|
console.log("🚀 Starting development server with hot reload...");
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
396
|
+
let srcFile;
|
|
397
|
+
let devCmd;
|
|
398
|
+
if (hasTsConfig) {
|
|
399
|
+
srcFile = fs.existsSync(path.join(projectRoot, "src/app.ts")) ? "src/app.ts" : "src/index.ts";
|
|
400
|
+
devCmd = `tsx --watch ${srcFile}`;
|
|
401
|
+
} else {
|
|
402
|
+
srcFile = fs.existsSync(path.join(projectRoot, "src/app.js")) ? "src/app.js" : fs.existsSync(path.join(projectRoot, "src/app.mjs")) ? "src/app.mjs" : fs.existsSync(path.join(projectRoot, "src/index.js")) ? "src/index.js" : "src/index.mjs";
|
|
403
|
+
devCmd = `node --watch ${srcFile}`;
|
|
404
|
+
}
|
|
397
405
|
await runCommand(devCmd, { NODE_ENV: "development" });
|
|
398
406
|
break;
|
|
399
407
|
}
|
|
400
408
|
case "build": {
|
|
401
409
|
console.log("🚀 Building for production...");
|
|
402
|
-
const isTS = fs.existsSync(path.join(projectRoot, "sprint.config.ts"));
|
|
403
410
|
const distPath = path.join(projectRoot, "dist");
|
|
404
411
|
const tsconfigPath = path.join(projectRoot, "tsconfig.json");
|
|
412
|
+
const hasSprintConfigTs = fs.existsSync(path.join(projectRoot, "sprint.config.ts"));
|
|
405
413
|
console.log("[Sprint] Cleaning dist...");
|
|
406
414
|
fs.rmSync(distPath, { recursive: true, force: true });
|
|
407
415
|
console.log("[Sprint] dist cleaned ✓");
|
|
408
416
|
console.log("[Sprint] Compiling with tsup...");
|
|
409
|
-
await runCommand(
|
|
410
|
-
`tsc && tsup`,
|
|
411
|
-
{ NODE_ENV: "production" }
|
|
412
|
-
);
|
|
417
|
+
await runCommand(`tsc && tsup`, { NODE_ENV: "production" });
|
|
413
418
|
console.log("[Sprint] Compilation completed ✓");
|
|
414
|
-
if (
|
|
419
|
+
if (hasSprintConfigTs) {
|
|
415
420
|
console.log("[Sprint] Compiling sprint.config.ts...");
|
|
416
|
-
await runCommand(
|
|
417
|
-
`tsup sprint.config.ts --outDir "${distPath}" --format cjs --tsconfig "${tsconfigPath}" --clean false`,
|
|
418
|
-
{ NODE_ENV: "production" }
|
|
419
|
-
);
|
|
421
|
+
await runCommand(`tsup sprint.config.ts --outDir "${distPath}" --format cjs --tsconfig "${tsconfigPath}" --clean false`, { NODE_ENV: "production" });
|
|
420
422
|
console.log("[Sprint] sprint.config.js generated ✓");
|
|
421
423
|
}
|
|
422
424
|
console.log("✅ Build completed successfully!");
|
|
@@ -424,31 +426,23 @@ async function main() {
|
|
|
424
426
|
}
|
|
425
427
|
case "start": {
|
|
426
428
|
console.log("🚀 Starting production server...");
|
|
427
|
-
const isTS = fs.existsSync(path.join(projectRoot, "sprint.config.ts"));
|
|
428
429
|
let entryFile = null;
|
|
429
|
-
if (
|
|
430
|
-
const candidates = [
|
|
431
|
-
"dist/app.mjs",
|
|
432
|
-
"dist/app.js",
|
|
433
|
-
"dist/index.mjs",
|
|
434
|
-
"dist/index.js"
|
|
435
|
-
];
|
|
430
|
+
if (hasDist) {
|
|
431
|
+
const candidates = ["dist/app.mjs", "dist/app.js", "dist/index.mjs", "dist/index.js"];
|
|
436
432
|
entryFile = candidates.find((f) => fs.existsSync(path.join(projectRoot, f))) ?? null;
|
|
433
|
+
if (!entryFile) {
|
|
434
|
+
console.error("[Sprint] Entry file not found in dist/.");
|
|
435
|
+
console.error("[Sprint] Expected dist/app.mjs or dist/index.mjs");
|
|
436
|
+
process.exit(1);
|
|
437
|
+
}
|
|
437
438
|
} else {
|
|
438
|
-
const candidates = [
|
|
439
|
-
"src/app.js",
|
|
440
|
-
"src/app.mjs",
|
|
441
|
-
"src/index.js",
|
|
442
|
-
"src/index.mjs"
|
|
443
|
-
];
|
|
439
|
+
const candidates = ["src/app.js", "src/app.mjs", "src/index.js", "src/index.mjs"];
|
|
444
440
|
entryFile = candidates.find((f) => fs.existsSync(path.join(projectRoot, f))) ?? null;
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
);
|
|
451
|
-
process.exit(1);
|
|
441
|
+
if (!entryFile) {
|
|
442
|
+
console.error("[Sprint] Entry file not found in src/.");
|
|
443
|
+
console.error("[Sprint] Expected src/app.js or src/index.js");
|
|
444
|
+
process.exit(1);
|
|
445
|
+
}
|
|
452
446
|
}
|
|
453
447
|
await runCommand(`node "${path.join(projectRoot, entryFile)}"`, { NODE_ENV: "production" });
|
|
454
448
|
break;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -796,9 +796,9 @@ class Sprint {
|
|
|
796
796
|
console.log(` ${dim}Prefix:${reset} ${bold}${prefixInfo}${reset}`);
|
|
797
797
|
console.log(` ${dim}Healthcheck:${reset} http://localhost:${port}/healthcheck ${dim}(also available at /health)${reset}`);
|
|
798
798
|
console.log("");
|
|
799
|
-
console.log(` ${dim}Loaded routes:${reset} ${bold}${this.
|
|
800
|
-
console.log(` ${dim}Loaded middlewares:${reset} ${bold}${this.
|
|
801
|
-
console.log(` ${dim}
|
|
799
|
+
console.log(` ${dim}Loaded routes:${reset} ${bold}${this.counters.routes}${reset}`);
|
|
800
|
+
console.log(` ${dim}Loaded middlewares:${reset} ${bold}${this.counters.middlewares}${reset}`);
|
|
801
|
+
console.log(` ${dim}Loaded cronjobs:${reset} ${bold}${this.counters.cronjobs}${reset}`);
|
|
802
802
|
if (this.openapi.generateOnBuild || this.openapi.swaggerUi.enabled) console.log("");
|
|
803
803
|
if (this.openapi.generateOnBuild) console.log(` ${dim}OpenAPI Spec:${reset} http://localhost:${port}${this.openapi.path}`);
|
|
804
804
|
if (this.openapi.swaggerUi.enabled) console.log(` ${dim}Swagger UI:${reset} http://localhost:${port}${this.openapi.swaggerUi.path}`);
|
package/dist/esm/cli.js
CHANGED
|
@@ -369,35 +369,37 @@ async function runDoctor() {
|
|
|
369
369
|
logger.break();
|
|
370
370
|
}
|
|
371
371
|
async function main() {
|
|
372
|
+
const hasDist = existsSync(join(projectRoot, "dist"));
|
|
373
|
+
const hasTsConfig = existsSync(join(projectRoot, "tsconfig.json"));
|
|
372
374
|
switch (command) {
|
|
373
375
|
case "dev": {
|
|
374
376
|
console.log("🚀 Starting development server with hot reload...");
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
377
|
+
let srcFile;
|
|
378
|
+
let devCmd;
|
|
379
|
+
if (hasTsConfig) {
|
|
380
|
+
srcFile = existsSync(join(projectRoot, "src/app.ts")) ? "src/app.ts" : "src/index.ts";
|
|
381
|
+
devCmd = `tsx --watch ${srcFile}`;
|
|
382
|
+
} else {
|
|
383
|
+
srcFile = existsSync(join(projectRoot, "src/app.js")) ? "src/app.js" : existsSync(join(projectRoot, "src/app.mjs")) ? "src/app.mjs" : existsSync(join(projectRoot, "src/index.js")) ? "src/index.js" : "src/index.mjs";
|
|
384
|
+
devCmd = `node --watch ${srcFile}`;
|
|
385
|
+
}
|
|
378
386
|
await runCommand(devCmd, { NODE_ENV: "development" });
|
|
379
387
|
break;
|
|
380
388
|
}
|
|
381
389
|
case "build": {
|
|
382
390
|
console.log("🚀 Building for production...");
|
|
383
|
-
const isTS = existsSync(join(projectRoot, "sprint.config.ts"));
|
|
384
391
|
const distPath = join(projectRoot, "dist");
|
|
385
392
|
const tsconfigPath = join(projectRoot, "tsconfig.json");
|
|
393
|
+
const hasSprintConfigTs = existsSync(join(projectRoot, "sprint.config.ts"));
|
|
386
394
|
console.log("[Sprint] Cleaning dist...");
|
|
387
395
|
rmSync(distPath, { recursive: true, force: true });
|
|
388
396
|
console.log("[Sprint] dist cleaned ✓");
|
|
389
397
|
console.log("[Sprint] Compiling with tsup...");
|
|
390
|
-
await runCommand(
|
|
391
|
-
`tsc && tsup`,
|
|
392
|
-
{ NODE_ENV: "production" }
|
|
393
|
-
);
|
|
398
|
+
await runCommand(`tsc && tsup`, { NODE_ENV: "production" });
|
|
394
399
|
console.log("[Sprint] Compilation completed ✓");
|
|
395
|
-
if (
|
|
400
|
+
if (hasSprintConfigTs) {
|
|
396
401
|
console.log("[Sprint] Compiling sprint.config.ts...");
|
|
397
|
-
await runCommand(
|
|
398
|
-
`tsup sprint.config.ts --outDir "${distPath}" --format cjs --tsconfig "${tsconfigPath}" --clean false`,
|
|
399
|
-
{ NODE_ENV: "production" }
|
|
400
|
-
);
|
|
402
|
+
await runCommand(`tsup sprint.config.ts --outDir "${distPath}" --format cjs --tsconfig "${tsconfigPath}" --clean false`, { NODE_ENV: "production" });
|
|
401
403
|
console.log("[Sprint] sprint.config.js generated ✓");
|
|
402
404
|
}
|
|
403
405
|
console.log("✅ Build completed successfully!");
|
|
@@ -405,31 +407,23 @@ async function main() {
|
|
|
405
407
|
}
|
|
406
408
|
case "start": {
|
|
407
409
|
console.log("🚀 Starting production server...");
|
|
408
|
-
const isTS = existsSync(join(projectRoot, "sprint.config.ts"));
|
|
409
410
|
let entryFile = null;
|
|
410
|
-
if (
|
|
411
|
-
const candidates = [
|
|
412
|
-
"dist/app.mjs",
|
|
413
|
-
"dist/app.js",
|
|
414
|
-
"dist/index.mjs",
|
|
415
|
-
"dist/index.js"
|
|
416
|
-
];
|
|
411
|
+
if (hasDist) {
|
|
412
|
+
const candidates = ["dist/app.mjs", "dist/app.js", "dist/index.mjs", "dist/index.js"];
|
|
417
413
|
entryFile = candidates.find((f) => existsSync(join(projectRoot, f))) ?? null;
|
|
414
|
+
if (!entryFile) {
|
|
415
|
+
console.error("[Sprint] Entry file not found in dist/.");
|
|
416
|
+
console.error("[Sprint] Expected dist/app.mjs or dist/index.mjs");
|
|
417
|
+
process.exit(1);
|
|
418
|
+
}
|
|
418
419
|
} else {
|
|
419
|
-
const candidates = [
|
|
420
|
-
"src/app.js",
|
|
421
|
-
"src/app.mjs",
|
|
422
|
-
"src/index.js",
|
|
423
|
-
"src/index.mjs"
|
|
424
|
-
];
|
|
420
|
+
const candidates = ["src/app.js", "src/app.mjs", "src/index.js", "src/index.mjs"];
|
|
425
421
|
entryFile = candidates.find((f) => existsSync(join(projectRoot, f))) ?? null;
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
);
|
|
432
|
-
process.exit(1);
|
|
422
|
+
if (!entryFile) {
|
|
423
|
+
console.error("[Sprint] Entry file not found in src/.");
|
|
424
|
+
console.error("[Sprint] Expected src/app.js or src/index.js");
|
|
425
|
+
process.exit(1);
|
|
426
|
+
}
|
|
433
427
|
}
|
|
434
428
|
await runCommand(`node "${join(projectRoot, entryFile)}"`, { NODE_ENV: "production" });
|
|
435
429
|
break;
|
package/dist/esm/index.js
CHANGED
|
@@ -771,9 +771,9 @@ class Sprint {
|
|
|
771
771
|
console.log(` ${dim}Prefix:${reset} ${bold}${prefixInfo}${reset}`);
|
|
772
772
|
console.log(` ${dim}Healthcheck:${reset} http://localhost:${port}/healthcheck ${dim}(also available at /health)${reset}`);
|
|
773
773
|
console.log("");
|
|
774
|
-
console.log(` ${dim}Loaded routes:${reset} ${bold}${this.
|
|
775
|
-
console.log(` ${dim}Loaded middlewares:${reset} ${bold}${this.
|
|
776
|
-
console.log(` ${dim}
|
|
774
|
+
console.log(` ${dim}Loaded routes:${reset} ${bold}${this.counters.routes}${reset}`);
|
|
775
|
+
console.log(` ${dim}Loaded middlewares:${reset} ${bold}${this.counters.middlewares}${reset}`);
|
|
776
|
+
console.log(` ${dim}Loaded cronjobs:${reset} ${bold}${this.counters.cronjobs}${reset}`);
|
|
777
777
|
if (this.openapi.generateOnBuild || this.openapi.swaggerUi.enabled) console.log("");
|
|
778
778
|
if (this.openapi.generateOnBuild) console.log(` ${dim}OpenAPI Spec:${reset} http://localhost:${port}${this.openapi.path}`);
|
|
779
779
|
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,QAAQ,CAA8C;IAC9D,OAAO,CAAC,OAAO,CAcT;IACN,OAAO,CAAC,OAAO,CAcT;IACN,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,gBAAgB,CAIhB;;YAuJM,IAAI;IAiDlB,OA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AAI,GAAG,IAAI;CA+D7C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sprint-es",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.136",
|
|
4
4
|
"description": "Sprint - Quickly API",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -107,14 +107,12 @@
|
|
|
107
107
|
"axios": "^1.13.2",
|
|
108
108
|
"cors": "^2.8.5",
|
|
109
109
|
"dotenv": "^17.3.1",
|
|
110
|
-
"esbuild": "^0.27.3",
|
|
111
110
|
"express": "^5.1.0",
|
|
112
111
|
"morgan": "^1.10.1",
|
|
113
112
|
"node-cron": "^3.0.3",
|
|
114
113
|
"path": "^0.12.7",
|
|
115
114
|
"serve-favicon": "^2.5.1",
|
|
116
115
|
"toolkitify": "^0.0.26",
|
|
117
|
-
"tsc-esm-fix": "^3.1.2",
|
|
118
116
|
"tsx": "^4.19.0",
|
|
119
117
|
"zod": "^3.25.0"
|
|
120
118
|
},
|