sprint-es 0.0.108 → 0.0.110
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 +21 -25
- package/dist/esm/cli.js +22 -26
- package/package.json +1 -1
package/dist/cjs/cli.cjs
CHANGED
|
@@ -402,53 +402,49 @@ async function main() {
|
|
|
402
402
|
const isTS = fs.existsSync(path.join(projectRoot, "sprint.config.ts"));
|
|
403
403
|
console.log(`[Sprint] Project type: ${isTS ? "TypeScript" : "JavaScript"}`);
|
|
404
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 ✓");
|
|
405
409
|
if (isTS) {
|
|
406
410
|
const tsconfigPath = path.join(projectRoot, "tsconfig.json");
|
|
407
|
-
console.log(`[Sprint] tsconfig path: ${tsconfigPath}`);
|
|
408
|
-
console.log(`[Sprint] tsconfig exists: ${fs.existsSync(tsconfigPath)}`);
|
|
409
411
|
const tsconfig = JSON.parse(stripJsonComments(fs.readFileSync(tsconfigPath, "utf-8")));
|
|
410
|
-
console.log(`[Sprint] tsconfig include: ${JSON.stringify(tsconfig.include)}`);
|
|
411
412
|
const originalInclude = tsconfig.include ?? [];
|
|
412
413
|
const patched = originalInclude.filter((p) => !p.includes("sprint.config"));
|
|
413
|
-
|
|
414
|
-
console.log(`[Sprint] needs patching: ${
|
|
415
|
-
if (
|
|
414
|
+
const needsPatching = patched.length !== originalInclude.length;
|
|
415
|
+
console.log(`[Sprint] needs patching: ${needsPatching}`);
|
|
416
|
+
if (needsPatching) {
|
|
416
417
|
console.log("[Sprint] Patching tsconfig temporarily...");
|
|
417
418
|
fs.writeFileSync(tsconfigPath, JSON.stringify({ ...tsconfig, include: patched }, null, 4));
|
|
418
419
|
console.log("[Sprint] tsconfig patched ✓");
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
await runCommand("tsc", { NODE_ENV: "production" });
|
|
422
|
-
console.log("[Sprint] tsc completed ✓");
|
|
423
|
-
console.log("[Sprint] Running tsc-alias...");
|
|
424
|
-
await runCommand("tsc-alias", { NODE_ENV: "production" });
|
|
425
|
-
console.log("[Sprint] tsc-alias completed ✓");
|
|
426
|
-
} finally {
|
|
427
|
-
console.log("[Sprint] Restoring tsconfig...");
|
|
428
|
-
fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4));
|
|
429
|
-
console.log("[Sprint] tsconfig restored ✓");
|
|
430
|
-
}
|
|
431
|
-
} else {
|
|
432
|
-
console.log("[Sprint] No patching needed");
|
|
420
|
+
}
|
|
421
|
+
try {
|
|
433
422
|
console.log("[Sprint] Running tsc...");
|
|
434
|
-
await runCommand(
|
|
423
|
+
await runCommand(`tsc --project "${tsconfigPath}"`, { NODE_ENV: "production" });
|
|
435
424
|
console.log("[Sprint] tsc completed ✓");
|
|
436
425
|
console.log("[Sprint] Running tsc-alias...");
|
|
437
|
-
await runCommand(
|
|
426
|
+
await runCommand(`tsc-alias --project "${tsconfigPath}"`, { NODE_ENV: "production" });
|
|
438
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
|
+
}
|
|
439
434
|
}
|
|
440
435
|
console.log("[Sprint] Compiling sprint.config.ts with esbuild...");
|
|
441
436
|
await runCommand(
|
|
442
|
-
|
|
437
|
+
`esbuild "${path.join(projectRoot, "sprint.config.ts")}" --outfile="${path.join(projectRoot, "dist/sprint.config.js")}" --platform=node --format=esm --bundle=false`,
|
|
443
438
|
{ NODE_ENV: "production" }
|
|
444
439
|
);
|
|
445
440
|
console.log("[Sprint] sprint.config.js generated ✓");
|
|
446
441
|
} else {
|
|
442
|
+
const tsconfigPath = path.join(projectRoot, "tsconfig.json");
|
|
447
443
|
console.log("[Sprint] Running tsc...");
|
|
448
|
-
await runCommand(
|
|
444
|
+
await runCommand(`tsc --project "${tsconfigPath}"`, { NODE_ENV: "production" });
|
|
449
445
|
console.log("[Sprint] tsc completed ✓");
|
|
450
446
|
console.log("[Sprint] Running tsc-alias...");
|
|
451
|
-
await runCommand(
|
|
447
|
+
await runCommand(`tsc-alias --project "${tsconfigPath}"`, { NODE_ENV: "production" });
|
|
452
448
|
console.log("[Sprint] tsc-alias completed ✓");
|
|
453
449
|
}
|
|
454
450
|
break;
|
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";
|
|
@@ -383,53 +383,49 @@ async function main() {
|
|
|
383
383
|
const isTS = existsSync(join(projectRoot, "sprint.config.ts"));
|
|
384
384
|
console.log(`[Sprint] Project type: ${isTS ? "TypeScript" : "JavaScript"}`);
|
|
385
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 ✓");
|
|
386
390
|
if (isTS) {
|
|
387
391
|
const tsconfigPath = join(projectRoot, "tsconfig.json");
|
|
388
|
-
console.log(`[Sprint] tsconfig path: ${tsconfigPath}`);
|
|
389
|
-
console.log(`[Sprint] tsconfig exists: ${existsSync(tsconfigPath)}`);
|
|
390
392
|
const tsconfig = JSON.parse(stripJsonComments(readFileSync(tsconfigPath, "utf-8")));
|
|
391
|
-
console.log(`[Sprint] tsconfig include: ${JSON.stringify(tsconfig.include)}`);
|
|
392
393
|
const originalInclude = tsconfig.include ?? [];
|
|
393
394
|
const patched = originalInclude.filter((p) => !p.includes("sprint.config"));
|
|
394
|
-
|
|
395
|
-
console.log(`[Sprint] needs patching: ${
|
|
396
|
-
if (
|
|
395
|
+
const needsPatching = patched.length !== originalInclude.length;
|
|
396
|
+
console.log(`[Sprint] needs patching: ${needsPatching}`);
|
|
397
|
+
if (needsPatching) {
|
|
397
398
|
console.log("[Sprint] Patching tsconfig temporarily...");
|
|
398
399
|
writeFileSync(tsconfigPath, JSON.stringify({ ...tsconfig, include: patched }, null, 4));
|
|
399
400
|
console.log("[Sprint] tsconfig patched ✓");
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
await runCommand("tsc", { NODE_ENV: "production" });
|
|
403
|
-
console.log("[Sprint] tsc completed ✓");
|
|
404
|
-
console.log("[Sprint] Running tsc-alias...");
|
|
405
|
-
await runCommand("tsc-alias", { NODE_ENV: "production" });
|
|
406
|
-
console.log("[Sprint] tsc-alias completed ✓");
|
|
407
|
-
} finally {
|
|
408
|
-
console.log("[Sprint] Restoring tsconfig...");
|
|
409
|
-
writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4));
|
|
410
|
-
console.log("[Sprint] tsconfig restored ✓");
|
|
411
|
-
}
|
|
412
|
-
} else {
|
|
413
|
-
console.log("[Sprint] No patching needed");
|
|
401
|
+
}
|
|
402
|
+
try {
|
|
414
403
|
console.log("[Sprint] Running tsc...");
|
|
415
|
-
await runCommand(
|
|
404
|
+
await runCommand(`tsc --project "${tsconfigPath}"`, { NODE_ENV: "production" });
|
|
416
405
|
console.log("[Sprint] tsc completed ✓");
|
|
417
406
|
console.log("[Sprint] Running tsc-alias...");
|
|
418
|
-
await runCommand(
|
|
407
|
+
await runCommand(`tsc-alias --project "${tsconfigPath}"`, { NODE_ENV: "production" });
|
|
419
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
|
+
}
|
|
420
415
|
}
|
|
421
416
|
console.log("[Sprint] Compiling sprint.config.ts with esbuild...");
|
|
422
417
|
await runCommand(
|
|
423
|
-
|
|
418
|
+
`esbuild "${join(projectRoot, "sprint.config.ts")}" --outfile="${join(projectRoot, "dist/sprint.config.js")}" --platform=node --format=esm --bundle=false`,
|
|
424
419
|
{ NODE_ENV: "production" }
|
|
425
420
|
);
|
|
426
421
|
console.log("[Sprint] sprint.config.js generated ✓");
|
|
427
422
|
} else {
|
|
423
|
+
const tsconfigPath = join(projectRoot, "tsconfig.json");
|
|
428
424
|
console.log("[Sprint] Running tsc...");
|
|
429
|
-
await runCommand(
|
|
425
|
+
await runCommand(`tsc --project "${tsconfigPath}"`, { NODE_ENV: "production" });
|
|
430
426
|
console.log("[Sprint] tsc completed ✓");
|
|
431
427
|
console.log("[Sprint] Running tsc-alias...");
|
|
432
|
-
await runCommand(
|
|
428
|
+
await runCommand(`tsc-alias --project "${tsconfigPath}"`, { NODE_ENV: "production" });
|
|
433
429
|
console.log("[Sprint] tsc-alias completed ✓");
|
|
434
430
|
}
|
|
435
431
|
break;
|