sprint-es 0.0.107 → 0.0.109
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 +29 -8
- package/dist/esm/cli.js +30 -9
- package/package.json +1 -1
package/dist/cjs/cli.cjs
CHANGED
|
@@ -400,30 +400,51 @@ 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
|
+
const distPath = path.join(projectRoot, "dist");
|
|
406
|
+
console.log("[Sprint] Cleaning dist...");
|
|
407
|
+
fs.rmSync(distPath, { recursive: true, force: true });
|
|
408
|
+
console.log("[Sprint] dist cleaned ✓");
|
|
403
409
|
if (isTS) {
|
|
404
410
|
const tsconfigPath = path.join(projectRoot, "tsconfig.json");
|
|
405
411
|
const tsconfig = JSON.parse(stripJsonComments(fs.readFileSync(tsconfigPath, "utf-8")));
|
|
406
412
|
const originalInclude = tsconfig.include ?? [];
|
|
407
413
|
const patched = originalInclude.filter((p) => !p.includes("sprint.config"));
|
|
408
|
-
|
|
414
|
+
const needsPatching = patched.length !== originalInclude.length;
|
|
415
|
+
console.log(`[Sprint] needs patching: ${needsPatching}`);
|
|
416
|
+
if (needsPatching) {
|
|
417
|
+
console.log("[Sprint] Patching tsconfig temporarily...");
|
|
409
418
|
fs.writeFileSync(tsconfigPath, JSON.stringify({ ...tsconfig, include: patched }, null, 4));
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4));
|
|
415
|
-
}
|
|
416
|
-
} else {
|
|
419
|
+
console.log("[Sprint] tsconfig patched ✓");
|
|
420
|
+
}
|
|
421
|
+
try {
|
|
422
|
+
console.log("[Sprint] Running tsc...");
|
|
417
423
|
await runCommand("tsc", { NODE_ENV: "production" });
|
|
424
|
+
console.log("[Sprint] tsc completed ✓");
|
|
425
|
+
console.log("[Sprint] Running tsc-alias...");
|
|
418
426
|
await runCommand("tsc-alias", { NODE_ENV: "production" });
|
|
427
|
+
console.log("[Sprint] tsc-alias completed ✓");
|
|
428
|
+
} 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
|
+
}
|
|
419
434
|
}
|
|
435
|
+
console.log("[Sprint] Compiling sprint.config.ts with esbuild...");
|
|
420
436
|
await runCommand(
|
|
421
437
|
"esbuild sprint.config.ts --outfile=dist/sprint.config.js --platform=node --format=esm --bundle=false",
|
|
422
438
|
{ NODE_ENV: "production" }
|
|
423
439
|
);
|
|
440
|
+
console.log("[Sprint] sprint.config.js generated ✓");
|
|
424
441
|
} else {
|
|
442
|
+
console.log("[Sprint] Running tsc...");
|
|
425
443
|
await runCommand("tsc", { NODE_ENV: "production" });
|
|
444
|
+
console.log("[Sprint] tsc completed ✓");
|
|
445
|
+
console.log("[Sprint] Running tsc-alias...");
|
|
426
446
|
await runCommand("tsc-alias", { NODE_ENV: "production" });
|
|
447
|
+
console.log("[Sprint] tsc-alias completed ✓");
|
|
427
448
|
}
|
|
428
449
|
break;
|
|
429
450
|
}
|
package/dist/esm/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { existsSync, readFileSync, writeFileSync, readdirSync, statSync } from "fs";
|
|
2
|
+
import { existsSync, rmSync, readFileSync, writeFileSync, readdirSync, statSync } from "fs";
|
|
3
3
|
import * as crypto from "crypto";
|
|
4
4
|
import { resolve, join } from "path";
|
|
5
5
|
import { spawn } from "child_process";
|
|
@@ -381,30 +381,51 @@ 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
|
+
const distPath = join(projectRoot, "dist");
|
|
387
|
+
console.log("[Sprint] Cleaning dist...");
|
|
388
|
+
rmSync(distPath, { recursive: true, force: true });
|
|
389
|
+
console.log("[Sprint] dist cleaned ✓");
|
|
384
390
|
if (isTS) {
|
|
385
391
|
const tsconfigPath = join(projectRoot, "tsconfig.json");
|
|
386
392
|
const tsconfig = JSON.parse(stripJsonComments(readFileSync(tsconfigPath, "utf-8")));
|
|
387
393
|
const originalInclude = tsconfig.include ?? [];
|
|
388
394
|
const patched = originalInclude.filter((p) => !p.includes("sprint.config"));
|
|
389
|
-
|
|
395
|
+
const needsPatching = patched.length !== originalInclude.length;
|
|
396
|
+
console.log(`[Sprint] needs patching: ${needsPatching}`);
|
|
397
|
+
if (needsPatching) {
|
|
398
|
+
console.log("[Sprint] Patching tsconfig temporarily...");
|
|
390
399
|
writeFileSync(tsconfigPath, JSON.stringify({ ...tsconfig, include: patched }, null, 4));
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4));
|
|
396
|
-
}
|
|
397
|
-
} else {
|
|
400
|
+
console.log("[Sprint] tsconfig patched ✓");
|
|
401
|
+
}
|
|
402
|
+
try {
|
|
403
|
+
console.log("[Sprint] Running tsc...");
|
|
398
404
|
await runCommand("tsc", { NODE_ENV: "production" });
|
|
405
|
+
console.log("[Sprint] tsc completed ✓");
|
|
406
|
+
console.log("[Sprint] Running tsc-alias...");
|
|
399
407
|
await runCommand("tsc-alias", { NODE_ENV: "production" });
|
|
408
|
+
console.log("[Sprint] tsc-alias completed ✓");
|
|
409
|
+
} 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
|
+
}
|
|
400
415
|
}
|
|
416
|
+
console.log("[Sprint] Compiling sprint.config.ts with esbuild...");
|
|
401
417
|
await runCommand(
|
|
402
418
|
"esbuild sprint.config.ts --outfile=dist/sprint.config.js --platform=node --format=esm --bundle=false",
|
|
403
419
|
{ NODE_ENV: "production" }
|
|
404
420
|
);
|
|
421
|
+
console.log("[Sprint] sprint.config.js generated ✓");
|
|
405
422
|
} else {
|
|
423
|
+
console.log("[Sprint] Running tsc...");
|
|
406
424
|
await runCommand("tsc", { NODE_ENV: "production" });
|
|
425
|
+
console.log("[Sprint] tsc completed ✓");
|
|
426
|
+
console.log("[Sprint] Running tsc-alias...");
|
|
407
427
|
await runCommand("tsc-alias", { NODE_ENV: "production" });
|
|
428
|
+
console.log("[Sprint] tsc-alias completed ✓");
|
|
408
429
|
}
|
|
409
430
|
break;
|
|
410
431
|
}
|