mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
add pwa in nextjs
This commit is contained in:
@@ -10,7 +10,9 @@ import type { ProjectConfig } from "../types";
|
||||
export async function setupAddons(config: ProjectConfig) {
|
||||
const { addons, frontend, projectDir } = config;
|
||||
const hasReactWebFrontend =
|
||||
frontend.includes("react-router") || frontend.includes("tanstack-router");
|
||||
frontend.includes("react-router") ||
|
||||
frontend.includes("tanstack-router") ||
|
||||
frontend.includes("next");
|
||||
const hasNuxtFrontend = frontend.includes("nuxt");
|
||||
const hasSvelteFrontend = frontend.includes("svelte");
|
||||
const hasSolidFrontend = frontend.includes("solid");
|
||||
|
||||
@@ -557,10 +557,20 @@ export async function setupAddonsTemplate(
|
||||
let addonDestDir = projectDir;
|
||||
|
||||
if (addon === "pwa") {
|
||||
addonSrcDir = path.join(PKG_ROOT, "templates/addons/pwa/apps/web");
|
||||
addonDestDir = path.join(projectDir, "apps/web");
|
||||
|
||||
if (!(await fs.pathExists(addonDestDir))) {
|
||||
const webAppDir = path.join(projectDir, "apps/web");
|
||||
if (!(await fs.pathExists(webAppDir))) {
|
||||
continue;
|
||||
}
|
||||
addonDestDir = webAppDir;
|
||||
if (context.frontend.includes("next")) {
|
||||
addonSrcDir = path.join(PKG_ROOT, "templates/addons/pwa/apps/web/next");
|
||||
} else if (
|
||||
context.frontend.some((f) =>
|
||||
["tanstack-router", "react-router", "solid"].includes(f),
|
||||
)
|
||||
) {
|
||||
addonSrcDir = path.join(PKG_ROOT, "templates/addons/pwa/apps/web/vite");
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user