Add Tauri desktop app support

Adds integration with Tauri for building native desktop apps from the web frontend, including CLI option, setup scripts, initialization logic, and post-installation instructions.
This commit is contained in:
Aman Varshney
2025-03-22 15:16:19 +05:30
parent b2feac3f8d
commit 406864f411
9 changed files with 113 additions and 7 deletions

View File

@@ -1,6 +1,11 @@
import { log } from "@clack/prompts";
import pc from "picocolors";
import type { PackageManager, ProjectDatabase, ProjectOrm } from "../types";
import type {
PackageManager,
ProjectAddons,
ProjectDatabase,
ProjectOrm,
} from "../types";
export function displayPostInstallInstructions(
database: ProjectDatabase,
@@ -8,6 +13,7 @@ export function displayPostInstallInstructions(
packageManager: PackageManager,
depsInstalled: boolean,
orm?: ProjectOrm,
addons?: ProjectAddons[],
) {
const runCmd = packageManager === "npm" ? "npm run" : packageManager;
const cdCmd = `cd ${projectName}`;
@@ -22,7 +28,8 @@ ${pc.bold("Your project will be available at:")}
${pc.cyan("•")} Frontend: http://localhost:3001
${pc.cyan("•")} API: http://localhost:3000
${database !== "none" ? getDatabaseInstructions(database, orm, runCmd) : ""}`);
${database !== "none" ? getDatabaseInstructions(database, orm, runCmd) : ""}
${addons?.includes("tauri") ? getTauriInstructions(runCmd) : ""}`);
}
function getDatabaseInstructions(
@@ -63,3 +70,7 @@ function getDatabaseInstructions(
? `${pc.bold("Database commands:")}\n${instructions.join("\n")}\n\n`
: "";
}
function getTauriInstructions(runCmd?: string): string {
return `${pc.bold("Desktop app with Tauri:")}\n${pc.cyan("•")} Start desktop app: ${pc.dim(`cd packages/client && ${runCmd} desktop:dev`)}\n${pc.cyan("•")} Build desktop app: ${pc.dim(`cd packages/client && ${runCmd} desktop:build`)}\n${pc.yellow("NOTE:")} Tauri requires Rust and platform-specific dependencies. See: ${pc.dim("https://v2.tauri.app/start/prerequisites/")}\n\n`;
}