sprint-es 0.0.110 → 0.0.112

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 CHANGED
@@ -400,24 +400,17 @@ async function main() {
400
400
  case "build": {
401
401
  console.log("🚀 Building for production...");
402
402
  const isTS = fs.existsSync(path.join(projectRoot, "sprint.config.ts"));
403
- console.log(`[Sprint] Project type: ${isTS ? "TypeScript" : "JavaScript"}`);
404
- console.log(`[Sprint] Project root: ${projectRoot}`);
405
403
  const distPath = path.join(projectRoot, "dist");
404
+ const tsconfigPath = path.join(projectRoot, "tsconfig.json");
406
405
  console.log("[Sprint] Cleaning dist...");
407
406
  fs.rmSync(distPath, { recursive: true, force: true });
408
407
  console.log("[Sprint] dist cleaned ✓");
409
408
  if (isTS) {
410
- const tsconfigPath = path.join(projectRoot, "tsconfig.json");
411
409
  const tsconfig = JSON.parse(stripJsonComments(fs.readFileSync(tsconfigPath, "utf-8")));
412
410
  const originalInclude = tsconfig.include ?? [];
413
411
  const patched = originalInclude.filter((p) => !p.includes("sprint.config"));
414
412
  const needsPatching = patched.length !== originalInclude.length;
415
- console.log(`[Sprint] needs patching: ${needsPatching}`);
416
- if (needsPatching) {
417
- console.log("[Sprint] Patching tsconfig temporarily...");
418
- fs.writeFileSync(tsconfigPath, JSON.stringify({ ...tsconfig, include: patched }, null, 4));
419
- console.log("[Sprint] tsconfig patched ✓");
420
- }
413
+ if (needsPatching) fs.writeFileSync(tsconfigPath, JSON.stringify({ ...tsconfig, include: patched }, null, 4));
421
414
  try {
422
415
  console.log("[Sprint] Running tsc...");
423
416
  await runCommand(`tsc --project "${tsconfigPath}"`, { NODE_ENV: "production" });
@@ -426,20 +419,15 @@ async function main() {
426
419
  await runCommand(`tsc-alias --project "${tsconfigPath}"`, { NODE_ENV: "production" });
427
420
  console.log("[Sprint] tsc-alias completed ✓");
428
421
  } finally {
429
- if (needsPatching) {
430
- console.log("[Sprint] Restoring tsconfig...");
431
- fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4));
432
- console.log("[Sprint] tsconfig restored ✓");
433
- }
422
+ if (needsPatching) fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4));
434
423
  }
435
- console.log("[Sprint] Compiling sprint.config.ts with esbuild...");
424
+ console.log("[Sprint] Compiling sprint.config.ts...");
436
425
  await runCommand(
437
- `esbuild "${path.join(projectRoot, "sprint.config.ts")}" --outfile="${path.join(projectRoot, "dist/sprint.config.js")}" --platform=node --format=esm --bundle=false`,
426
+ `esbuild "${path.join(projectRoot, "sprint.config.ts")}" --outfile="${path.join(projectRoot, "dist/sprint.config.js")}" --platform=node --format=cjs --bundle=false`,
438
427
  { NODE_ENV: "production" }
439
428
  );
440
429
  console.log("[Sprint] sprint.config.js generated ✓");
441
430
  } else {
442
- const tsconfigPath = path.join(projectRoot, "tsconfig.json");
443
431
  console.log("[Sprint] Running tsc...");
444
432
  await runCommand(`tsc --project "${tsconfigPath}"`, { NODE_ENV: "production" });
445
433
  console.log("[Sprint] tsc completed ✓");
@@ -447,13 +435,19 @@ async function main() {
447
435
  await runCommand(`tsc-alias --project "${tsconfigPath}"`, { NODE_ENV: "production" });
448
436
  console.log("[Sprint] tsc-alias completed ✓");
449
437
  }
438
+ console.log("✅ Build completed successfully!");
450
439
  break;
451
440
  }
452
441
  case "start": {
453
442
  console.log("🚀 Starting production server...");
454
443
  const isTS = fs.existsSync(path.join(projectRoot, "sprint.config.ts"));
455
444
  const entryFile = isTS ? fs.existsSync(path.join(projectRoot, "dist/app.js")) ? "dist/app.js" : "dist/index.js" : fs.existsSync(path.join(projectRoot, "src/app.js")) ? "src/app.js" : "src/index.js";
456
- await runCommand(`node ${entryFile}`, { NODE_ENV: "production" });
445
+ if (!fs.existsSync(path.join(projectRoot, entryFile))) {
446
+ console.error(`[Sprint] Entry file not found: ${entryFile}`);
447
+ console.error("[Sprint] Did you run 'npm run build' first?");
448
+ process.exit(1);
449
+ }
450
+ await runCommand(`node "${path.join(projectRoot, entryFile)}"`, { NODE_ENV: "production" });
457
451
  break;
458
452
  }
459
453
  case "doctor":
