mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
add tauri option for nextjs
This commit is contained in:
@@ -14,6 +14,7 @@ export async function setupAddons(config: ProjectConfig) {
|
||||
const hasNuxtFrontend = frontend.includes("nuxt");
|
||||
const hasSvelteFrontend = frontend.includes("svelte");
|
||||
const hasSolidFrontend = frontend.includes("solid");
|
||||
const hasNextFrontend = frontend.includes("next");
|
||||
|
||||
if (addons.includes("turborepo")) {
|
||||
await addPackageDependency({
|
||||
@@ -30,7 +31,8 @@ export async function setupAddons(config: ProjectConfig) {
|
||||
(hasReactWebFrontend ||
|
||||
hasNuxtFrontend ||
|
||||
hasSvelteFrontend ||
|
||||
hasSolidFrontend)
|
||||
hasSolidFrontend ||
|
||||
hasNextFrontend)
|
||||
) {
|
||||
await setupTauri(config);
|
||||
}
|
||||
|
||||
@@ -45,17 +45,22 @@ export async function setupTauri(config: ProjectConfig): Promise<void> {
|
||||
const hasNuxt = frontend.includes("nuxt");
|
||||
const hasSvelte = frontend.includes("svelte");
|
||||
const hasSolid = frontend.includes("solid");
|
||||
const hasNext = frontend.includes("next");
|
||||
|
||||
const devUrl =
|
||||
hasReactRouter || hasSvelte
|
||||
? "http://localhost:5173"
|
||||
: "http://localhost:3001";
|
||||
: hasNext
|
||||
? "http://localhost:3001"
|
||||
: "http://localhost:3001";
|
||||
|
||||
const frontendDist = hasNuxt
|
||||
? "../.output/public"
|
||||
: hasSvelte
|
||||
? "../build"
|
||||
: "../dist";
|
||||
: hasNext
|
||||
? "../.next"
|
||||
: "../dist";
|
||||
|
||||
const tauriArgs = [
|
||||
"init",
|
||||
|
||||
@@ -795,7 +795,8 @@ function processAndValidateFlags(
|
||||
f === "react-router" ||
|
||||
f === "nuxt" ||
|
||||
f === "svelte" ||
|
||||
f === "solid";
|
||||
f === "solid" ||
|
||||
f === "next";
|
||||
|
||||
if (
|
||||
config.addons?.includes("pwa") &&
|
||||
@@ -820,7 +821,7 @@ function processAndValidateFlags(
|
||||
}
|
||||
if (config.addons.includes("tauri")) {
|
||||
incompatibleReason =
|
||||
"Tauri requires tanstack-router, react-router, nuxt, svelte, or solid.";
|
||||
"Tauri requires tanstack-router, react-router, nuxt, svelte, solid, or next.";
|
||||
}
|
||||
consola.fatal(
|
||||
`Incompatible addon/frontend combination: ${incompatibleReason}`,
|
||||
|
||||
@@ -25,7 +25,8 @@ export async function getAddonsChoice(
|
||||
frontends?.includes("tanstack-router") ||
|
||||
frontends?.includes("nuxt") ||
|
||||
frontends?.includes("svelte") ||
|
||||
frontends?.includes("solid");
|
||||
frontends?.includes("solid") ||
|
||||
frontends?.includes("next");
|
||||
|
||||
const allPossibleOptions: AddonOption[] = [
|
||||
{
|
||||
|
||||
@@ -105,7 +105,14 @@ const hasPWACompatibleFrontend = (frontend: string[]) =>
|
||||
|
||||
const hasTauriCompatibleFrontend = (frontend: string[]) =>
|
||||
frontend.some((f) =>
|
||||
["tanstack-router", "react-router", "nuxt", "svelte", "solid"].includes(f),
|
||||
[
|
||||
"tanstack-router",
|
||||
"react-router",
|
||||
"nuxt",
|
||||
"svelte",
|
||||
"solid",
|
||||
"next",
|
||||
].includes(f),
|
||||
);
|
||||
|
||||
const getBadgeColors = (category: string): string => {
|
||||
@@ -545,10 +552,10 @@ const analyzeStackCompatibility = (stack: StackState): CompatibilityResult => {
|
||||
if (!isTauriCompat && nextStack.addons.includes("tauri")) {
|
||||
incompatibleAddons.push("tauri");
|
||||
notes.frontend.notes.push(
|
||||
"Tauri addon requires TanStack/React Router, Nuxt, Svelte or Solid. Addon will be removed.",
|
||||
"Tauri addon requires TanStack/React Router, Nuxt, Svelte, Solid, or Next.js. Addon will be removed.",
|
||||
);
|
||||
notes.addons.notes.push(
|
||||
"Tauri requires TanStack/React Router/Nuxt/Svelte/Solid. It will be removed.",
|
||||
"Tauri requires TanStack/React Router/Nuxt/Svelte/Solid/Next.js. It will be removed.",
|
||||
);
|
||||
notes.frontend.hasIssue = true;
|
||||
notes.addons.hasIssue = true;
|
||||
@@ -1213,7 +1220,7 @@ const StackArchitect = () => {
|
||||
addRule(
|
||||
category,
|
||||
techId,
|
||||
"Disabled: Tauri addon requires a compatible frontend (e.g., TanStack Router, Nuxt, Svelte, Solid).",
|
||||
"Disabled: Tauri addon requires a compatible frontend (e.g., TanStack Router, Nuxt, Svelte, Solid, Next.js).",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user