Add todo example, remove yarn, change schema structure, update readme

This commit is contained in:
Aman Varshney
2025-03-24 00:04:53 +05:30
parent 5076bf4176
commit 4cc13bf382
42 changed files with 525 additions and 443 deletions

View File

@@ -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,

View 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;
}

View File

@@ -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,
});