sprint-es 0.0.152 → 0.0.154
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 +31 -0
- package/dist/esm/cli.js +31 -0
- package/package.json +1 -1
package/dist/cjs/cli.cjs
CHANGED
|
@@ -387,6 +387,32 @@ async function runDoctor() {
|
|
|
387
387
|
}
|
|
388
388
|
logger.break();
|
|
389
389
|
}
|
|
390
|
+
const commandDependencies = {
|
|
391
|
+
build: {
|
|
392
|
+
ts: ["tsup", "typescript"],
|
|
393
|
+
js: ["tsup"]
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
function checkDependencies(command2, isTS) {
|
|
397
|
+
const config = commandDependencies[command2];
|
|
398
|
+
if (!config) return [];
|
|
399
|
+
const deps = config.ts ?? [];
|
|
400
|
+
const missing = [];
|
|
401
|
+
for (const dep of deps) {
|
|
402
|
+
const binPath = path.join(projectRoot, "node_modules", ".bin", dep);
|
|
403
|
+
if (!fs.existsSync(binPath)) missing.push(dep);
|
|
404
|
+
}
|
|
405
|
+
if (missing.length > 0) {
|
|
406
|
+
console.error("\n❌ Missing required dependencies:");
|
|
407
|
+
for (const dep of missing) {
|
|
408
|
+
console.error(` • ${dep}`);
|
|
409
|
+
}
|
|
410
|
+
console.error("\n👉 Install with:");
|
|
411
|
+
console.error(" npm install --save-dev " + missing.join(" "));
|
|
412
|
+
console.error("");
|
|
413
|
+
process.exit(1);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
390
416
|
async function main() {
|
|
391
417
|
const hasDist = fs.existsSync(path.join(projectRoot, "dist"));
|
|
392
418
|
const hasTsConfig = fs.existsSync(path.join(projectRoot, "tsconfig.json"));
|
|
@@ -407,9 +433,14 @@ async function main() {
|
|
|
407
433
|
}
|
|
408
434
|
case "build": {
|
|
409
435
|
console.log("🚀 Building for production...");
|
|
436
|
+
checkDependencies("build");
|
|
410
437
|
const distPath = path.join(projectRoot, "dist");
|
|
411
438
|
const tsconfigPath = path.join(projectRoot, "tsconfig.json");
|
|
412
439
|
const hasSprintConfigTs = fs.existsSync(path.join(projectRoot, "sprint.config.ts"));
|
|
440
|
+
if (!hasSprintConfigTs) {
|
|
441
|
+
console.error("[Sprint] This command only works for TypeScript-based projects.");
|
|
442
|
+
process.exit(1);
|
|
443
|
+
}
|
|
413
444
|
console.log("[Sprint] Cleaning dist...");
|
|
414
445
|
fs.rmSync(distPath, { recursive: true, force: true });
|
|
415
446
|
console.log("[Sprint] dist cleaned ✓");
|
package/dist/esm/cli.js
CHANGED
|
@@ -368,6 +368,32 @@ async function runDoctor() {
|
|
|
368
368
|
}
|
|
369
369
|
logger.break();
|
|
370
370
|
}
|
|
371
|
+
const commandDependencies = {
|
|
372
|
+
build: {
|
|
373
|
+
ts: ["tsup", "typescript"],
|
|
374
|
+
js: ["tsup"]
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
function checkDependencies(command2, isTS) {
|
|
378
|
+
const config = commandDependencies[command2];
|
|
379
|
+
if (!config) return [];
|
|
380
|
+
const deps = config.ts ?? [];
|
|
381
|
+
const missing = [];
|
|
382
|
+
for (const dep of deps) {
|
|
383
|
+
const binPath = join(projectRoot, "node_modules", ".bin", dep);
|
|
384
|
+
if (!existsSync(binPath)) missing.push(dep);
|
|
385
|
+
}
|
|
386
|
+
if (missing.length > 0) {
|
|
387
|
+
console.error("\n❌ Missing required dependencies:");
|
|
388
|
+
for (const dep of missing) {
|
|
389
|
+
console.error(` • ${dep}`);
|
|
390
|
+
}
|
|
391
|
+
console.error("\n👉 Install with:");
|
|
392
|
+
console.error(" npm install --save-dev " + missing.join(" "));
|
|
393
|
+
console.error("");
|
|
394
|
+
process.exit(1);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
371
397
|
async function main() {
|
|
372
398
|
const hasDist = existsSync(join(projectRoot, "dist"));
|
|
373
399
|
const hasTsConfig = existsSync(join(projectRoot, "tsconfig.json"));
|
|
@@ -388,9 +414,14 @@ async function main() {
|
|
|
388
414
|
}
|
|
389
415
|
case "build": {
|
|
390
416
|
console.log("🚀 Building for production...");
|
|
417
|
+
checkDependencies("build");
|
|
391
418
|
const distPath = join(projectRoot, "dist");
|
|
392
419
|
const tsconfigPath = join(projectRoot, "tsconfig.json");
|
|
393
420
|
const hasSprintConfigTs = existsSync(join(projectRoot, "sprint.config.ts"));
|
|
421
|
+
if (!hasSprintConfigTs) {
|
|
422
|
+
console.error("[Sprint] This command only works for TypeScript-based projects.");
|
|
423
|
+
process.exit(1);
|
|
424
|
+
}
|
|
394
425
|
console.log("[Sprint] Cleaning dist...");
|
|
395
426
|
rmSync(distPath, { recursive: true, force: true });
|
|
396
427
|
console.log("[Sprint] dist cleaned ✓");
|