From 178908930bea7b5bbbff8b5f8e50f05a470244b7 Mon Sep 17 00:00:00 2001 From: Yordis Prieto Date: Wed, 13 Mar 2024 19:32:54 -0400 Subject: [PATCH] feat: add t3app well-known playground routing --- .changeset/clever-numbers-swim.md | 5 +++++ cli/src/helpers/createProject.ts | 2 ++ cli/src/helpers/selectBoilerplate.ts | 12 ++++++++++++ .../src/app/.well-known/t3app/playground/.gitignore | 1 + .../src/app/.well-known/t3app/playground/page.tsx | 3 +++ 5 files changed, 23 insertions(+) create mode 100644 .changeset/clever-numbers-swim.md create mode 100644 cli/template/extras/src/app/.well-known/t3app/playground/.gitignore create mode 100644 cli/template/extras/src/app/.well-known/t3app/playground/page.tsx diff --git a/.changeset/clever-numbers-swim.md b/.changeset/clever-numbers-swim.md new file mode 100644 index 0000000000..7e5423ff3e --- /dev/null +++ b/.changeset/clever-numbers-swim.md @@ -0,0 +1,5 @@ +--- +"create-t3-app": minor +--- + +Add t3app well-known playground routing diff --git a/cli/src/helpers/createProject.ts b/cli/src/helpers/createProject.ts index 81b385485f..e635281709 100644 --- a/cli/src/helpers/createProject.ts +++ b/cli/src/helpers/createProject.ts @@ -9,6 +9,7 @@ import { selectIndexFile, selectLayoutFile, selectPageFile, + selectWellknown3AppFiles, } from "~/helpers/selectBoilerplate.js"; import { type DatabaseProvider, @@ -69,6 +70,7 @@ export const createProject = async ({ ); selectLayoutFile({ projectDir, packages }); + selectWellknown3AppFiles({ projectDir, packages }); selectPageFile({ projectDir, packages }); } else { selectAppFile({ projectDir, packages }); diff --git a/cli/src/helpers/selectBoilerplate.ts b/cli/src/helpers/selectBoilerplate.ts index 2b07079be6..a2eddc549d 100644 --- a/cli/src/helpers/selectBoilerplate.ts +++ b/cli/src/helpers/selectBoilerplate.ts @@ -63,6 +63,18 @@ export const selectLayoutFile = ({ fs.copySync(appSrc, appDest); }; +// Adds the .well-known/t3app folder to the project +export const selectWellknown3AppFiles = ({ + projectDir, +}: SelectBoilerplateProps) => { + const appSrc = path.join( + PKG_ROOT, + "template/extras/src/app/.well-known/t3app" + ); + const appDest = path.join(projectDir, "src/app/.well-known/t3app"); + fs.copySync(appSrc, appDest); +}; + // This selects the proper index.tsx to be used that showcases the chosen tech export const selectIndexFile = ({ projectDir, diff --git a/cli/template/extras/src/app/.well-known/t3app/playground/.gitignore b/cli/template/extras/src/app/.well-known/t3app/playground/.gitignore new file mode 100644 index 0000000000..72e8ffc0db --- /dev/null +++ b/cli/template/extras/src/app/.well-known/t3app/playground/.gitignore @@ -0,0 +1 @@ +* diff --git a/cli/template/extras/src/app/.well-known/t3app/playground/page.tsx b/cli/template/extras/src/app/.well-known/t3app/playground/page.tsx new file mode 100644 index 0000000000..31c7dd2c7c --- /dev/null +++ b/cli/template/extras/src/app/.well-known/t3app/playground/page.tsx @@ -0,0 +1,3 @@ +export default function Playground() { + return

Hello, Playground!

; +}