package/dist/esm/cli.js CHANGED
@@ -381,24 +381,17 @@ async function main() {
381
381
  case "build": {
382
382
  console.log("🚀 Building for production...");
383
383
  const isTS = existsSync(join(projectRoot, "sprint.config.ts"));
384
- console.log(`[Sprint] Project type: ${isTS ? "TypeScript" : "JavaScript"}`);
385
- console.log(`[Sprint] Project root: ${projectRoot}`);
386
384
  const distPath = join(projectRoot, "dist");
385
+ const tsconfigPath = join(projectRoot, "tsconfig.json");
387
386
  console.log("[Sprint] Cleaning dist...");
388
387
  rmSync(distPath, { recursive: true, force: true });
389
388
  console.log("[Sprint] dist cleaned ✓");
390
389
  if (isTS) {
391
- const tsconfigPath = join(projectRoot, "tsconfig.json");
392
390
  const tsconfig = JSON.parse(stripJsonComments(readFileSync(tsconfigPath, "utf-8")));
393
391
  const originalInclude = tsconfig.include ?? [];
394
392
  const patched = originalInclude.filter((p) => !p.includes("sprint.config"));
395
393
  const needsPatching = patched.length !== originalInclude.length;
396
- console.log(`[Sprint] needs patching: ${needsPatching}`);
397
- if (needsPatching) {
398
- console.log("[Sprint] Patching tsconfig temporarily...");
399
- writeFileSync(tsconfigPath, JSON.stringify({ ...tsconfig, include: patched }, null, 4));
400
- console.log("[Sprint] tsconfig patched ✓");
401
- }
394
+ if (needsPatching) writeFileSync(tsconfigPath, JSON.stringify({ ...tsconfig, include: patched }, null, 4));
402
395
  try {
403
396
  console.log("[Sprint] Running tsc...");
404
397
  await runCommand(`tsc --project "${tsconfigPath}"`, { NODE_ENV: "production" });
@@ -407,20 +400,15 @@ async function main() {
407
400
  await runCommand(`tsc-alias --project "${tsconfigPath}"`, { NODE_ENV: "production" });
408
401
  console.log("[Sprint] tsc-alias completed ✓");
409
402
  } finally {
410
- if (needsPatching) {
411
- console.log("[Sprint] Restoring tsconfig...");
412
- writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4));
413
- console.log("[Sprint] tsconfig restored ✓");
414
- }
403
+ if (needsPatching) writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4));
415
404
  }
416
- console.log("[Sprint] Compiling sprint.config.ts with esbuild...");
405
+ console.log("[Sprint] Compiling sprint.config.ts...");
417
406
  await runCommand(
418
- `esbuild "${join(projectRoot, "sprint.config.ts")}" --outfile="${join(projectRoot, "dist/sprint.config.js")}" --platform=node --format=esm --bundle=false`,
407
+ `esbuild "${join(projectRoot, "sprint.config.ts")}" --outfile="${join(projectRoot, "dist/sprint.config.js")}" --platform=node --format=cjs --bundle=false`,
419
408
  { NODE_ENV: "production" }
420
409
  );
421
410
  console.log("[Sprint] sprint.config.js generated ✓");
422
411
  } else {
423
- const tsconfigPath = join(projectRoot, "tsconfig.json");
424
412
  console.log("[Sprint] Running tsc...");
425
413
  await runCommand(`tsc --project "${tsconfigPath}"`, { NODE_ENV: "production" });
426
414
  console.log("[Sprint] tsc completed ✓");
@@ -428,13 +416,19 @@ async function main() {
428
416
  await runCommand(`tsc-alias --project "${tsconfigPath}"`, { NODE_ENV: "production" });
429
417
  console.log("[Sprint] tsc-alias completed ✓");
430
418
  }
419
+ console.log("✅ Build completed successfully!");
431
420
  break;
432
421
  }
433
422
  case "start": {
434
423
  console.log("🚀 Starting production server...");
435
424
  const isTS = existsSync(join(projectRoot, "sprint.config.ts"));
436
425
  const entryFile = isTS ? existsSync(join(projectRoot, "dist/app.js")) ? "dist/app.js" : "dist/index.js" : existsSync(join(projectRoot, "src/app.js")) ? "src/app.js" : "src/index.js";
437
- await runCommand(`node ${entryFile}`, { NODE_ENV: "production" });
426
+ if (!existsSync(join(projectRoot, entryFile))) {
427
+ console.error(`[Sprint] Entry file not found: ${entryFile}`);
428
+ console.error("[Sprint] Did you run 'npm run build' first?");
429
+ process.exit(1);
430
+ }
431
+ await runCommand(`node "${join(projectRoot, entryFile)}"`, { NODE_ENV: "production" });
438
432
  break;
439
433
  }
440
434
  case "doctor":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprint-es",
3
- "version": "0.0.110",
3
+ "version": "0.0.112",
4
4
  "description": "Sprint - Quickly API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",