mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
add express, automated mongodb atlas setup, fix stack architech
This commit is contained in:
16
apps/cli/src/utils/command-exists.ts
Normal file
16
apps/cli/src/utils/command-exists.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { execa } from "execa";
|
||||
|
||||
export async function commandExists(command: string): Promise<boolean> {
|
||||
try {
|
||||
const isWindows = process.platform === "win32";
|
||||
if (isWindows) {
|
||||
const result = await execa("where", [command]);
|
||||
return result.exitCode === 0;
|
||||
}
|
||||
|
||||
const result = await execa("which", [command]);
|
||||
return result.exitCode === 0;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -60,14 +60,8 @@ export function displayConfig(config: Partial<ProjectConfig>) {
|
||||
configDisplay.push(`${pc.blue("Skip Install:")} ${config.noInstall}`);
|
||||
}
|
||||
|
||||
if (config.turso !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Turso Setup:")} ${config.turso}`);
|
||||
}
|
||||
|
||||
if (config.prismaPostgres !== undefined) {
|
||||
configDisplay.push(
|
||||
`${pc.blue("Prisma Postgres Setup:")} ${config.prismaPostgres ? "Yes" : "No"}`,
|
||||
);
|
||||
if (config.dbSetup !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Database Setup:")} ${config.dbSetup}`);
|
||||
}
|
||||
|
||||
return configDisplay.join("\n");
|
||||
|
||||
@@ -12,8 +12,8 @@ export function generateReproducibleCommand(config: ProjectConfig): string {
|
||||
flags.push(`--orm ${config.orm}`);
|
||||
}
|
||||
|
||||
if (config.database === "sqlite") {
|
||||
flags.push(config.turso ? "--turso" : "--no-turso");
|
||||
if (config.dbSetup && config.dbSetup !== "none") {
|
||||
flags.push(`--db-setup ${config.dbSetup}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user