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

Function selectLayoutFile

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

Source from the content-addressed store, hash-verified

47
48// Similar to _app, but for app router
49export const selectLayoutFile = ({
50 projectDir,
51 packages,
52}: SelectBoilerplateProps) => {
53 const layoutFileDir = path.join(PKG_ROOT, "template/extras/src/app/layout");
54
55 const usingTw = packages.tailwind.inUse;
56 const usingTRPC = packages.trpc.inUse;
57 let layoutFile = "base.tsx";
58 if (usingTRPC && usingTw) {
59 layoutFile = "with-trpc-tw.tsx";
60 } else if (usingTRPC && !usingTw) {
61 layoutFile = "with-trpc.tsx";
62 } else if (!usingTRPC && usingTw) {
63 layoutFile = "with-tw.tsx";
64 }
65
66 const appSrc = path.join(layoutFileDir, layoutFile);
67 const appDest = path.join(projectDir, "src/app/layout.tsx");
68 fs.copySync(appSrc, appDest);
69};
70
71// This selects the proper index.tsx to be used that showcases the chosen tech
72export const selectIndexFile = ({

Callers 1

createProjectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected