create-esa-stack 0.1.1 → 0.1.3
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 +73 -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,48 @@ 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
|
+
}
|
|
675
|
+
const installTanstackQuery = await ce({
|
|
676
|
+
message: "Do you want to install TanStack Query?",
|
|
677
|
+
initialValue: true
|
|
678
|
+
});
|
|
679
|
+
if (typeof installTanstackQuery === "symbol") {
|
|
680
|
+
he("Operation cancelled.");
|
|
681
|
+
process.exit(0);
|
|
682
|
+
}
|
|
630
683
|
const s = _2();
|
|
631
684
|
s.start("Scaffolding project...");
|
|
632
685
|
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
686
|
try {
|
|
634
687
|
s.stop("Starting scaffolding...");
|
|
635
688
|
execSync(command, { stdio: "inherit" });
|
|
689
|
+
const projectPath = join(process.cwd(), projectName);
|
|
690
|
+
if (installShadcn) {
|
|
691
|
+
console.log(`
|
|
692
|
+
Setting up shadcn/ui...`);
|
|
693
|
+
console.log("Installing dependencies...");
|
|
694
|
+
execSync("pnpm install", { stdio: "inherit", cwd: projectPath });
|
|
695
|
+
console.log("Initializing shadcn/ui...");
|
|
696
|
+
execSync("npx shadcn@latest init", { stdio: "inherit", cwd: projectPath });
|
|
697
|
+
}
|
|
698
|
+
if (installTanstackQuery) {
|
|
699
|
+
console.log(`
|
|
700
|
+
Setting up TanStack Query...`);
|
|
701
|
+
const hasNodeModules = existsSync(join(projectPath, "node_modules"));
|
|
702
|
+
if (!installShadcn && !hasNodeModules) {
|
|
703
|
+
console.log("Installing dependencies...");
|
|
704
|
+
execSync("pnpm install", { stdio: "inherit", cwd: projectPath });
|
|
705
|
+
}
|
|
706
|
+
console.log("Installing @tanstack/react-query...");
|
|
707
|
+
execSync("pnpm add @tanstack/react-query", { stdio: "inherit", cwd: projectPath });
|
|
708
|
+
}
|
|
636
709
|
ge(`Successfully created ${projectName}!`);
|
|
637
710
|
} catch (error) {
|
|
638
711
|
s.stop("Failed to scaffold project.");
|