create-esa-stack 0.1.1 → 0.1.2
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/cli.js +54 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -455,6 +455,24 @@ class x {
|
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
|
+
|
|
459
|
+
class BD extends x {
|
|
460
|
+
get cursor() {
|
|
461
|
+
return this.value ? 0 : 1;
|
|
462
|
+
}
|
|
463
|
+
get _value() {
|
|
464
|
+
return this.cursor === 0;
|
|
465
|
+
}
|
|
466
|
+
constructor(u) {
|
|
467
|
+
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
|
|
468
|
+
this.value = this._value;
|
|
469
|
+
}), this.on("confirm", (F) => {
|
|
470
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close();
|
|
471
|
+
}), this.on("cursor", () => {
|
|
472
|
+
this.value = !this.value;
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
}
|
|
458
476
|
var TD = Object.defineProperty;
|
|
459
477
|
var jD = (e, u, F) => (u in e) ? TD(e, u, { enumerable: true, configurable: true, writable: true, value: F }) : e[u] = F;
|
|
460
478
|
var MD = (e, u, F) => (jD(e, typeof u != "symbol" ? u + "" : u, F), F);
|
|
@@ -563,6 +581,25 @@ ${import_picocolors2.default.cyan($2)}
|
|
|
563
581
|
`;
|
|
564
582
|
}
|
|
565
583
|
} }).prompt();
|
|
584
|
+
var ce = (s) => {
|
|
585
|
+
const n = s.active ?? "Yes", t = s.inactive ?? "No";
|
|
586
|
+
return new BD({ active: n, inactive: t, initialValue: s.initialValue ?? true, render() {
|
|
587
|
+
const i = `${import_picocolors2.default.gray(a2)}
|
|
588
|
+
${y2(this.state)} ${s.message}
|
|
589
|
+
`, r2 = this.value ? n : t;
|
|
590
|
+
switch (this.state) {
|
|
591
|
+
case "submit":
|
|
592
|
+
return `${i}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.dim(r2)}`;
|
|
593
|
+
case "cancel":
|
|
594
|
+
return `${i}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(r2))}
|
|
595
|
+
${import_picocolors2.default.gray(a2)}`;
|
|
596
|
+
default:
|
|
597
|
+
return `${i}${import_picocolors2.default.cyan(a2)} ${this.value ? `${import_picocolors2.default.green(I2)} ${n}` : `${import_picocolors2.default.dim(T2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(T2)} ${import_picocolors2.default.dim(t)}` : `${import_picocolors2.default.green(I2)} ${t}`}
|
|
598
|
+
${import_picocolors2.default.cyan($2)}
|
|
599
|
+
`;
|
|
600
|
+
}
|
|
601
|
+
} }).prompt();
|
|
602
|
+
};
|
|
566
603
|
var he = (s = "") => {
|
|
567
604
|
process.stdout.write(`${import_picocolors2.default.gray($2)} ${import_picocolors2.default.red(s)}
|
|
568
605
|
|
|
@@ -627,12 +664,29 @@ async function main() {
|
|
|
627
664
|
he("Operation cancelled.");
|
|
628
665
|
process.exit(0);
|
|
629
666
|
}
|
|
667
|
+
const installShadcn = await ce({
|
|
668
|
+
message: "Do you want to install shadcn/ui?",
|
|
669
|
+
initialValue: true
|
|
670
|
+
});
|
|
671
|
+
if (typeof installShadcn === "symbol") {
|
|
672
|
+
he("Operation cancelled.");
|
|
673
|
+
process.exit(0);
|
|
674
|
+
}
|
|
630
675
|
const s = _2();
|
|
631
676
|
s.start("Scaffolding project...");
|
|
632
677
|
const command = `npx create-next-app@latest ${projectName} --biome --ts --tailwind --react-compiler --app --src-dir --import-alias "@/*" --use-pnpm --turbopack --skip-install --yes`;
|
|
633
678
|
try {
|
|
634
679
|
s.stop("Starting scaffolding...");
|
|
635
680
|
execSync(command, { stdio: "inherit" });
|
|
681
|
+
if (installShadcn) {
|
|
682
|
+
const projectPath = join(process.cwd(), projectName);
|
|
683
|
+
console.log(`
|
|
684
|
+
Setting up shadcn/ui...`);
|
|
685
|
+
console.log("Installing dependencies...");
|
|
686
|
+
execSync("pnpm install", { stdio: "inherit", cwd: projectPath });
|
|
687
|
+
console.log("Initializing shadcn/ui...");
|
|
688
|
+
execSync("npx shadcn@latest init", { stdio: "inherit", cwd: projectPath });
|
|
689
|
+
}
|
|
636
690
|
ge(`Successfully created ${projectName}!`);
|
|
637
691
|
} catch (error) {
|
|
638
692
|
s.stop("Failed to scaffold project.");
|