mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
feat: add ai chat example and update flags structure
This commit is contained in:
@@ -14,10 +14,8 @@ export function displayConfig(config: Partial<ProjectConfig>) {
|
||||
configDisplay.push(`${pc.blue("Frontend:")} ${frontendText}`);
|
||||
}
|
||||
|
||||
if (config.backendFramework !== undefined) {
|
||||
configDisplay.push(
|
||||
`${pc.blue("Backend Framework:")} ${config.backendFramework}`,
|
||||
);
|
||||
if (config.backend !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Backend Framework:")} ${config.backend}`);
|
||||
}
|
||||
|
||||
if (config.runtime !== undefined) {
|
||||
|
||||
@@ -4,12 +4,12 @@ export function generateReproducibleCommand(config: ProjectConfig): string {
|
||||
const flags: string[] = [];
|
||||
|
||||
if (config.database === "none") {
|
||||
flags.push("--no-database");
|
||||
flags.push("--database none");
|
||||
} else {
|
||||
flags.push(`--${config.database}`);
|
||||
flags.push(`--database ${config.database}`);
|
||||
|
||||
if (config.orm) {
|
||||
flags.push(`--${config.orm}`);
|
||||
flags.push(`--orm ${config.orm}`);
|
||||
}
|
||||
|
||||
if (config.database === "sqlite") {
|
||||
@@ -23,36 +23,20 @@ export function generateReproducibleCommand(config: ProjectConfig): string {
|
||||
|
||||
flags.push(config.noInstall ? "--no-install" : "--install");
|
||||
|
||||
if (config.packageManager) {
|
||||
flags.push(`--${config.packageManager}`);
|
||||
}
|
||||
|
||||
if (config.backendFramework) {
|
||||
flags.push(`--${config.backendFramework}`);
|
||||
}
|
||||
|
||||
if (config.runtime) {
|
||||
flags.push(`--runtime ${config.runtime}`);
|
||||
}
|
||||
|
||||
if (config.frontend) {
|
||||
if (config.frontend.includes("web")) {
|
||||
flags.push("--web");
|
||||
} else {
|
||||
flags.push("--no-web");
|
||||
}
|
||||
|
||||
if (config.frontend.includes("native")) {
|
||||
flags.push("--native");
|
||||
} else {
|
||||
flags.push("--no-native");
|
||||
}
|
||||
if (config.backend) {
|
||||
flags.push(`--backend ${config.backend}`);
|
||||
}
|
||||
|
||||
if (config.addons.length > 0) {
|
||||
for (const addon of config.addons) {
|
||||
flags.push(`--${addon}`);
|
||||
}
|
||||
if (config.frontend && config.frontend.length > 0) {
|
||||
flags.push(`--frontend ${config.frontend.join(",")}`);
|
||||
}
|
||||
|
||||
if (config.addons && config.addons.length > 0) {
|
||||
flags.push(`--addons ${config.addons.join(",")}`);
|
||||
} else {
|
||||
flags.push("--no-addons");
|
||||
}
|
||||
@@ -63,7 +47,21 @@ export function generateReproducibleCommand(config: ProjectConfig): string {
|
||||
flags.push("--no-examples");
|
||||
}
|
||||
|
||||
const baseCommand = "npx create-better-t-stack";
|
||||
if (config.packageManager) {
|
||||
flags.push(`--package-manager ${config.packageManager}`);
|
||||
}
|
||||
|
||||
let baseCommand = "";
|
||||
const pkgManager = config.packageManager;
|
||||
|
||||
if (pkgManager === "npm") {
|
||||
baseCommand = "npm create better-t-stack@latest";
|
||||
} else if (pkgManager === "pnpm") {
|
||||
baseCommand = "pnpm create better-t-stack@latest";
|
||||
} else if (pkgManager === "bun") {
|
||||
baseCommand = "bun create better-t-stack@latest";
|
||||
}
|
||||
|
||||
const projectName = config.projectName ? ` ${config.projectName}` : "";
|
||||
|
||||
return `${baseCommand}${projectName} ${flags.join(" ")}`;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { PackageManager } from "../types";
|
||||
import type { ProjectPackageManager } from "../types";
|
||||
|
||||
export const getUserPkgManager: () => PackageManager = () => {
|
||||
export const getUserPkgManager: () => ProjectPackageManager = () => {
|
||||
const userAgent = process.env.npm_config_user_agent;
|
||||
|
||||
if (userAgent?.startsWith("pnpm")) {
|
||||
|
||||
Reference in New Issue
Block a user