mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
Add todo example, remove yarn, change schema structure, update readme
This commit is contained in:
@@ -5,11 +5,13 @@ import type {
|
||||
ProjectAddons,
|
||||
ProjectConfig,
|
||||
ProjectDatabase,
|
||||
ProjectExamples,
|
||||
ProjectOrm,
|
||||
} from "../types";
|
||||
import { getAddonsChoice } from "./addons";
|
||||
import { getAuthChoice } from "./auth";
|
||||
import { getDatabaseChoice } from "./database";
|
||||
import { getExamplesChoice } from "./examples";
|
||||
import { getGitChoice } from "./git";
|
||||
import { getNoInstallChoice } from "./install";
|
||||
import { getORMChoice } from "./orm";
|
||||
@@ -23,6 +25,7 @@ interface PromptGroupResults {
|
||||
orm: ProjectOrm;
|
||||
auth: boolean;
|
||||
addons: ProjectAddons[];
|
||||
examples: ProjectExamples[];
|
||||
git: boolean;
|
||||
packageManager: PackageManager;
|
||||
noInstall: boolean;
|
||||
@@ -47,6 +50,7 @@ export async function gatherConfig(
|
||||
? getTursoSetupChoice(flags.turso)
|
||||
: Promise.resolve(false),
|
||||
addons: () => getAddonsChoice(flags.addons),
|
||||
examples: () => getExamplesChoice(flags.examples),
|
||||
git: () => getGitChoice(flags.git),
|
||||
packageManager: () => getPackageManagerChoice(flags.packageManager),
|
||||
noInstall: () => getNoInstallChoice(flags.noInstall),
|
||||
@@ -65,6 +69,7 @@ export async function gatherConfig(
|
||||
orm: result.orm,
|
||||
auth: result.auth,
|
||||
addons: result.addons,
|
||||
examples: result.examples,
|
||||
git: result.git,
|
||||
packageManager: result.packageManager,
|
||||
noInstall: result.noInstall,
|
||||
|
||||
30
apps/cli/src/prompts/examples.ts
Normal file
30
apps/cli/src/prompts/examples.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { cancel, isCancel, multiselect } from "@clack/prompts";
|
||||
import pc from "picocolors";
|
||||
import { DEFAULT_CONFIG } from "../constants";
|
||||
import type { ProjectExamples } from "../types";
|
||||
|
||||
export async function getExamplesChoice(
|
||||
examples?: ProjectExamples[],
|
||||
): Promise<ProjectExamples[]> {
|
||||
if (examples !== undefined) return examples;
|
||||
|
||||
const response = await multiselect<ProjectExamples>({
|
||||
message: "Which examples would you like to include?",
|
||||
options: [
|
||||
{
|
||||
value: "todo",
|
||||
label: "Todo App",
|
||||
hint: "A simple CRUD example app",
|
||||
},
|
||||
],
|
||||
required: false,
|
||||
initialValues: DEFAULT_CONFIG.examples,
|
||||
});
|
||||
|
||||
if (isCancel(response)) {
|
||||
cancel(pc.red("Operation cancelled"));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
@@ -24,11 +24,6 @@ export async function getPackageManagerChoice(
|
||||
label: "pnpm",
|
||||
hint: "Fast, disk space efficient package manager",
|
||||
},
|
||||
{
|
||||
value: "yarn",
|
||||
label: "yarn",
|
||||
hint: "Fast, reliable, and secure dependency management",
|
||||
},
|
||||
],
|
||||
initialValue: detectedPackageManager,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user