MCPcopy
hub / github.com/t3-oss/create-t3-app / selectAppFile

Function selectAppFile

cli/src/helpers/selectBoilerplate.ts:11–46  ·  view source on GitHub ↗
({
  projectDir,
  packages,
}: SelectBoilerplateProps)

Source from the content-addressed store, hash-verified

9>;
10// This generates the _app.tsx file that is used to render the app
11export const selectAppFile = ({
12 projectDir,
13 packages,
14}: SelectBoilerplateProps) => {
15 const appFileDir = path.join(PKG_ROOT, "template/extras/src/pages/_app");
16
17 const usingTw = packages.tailwind.inUse;
18 const usingTRPC = packages.trpc.inUse;
19 const usingAuth = packages?.nextAuth.inUse ?? packages?.betterAuth.inUse;
20 const usingBetterAuth = packages?.betterAuth.inUse;
21
22 let appFile = "base.tsx";
23 if (usingTRPC && usingTw && usingBetterAuth) {
24 appFile = "with-better-auth-trpc-tw.tsx";
25 } else if (usingTRPC && !usingTw && usingBetterAuth) {
26 appFile = "with-better-auth-trpc.tsx";
27 } else if (usingTRPC && usingTw && usingAuth) {
28 appFile = "with-auth-trpc-tw.tsx";
29 } else if (usingTRPC && !usingTw && usingAuth) {
30 appFile = "with-auth-trpc.tsx";
31 } else if (usingTRPC && usingTw) {
32 appFile = "with-trpc-tw.tsx";
33 } else if (usingTRPC && !usingTw) {
34 appFile = "with-trpc.tsx";
35 } else if (!usingTRPC && usingTw) {
36 appFile = "with-tw.tsx";
37 } else if (usingAuth && usingTw) {
38 appFile = "with-auth-tw.tsx";
39 } else if (usingAuth && !usingTw) {
40 appFile = "with-auth.tsx";
41 }
42
43 const appSrc = path.join(appFileDir, appFile);
44 const appDest = path.join(projectDir, "src/pages/_app.tsx");
45 fs.copySync(appSrc, appDest);
46};
47
48// Similar to _app, but for app router
49export const selectLayoutFile = ({

Callers 1

createProjectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected