mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
Add PWA setup with vite-plugin-pwa, assets generator, and templates Include CLI flag and interactive prompt option for PWA installation
34 lines
764 B
TypeScript
34 lines
764 B
TypeScript
import { cancel, isCancel, multiselect } from "@clack/prompts";
|
|
import pc from "picocolors";
|
|
import type { ProjectAddons } from "../types";
|
|
|
|
export async function getAddonsChoice(
|
|
Addons?: ProjectAddons[],
|
|
): Promise<ProjectAddons[]> {
|
|
if (Addons !== undefined) return Addons;
|
|
|
|
const response = await multiselect<ProjectAddons>({
|
|
message: "Which Addons would you like to add?",
|
|
options: [
|
|
{
|
|
value: "docker",
|
|
label: "Docker setup",
|
|
hint: "Containerize your application",
|
|
},
|
|
{
|
|
value: "pwa",
|
|
label: "PWA (Progressive Web App)",
|
|
hint: "Make your app installable and work offline",
|
|
},
|
|
],
|
|
required: false,
|
|
});
|
|
|
|
if (isCancel(response)) {
|
|
cancel(pc.red("Operation cancelled"));
|
|
process.exit(0);
|
|
}
|
|
|
|
return response;
|
|
}
|